1/61
claude
Euler circuit theorem (when does a connected graph have one)?
Every vertex has EVEN degree. If any vertex is odd, there is no Euler circuit.
Euler path (trail) theorem (when does a connected graph have one)?
Exactly 2 vertices have odd degree and all the others are even. More or fewer than 2 odd vertices means no Euler path.
Where must an Euler path start and end?
It starts at one odd-degree vertex and ends at the other odd-degree vertex.
Trick for tracing an Euler trail
Find the 2 odd vertices, start at one, and finish at the other.
Euler trail vs Euler circuit
Euler trail: uses every edge exactly once (open, 2 odd vertices). Euler circuit: uses every edge exactly once AND is closed (returns to the start). All vertices are even.
Eulerian graph
A graph that has an Euler tour (Euler circuit).
Euler tour
A closed Euler trail: a closed walk that uses every edge exactly once.
Walk
A finite sequence of alternating vertices and edges. Edges and vertices CAN repeat.
Length of a walk
The number of edges in the walk. A "walk of length 5" has 5 edges, repeats allowed.
Trail
A walk in which all EDGES are distinct (vertices may repeat).
Path
A walk in which all VERTICES are distinct (so no edge repeats either).
Walk vs trail vs path (quick compare)
Walk: anything goes. Trail: no repeated edges. Path: no repeated vertices.
Trivial walk
A walk containing no edges (length 0).
Closed walk vs open walk
Closed if the start vertex = the end vertex (u = v). Open if u ≠ v.
Circuit
A path that ends at the same vertex where it started.
How do you check a walk or trail of length 5?
Count the edges, not the vertices. A walk A-B-E-C-D-A has 5 edges, so its length is 5.
Maximum trail
The longest trail possible, using as many distinct edges as possible without repeating any edge.
Hamiltonian circuit
A circuit that visits every vertex exactly once and returns to the starting vertex.
Hamiltonian graph
A graph that contains a Hamiltonian circuit.
Euler vs Hamilton (key difference)
Euler is about EDGES (use every edge once). Hamilton is about VERTICES (visit every vertex once, then return to start).
Dirac's theorem
If a connected graph has at least 3 vertices and no multiple edges, and every vertex has degree at least n/2 (n = number of vertices), then the graph is Hamiltonian.
Apply Dirac's theorem: 6 vertices, every vertex has degree at least 3. Hamiltonian?
Yes. n = 6, n/2 = 3, and every degree is at least 3, so it is Hamiltonian.
Does Dirac's theorem fail mean not Hamiltonian?
No. Dirac only guarantees Hamiltonian when the condition holds. If it fails, the graph might still be Hamiltonian, and you check by trial and error.
Degree of a vertex
The number of edges connected to that vertex.
Degree in a directed graph
Written as (in, out): the arrows going into the vertex and the arrows going out of it. Example: A(0,2), B(2,0), C(1,1).
Undirected vs directed edge
Undirected: a plain line, which can be traveled both ways. Directed: an arrow, which can be traveled only one way.
Equivalent graphs: how to check
1) Compare the number of vertices. 2) Compare the number of edges. 3) Only if both are equal, map vertices, starting with the degrees. 4) Check that every edge connection matches.
Do edge shape, length, or vertex position matter for equivalent graphs?
No. Only which vertices are connected by edges matters.
Two graphs differ by one edge (example: one has AB, the other does not). Equivalent?
No. They must have exactly the same set of edges.
Graph
A set of points (vertices) and line segments or curves (edges) connecting them.
Connected graph
Any vertex can be reached from any other vertex by tracing along edges (the graph is in one piece).
Simple graph
A graph with no loops and no multiple (parallel) edges.
Loop
An edge that goes from a vertex back to the same vertex.
Multiple (parallel) edges
Two or more edges that connect the same pair of vertices.
Complete graph
A graph in which every possible edge is drawn between vertices (no multiple edges).
Null graph
A graph with vertices but no edges (a disconnected graph).
Weighted graph
A graph in which each edge has a value (weight), such as distance, cost, or time.
Traveling salesman problem
Finding the Hamiltonian circuit in a weighted graph with the smallest total weight.
Total weight of a Hamiltonian circuit
Add up the weights of all the edges used in the circuit.
Nearest-neighbor algorithm (steps)
1) Start at a vertex and take the edge with the smallest weight. 2) At each new vertex, take the smallest-weight edge to a vertex NOT yet visited. 3) After all vertices are visited, return to the start.
Nearest-neighbor example: circuit A-D-B-F-E-C-A, total weight?
4 + 2 + 5 + 10 + 6 + 15 = 42
Does the nearest-neighbor algorithm always give the best route?
No. It gives a low-cost route, but finding the very best route is hard.
London flights example result (nearest-neighbor)
Total airfare = 160 + 215 + 380 + 480 + 375 + 325 = $1935
Chicago example: which of the 3 routes was cheapest?
Chicago-Philadelphia-Dallas-Washington DC-Atlanta-New York-Chicago, with total 5154 miles (the others were 5197 and 5239).
Planar graph
A graph that can be drawn so that no edges cross except at vertices.
Utilities puzzle (3 utilities, 3 houses)
The graph is K3,3. It cannot be drawn without crossings, so it is NOT planar.
How to show a graph is planar
Redraw it in an equivalent form (move or curve edges) so no edges cross.
Face (planar graph)
A region bounded by edges. The exterior region around the graph also counts as a face (the infinite face).
Euler's formula
For a connected planar graph: v + f = e + 2 (v = vertices, f = faces, e = edges).
Verify Euler's formula: e = 7, v = 5, f = 4
v + f = 5 + 4 = 9 and e + 2 = 7 + 2 = 9, so it is verified.
Does Euler's formula count the infinite face?
Yes. The outside region counts as one face.
Graph coloring rule
Color the vertices so that vertices joined by an edge never have the same color.
Chromatic number
The minimum number of colors needed to color a graph properly.
Four-color theorem
Any map (planar graph) can be colored with at most 4 colors so that neighbors have different colors.
Turning a map into a graph
Each country or region becomes a vertex. Draw an edge between two vertices if the regions share a border.
Scheduling with graph coloring
Each item (club, group) is a vertex. Draw an edge if two items conflict (shared members). Each color is a time slot or day, so the minimum colors = the minimum time slots.
Club scheduling example (6 clubs, shared members): minimum time slots?
Konigsberg bridges problem: Euler circuit possible?
No. The graph has odd-degree vertices, so no Euler circuit exists.
Subway inspector example: can they cover each track once and return to the start?
No. Civic Center has degree 3 (odd), so the graph is not Eulerian and some track must be repeated.
Photographer road example: possible to travel each road exactly once?
Yes. Exactly two odd vertices (Alameda and Dover), so an Euler path exists. It must start at one and end at the other.
Facebook / web graph example
Each vertex is a person or website, and each edge is a friendship or link. Vertices with the most edges rank highest (Google ranking idea).
Why does network structure matter for infection spread (COVID article)?
Shorter path lengths mean faster, sharper infection curves. Longer path lengths flatten the curve.