ViewWiki

Lesson 1 of 4

Nodes and edges.

About 20 minutes · 5 practice questions

From a town to a graph: nodes, edges and degree, why the degrees always add up to twice the edges, and what a new bridge does to the degrees.

Step 1 of 5 · From a town to a graph

Step 1 of 5

From a town to a graph

The town of Königsberg, today Kaliningrad, was built on the river Pregel, which splits round an island. Four pieces of land, A to D, and seven bridges between them. When Leonhard Euler thought about the town in 1736, he saw that the shape of the lands and the length of the bridges change nothing: all that matters is what is joined to what.

A picture like that is called a graph: nodes (the lands) and edges (the bridges) joining pairs of nodes. The degree of a node is the number of edges touching it. Graphs describe nearly every network: social networks, roads, websites and routers. Predict, and then Look inside will shrink the town into a graph.

To the question

Step 2 of 5

Degrees

Each node in the graph is labelled with its degree. When you add up all the degrees, each edge is counted once at each of its ends.

To the question

Step 3 of 5

Handshakes

A surprising fact follows, the handshake lemma: at a party, the number of people who shook an odd number of hands is always even. The degrees add up to an even number, so the odd nodes come in pairs.

To the question

Step 4 of 5

A new bridge

In the Scene you can remove bridges or add two new ones. Each bridge touches two lands, so it changes two degrees.

To the question

Step 5 of 5

Counting back

The link between degrees and edges works both ways. In the graph of five bridges, for instance, you can count the bridges, but you can also add up the degrees and halve them.

To the question

Interactive scene

Loading the interactive version…

Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.

To the experiment

Practice · Predict, then look

The four lands of Königsberg will be nodes, and the seven bridges edges. The degree of a node is the number of edges touching it. What is the degree of the island A?

To the experiment

Practice · Calculate

Add up the degrees of all four nodes. What is the total?

To the experiment

Practice · Choose

Can there be a graph with exactly one node of odd degree?

To the experiment

Practice · Reach the target

Change the number of Bridges until the north bank B has degree 4, and press Check.

To the experiment

Practice · Calculate

A graph of four nodes has degrees 33⁠, 33⁠, 22⁠ and 22⁠. How many edges does it have?