Linear algebra and discrete math · University

Graphs

vertices and edges

The idea

A graph is points (vertices) and lines between them (edges) — a map of any kind of connections.

The board

  1. Cities and roads, people and friendships, pages and links — it's all a graph.
  2. Degree of a vertex: how many edges come out of it.
  3. Path: a sequence of edges. Tree: a connected graph with no cycles.
  4. The bridges of Königsberg (Euler, 1736): you can cross every bridge exactly once only if at most 2 vertices have odd degree.

The most common mistake

Thinking the positions of the points matter. Only the connections matter.

The trick

Google Maps finds the shortest path in a graph with Dijkstra's algorithm.

Problems

The sum of the degrees is always…

  • 2 × the number of edges
  • 0
  • odd
  • the number of vertices
Show the answer

2 × the number of edges — Every edge is counted twice.

A tree with 10 vertices has how many edges:

  • 10
  • 9
  • 11
  • 45
Show the answer

9 — Always n − 1.

Take the lesson · exercises and XPFree, no sign-up needed.

You need to know