MathIsimple

Lesson 5-2: Graph Theory Basics

Build intuition for graphs, degrees, connectivity, Euler trails/circuits, bipartite graphs, and Dijkstra's shortest paths.

Learning Objectives

  • Use core definitions: degree, path, cycle, connectivity (directed/undirected).
  • Decide Euler trails/circuits from degree parity and connectivity conditions.
  • Recognize bipartite graphs; rule out odd cycles.
  • Apply Dijkstra to compute single-source shortest paths.

Core Definitions

Vertices, Edges, Degree

G=(V,E)G=(V,E)
deg(v)=einE:eextincidenttovdeg(v) = |{ ein E : e ext{ incident to } v }|

Paths and Connectivity

Path: sequence of adjacent vertices; cycle returns to start.
Connected (undirected): every vertex pair has a path.
Strongly connected (directed): paths both directions between any two vertices.

Handshaking Lemma

sumvinVdeg(v)=2Esum_{vin V} deg(v) = 2|E|

Therefore, the number of odd-degree vertices is even.

Euler Trails and Circuits

  • Euler circuit exists iff the graph is connected (ignoring isolated vertices) and all degrees are even.
  • Euler trail (but not circuit) exists iff exactly two vertices have odd degree.
V={1,2,3,4}, E={(1,2),(1,3),(2,3),(3,4)}
Degrees: 1→2, 2→2, 3→3, 4→1 → two odd (3,4) → Euler trail exists, no Euler circuit.

Bipartite Graphs

A graph is bipartite if vertices split into two sets with edges only across sets. Equivalently, it is 2-colorable. No odd cycles exist.

Shortest Paths (Dijkstra)

For non-negative edge weights, Dijkstra expands the node with smallest tentative distance until all distances are finalized.

Edges: 1-2 (3), 1-3 (1), 2-4 (2), 3-4 (4)
Initialization: dist(1)=0; others=∞. Relax neighbors and iterate → dist(4)=5.

Worked Examples

Example 1: Euler Condition

Decide whether a given degree sequence permits an Euler circuit; justify with parity and connectivity.

Example 2: Bipartite or Not

Show a graph is bipartite by constructing a 2-coloring or citing absence of odd cycles.

Real-World Applications

  • Routing and navigation in transportation and communication networks.
  • Task assignment via bipartite matching (preview).
  • Network reliability and robustness analysis.

Practice Problems

Problem 1

Prove the handshaking lemma by counting incidences and by summing degrees.

Problem 2

Give a connected graph with exactly two odd-degree vertices.

Key Takeaways

  • Parity of degrees determines Euler conditions.
  • 2-colorability is equivalent to being bipartite (no odd cycles).
  • Dijkstra requires non-negative weights.
Continue to Lesson 5-3 for counting principles.