close

Session 11

Introduction to graphs

Graphs

Data AND connections are important

Things with physical connection

Things with non-physical connection

How?

We save data

We save info about connection

Graph components

Node or Vertex (contains data)

Edge (connection)

Node

Adjacent nodes = connected nodes

Neighbors = connected nodes

Degree = amount of neighbors

Edge

Direction (=> Directed Graph)

Weight (=> Weighted Graph)

Other data?

Density

Dense graph = all or nearly all nodes are connected (many connections)

Sparse graph = significantly less connections (compared to max)

Coding

Let's code Donald Duck cartoon characters to graph

Characters

Donald Duck

Daisy Duck

Huey, Dewey, and Louie

Gladstone Gander

Scrooge McDuck

Ludwig Von Drake

Flintheart Glomgold

Micky Mouse

Excercise 1

Your own solution

No data, just connections

Excercise 2

Your own solution

Data and connections

Exercise 3

Let's use some official representations