Unfinished learning resource · Units 1–8 available · Whole-course validation unfinished

Unit 5. Graphs, degrees, paths and connectivity

Unfinished learning resource · TMP-SCI-074. Units 1–8 are available. Whole-course validation remains unfinished. It is provisional noncredit self-study, not a completed semester, credit, accreditation or demonstrated competence. The retained weeks-8–9 allocation is eighteen learner hours: a planning estimate, not observed timing. Subject-specialist appraisal, learner attempts, accessibility testing and rubric calibration remain outstanding.

Use paper or an existing local editor. All networks and labels here are fictional. No real routes, private records, accounts, installations or uploads are required. Every diagram has an exact text alternative; calculations can be tabulated or written as lists. A spoken explanation with a local written edge list and trace is acceptable. Attempt the tasks before the separate explained answers. Keep first attempts, corrections and a changed-case retry.

Preparation and outcomes

Units 1–2 provide finite counting and partitions; Unit 4 supplies binary relations, equivalence classes and careful carrier definitions. Use the existing Mathematical Reasoning and Proof teaching for quantified claims, direct proof, counterexamples and induction. This unit applies those skills without replacing that prerequisite. No programming or calculus is assumed. Unit 6 will develop trees and spanning constructions; a search parent record here is not a completed tree course.

Readiness

R1. List the two-element subsets of {a,b,c}. How does an unordered pair differ from an ordered pair?

R2. Why does a partition require coverage and disjointness? Give a two-block partition of {1,2,3,4}.

R3. Negate “Every vertex can be reached from s.” What kind of evidence could establish the negation on a fully specified finite graph?

R4. Explain why a total of twelve incidences, with each edge contributing exactly two, corresponds to six edges. State the assumption that makes division by two valid.

Session A. The graph is the specification, not the drawing

1. Fix the type and the entire vertex set

Our default is a finite simple undirected graph G=(V,E). V is a finite set of vertices. E is a set of two-element subsets of V. Thus each edge joins distinct vertices, loops are excluded, and an unordered pair can occur at most once. We abbreviate {a,b} as ab; ab and ba denote the same edge. Labels carry no distance, direction or ranking unless the model separately says so.

A drawing can show the same graph in many shapes. Crossing lines do not add a vertex unless that vertex is explicitly declared. A missing line is not a short connection. Coordinates and apparent lengths are not edge weights. Always include isolated vertices in V: they have no incident edge but are still part of the graph and can change connectedness.

Worked graph K has V={a,b,c,d,e,f} and E={ab,ac,bc,cd,de}. Its adjacency lists are:

This is a complete text diagram: a,b,c form a triangle, c joins d, d joins e, and f is isolated. The list is symmetric because edges are undirected. Each edge appears in two lists, once at each endpoint. The model would change if f were omitted.

An adjacency matrix uses the same declared vertex order for rows and columns. Entry (x,y) is 1 when xy is an edge and 0 otherwise. In a simple undirected graph the matrix is symmetric with a zero diagonal. A nonsymmetric matrix describes a different object unless an error is identified. A self-loop or parallel edge would require a different graph convention; we do not quietly accept either in a simple graph.

G1. Write K's six matrix rows in order a,b,c,d,e,f. Count the 1s and explain why counting them as edges would double-count.

2. What a model does not establish

An edge can mean a stated connection, not every relationship the reader imagines. If vertices represent fictional rooms and edges represent supplied corridors, reachability is a statement about that supplied map. It does not prove a corridor is open, accessible or safe in reality. In this unit a path length counts edges, not metres or travel time. Later examples will deliberately change direction or add weights to expose that boundary.

Session B. Count degrees, then inspect the conclusion

3. The handshaking identity

The degree deg(v) is the number of edges incident with v. For a simple undirected graph it is the number of distinct neighbors. In K, the degrees in order a,b,c,d,e,f are 2,2,3,2,1,0. Their sum is ten and K has five edges.

General proof: form the set of incidences (v,e) with v an endpoint of e. Counting by vertex gives the sum of degrees. Counting by edge gives two incidences per edge, because each edge has exactly two distinct endpoints. Therefore

sum over v in V of deg(v) = 2|E|.

This is a finite double count, not a pattern guessed from K. It depends on our convention; if loops are later allowed, their degree contribution must be explicitly defined. We do not reuse the proof unchanged across graph types.

An immediate consequence is that the number of odd-degree vertices is even. Split the degree sum into even-degree and odd-degree terms. The even terms contribute an even number; the full sum is even, so the sum of odd terms is even. A sum of k odd integers has the parity of k, hence k is even. This constrains the number of odd-degree vertices, not the number of edges, connected components or all vertices.

4. Necessary is not sufficient

In a simple graph on n vertices, 0≤deg(v)≤n−1. The degree sum is even. But a proposed list meeting these two tests need not be realizable. For example, degrees 3,3,3,1 on four vertices pass both tests. Each degree-3 vertex must be adjacent to every other vertex, including the degree-1 vertex. That last vertex would have at least three neighbors, contradiction. A count can reject a proposal without fully characterizing every possible graph.

Nor does a degree list determine connectedness. On six vertices, one six-cycle and two disjoint triangles both have degree two everywhere. Every vertex has neighbors in both graphs, but only the first is connected. We will construct and inspect them rather than infer shape from a sorted list.

G2. Could a simple undirected graph have degree list 3,2,2,2,0? Could one have 3,3,3,1? Give a different decisive reason for each rejection.

G3. K has two odd-degree vertices. Verify that statement and then change the model by adding edge ef. Recalculate the degrees affected and identify the new odd-degree vertices. Does evenness of their number prove connectedness?

Session C. A route needs its own vocabulary

5. Walk, trail, path and cycle

A walk is a finite vertex sequence v₀,v₁,…,vₖ in which each consecutive pair is an edge. Its length is k. It may repeat vertices or edges. A length-zero walk consists of one vertex. A trail is a walk with no repeated edge. A path in this unit is a walk with no repeated vertex. A closed walk has equal first and last vertex. A cycle is a closed walk of length at least three whose vertices are distinct except for the repeated first/last vertex. These conventions avoid calling an immediate return along one undirected edge a cycle.

In K, a,b,c,d,e is a path of length four. The walk a,c,a,b repeats edge ac (the reverse traversal is the same undirected edge), so it is not a trail. The sequence a,b,c,a is a cycle. The sequence a,e is not a walk because ae is not an edge. Stating plausible endpoints cannot repair an invalid intermediate step.

A trail can repeat a vertex, so trail does not imply path. With edges ab,bc,ca,ad,de,ea, the sequence a,b,c,a,d,e,a uses six distinct edges but revisits a before finishing. It is a closed trail, not a cycle under our definition. A path automatically is a trail: using an edge twice would repeat its endpoints.

6. Reachability has a path witness

If a walk from x to y repeats a vertex, say vᵢ=vⱼ with i<j, remove the portion after vᵢ through vⱼ. The remaining sequence is still a walk: the next step, if any, originally left vⱼ and now leaves the equal vertex vᵢ. The endpoints stay x,y, including the case where the repetition ends at the final vertex. Length strictly decreases. Repeating this finite operation ends with a path, or the length-zero path when x=y. Hence a walk exists exactly when a path exists. This does not say every walk is itself a path.

Define x~y when there is a walk from x to y in an undirected graph. Length-zero walks give reflexivity; reversing a walk gives symmetry; concatenating compatible walks gives transitivity. Therefore reachability is an equivalence relation. Its classes are the connected components. The graph is connected when V is nonempty and all vertices belong to one component. We make no connectedness claim for the empty graph; isolated single vertices are connected under this convention.

K has components {a,b,c,d,e} and {f}. To prove the first component, give routes within it and check that no edge leaves it. A few successful paths do not prove that no unlisted connection joins an outside vertex. For a complete edge specification, closure under neighbors supplies the negative certificate.

G4. Classify K's sequences a,b,c,a and a,c,a,b and a,c,d,e and f as walk/trail/path/cycle where applicable; give lengths. Explain why f is a valid length-zero path.

7. Breadth-first layers

Distance d(s,v) is the minimum edge length of an s-to-v path when one exists. Write “unreachable” rather than assigning a finite number if none exists. In an unweighted graph, breadth-first search explores increasing hop distance.

A layer formulation is enough for hand work:

  1. L₀={s}; mark s discovered, distance zero.
  2. Having layers through Lₖ, form Lₖ₊₁ from neighbors of Lₖ that are not in any earlier layer.
  3. For each newly discovered vertex choose one predecessor in Lₖ that is adjacent to it, and record distance k+1.
  4. Stop when the next layer is empty. Discovered vertices form s's component; undiscovered vertices are unreachable from s.

For K starting at a, the layers are L₀={a}, L₁={b,c}, L₂={d}, L₃={e}. f is not discovered. One predecessor record is b←a, c←a, d←c, e←d. Thus a,c,d,e is a shortest a-to-e path of length three, even though the earlier valid path through b had length four. A shortest path need not be unique, and the predecessor choice is not a claim of uniqueness.

An equivalent queue procedure marks a vertex when it is first discovered, not every time encountered. Remove the oldest waiting vertex, scan its neighbors, and append each still-undiscovered neighbor once. Fix alphabetical neighbor order if a reproducible predecessor trace is required. A neighbor encountered again keeps its first discovery distance. Forgetting the discovered set can repeatedly circulate around a cycle and never finish a naive route listing.

Diagram A, complete text equivalent: place a in layer zero; b and c in layer one; d in layer two; e in layer three. Keep f in a separate unreachable box. K's edge bc stays within layer one; the other edges connect consecutive layers. The boxes display distances from a, not all pairwise distances.

8. Why shortest-hop and unreachable claims are justified

Induct on k. A vertex in Lₖ has a walk of length k by following recorded predecessors, so its shortest distance is at most k. If it had a shorter path, the penultimate vertex on that shorter path would have been discovered at an earlier layer; scanning that layer would have discovered this vertex earlier too. That contradicts first discovery in Lₖ. More explicitly, induction gives that every vertex reachable in at most k steps appears among layers zero through k: the final step of any length-(k+1) path comes from a vertex already in those layers. This proves both that no reachable vertex is missed and that first-layer numbers are shortest distances.

The search terminates on a finite graph because each nonempty new layer discovers at least one previously undiscovered vertex. At termination, every neighbor of a discovered vertex is discovered. If an outside vertex were reachable, any path to it would have a first edge leaving the discovered set, contradicting that closure. This is the unreachable certificate. Predecessor paths certify positive reachability; absence of boundary edges certifies the negative claim.

A compact distance certificate can also be checked without trusting a search trace. Provide a level ℓ(v) for every vertex of a proposed component, with ℓ(s)=0 and a predecessor one level lower for every other vertex. Verify every edge within it has endpoint levels differing by at most one; also verify no edge leaves the set. A predecessor chain supplies a path of length ℓ(v). Any s-to-v walk changes level by at most one per step, so requires at least ℓ(v) steps. Closure excludes outside reachability. All parts matter: numbers alone are not a certificate.

G5. Run the layer search on K from d. Give distances, one predecessor for each discovered non-start vertex and the unreachable certificate.

G6. A purported distance certificate for K from a assigns levels a:0, b:1, c:2, d:3, e:4. Identify a violated condition. Give the corrected levels and explain why a valid nonshortest path is not a distance certificate.

Session E. Direction and weights change the question

9. Directed graphs

For a finite simple directed graph in this unit, an arc is an ordered pair of distinct vertices, with no repeated arc and no loops. Both x→y and y→x may occur, but they are different arcs. Outdegree counts arcs leaving a vertex; indegree counts arcs entering it. Counting arc tails and heads separately gives

sum outdegrees = |arcs| = sum indegrees.

There is no general rule that the number of vertices with odd outdegree is even. A single arc has one odd-outdegree vertex. Do not import the undirected parity theorem into this model.

A directed walk follows every arc's direction. Reachability remains reflexive and transitive but need not be symmetric. If p→q exists without a return route, q need not reach p. A directed graph is strongly connected when every vertex can reach every other, using the declared nonempty convention. Mutual reachability defines an equivalence relation: x and y each reach the other; concatenation proves transitivity. Its classes are strongly connected components.

For comparison, weak components are the components after forgetting arc direction. Weak connectedness can coexist with failure of strong connectedness. For arcs p→q,q→r,p→r, all three vertices lie in one weak component but each is a separate strong component. Breadth-first search using only outgoing neighbors finds directed shortest-hop distances from its start; scanning incoming neighbors would answer a different question.

10. Shortest in which sense?

An unweighted search minimizes edges, not supplied costs. Suppose an undirected graph has vertices s,u,t and edges st with weight ten, su with weight two, ut with weight two. A one-edge s-to-t path has fewer hops but greater total weight than the two-edge alternative, whose weight is four. Both are correctly described once the criterion is specified. This unit does not teach a weighted shortest-path algorithm. Negative weights, time-dependent closures and real navigation are outside its claims.

Independent practice

I1. Reconstruct a graph from adjacency lists p:q,r; q:p,r; r:p,q; s:none. Give V,E,degrees,components and matrix rows in order p,q,r,s. How would omitting s alter the connectedness answer?

I2. Give explicit edge sets on {1,2,3,4,5,6} for a six-cycle and two disjoint triangles. Verify identical degree lists but different component counts.

I3. On vertices {a,b,c,d,e}, edges are ab,bc,ca,ad,de,ea. Classify a,b,c,a,d,e,a and a,b,c and b,d. Explain each answer from the edge list and repetition conditions.

I4. On V={s,a,b,c,d,t,z}, E={sa,sb,ac,bc,cd,dt}, run BFS from s. Give layers, a predecessor trace with alphabetic tie choices, a shortest s-to-t path and a closed-set certificate for z's unreachability. How many shortest s-to-t paths exist?

I5. Prove that an undirected simple graph cannot have exactly one odd-degree vertex. Then explain why this does not prove that a degree list with an even number of odd entries is realizable.

I6. In a connected nonempty undirected graph, prove any two vertices have a path with at most |V|−1 edges. Do not assume a spanning-tree theorem that has not been taught.

I7. Directed arcs are p→q,q→p,q→r,r→s,s→r. Find weak and strong components, distances from p and distances from s, and check total indegree/outdegree. Give routes supporting each nontrivial strong class.

I8. Construct an unweighted distance certificate for the I4 graph with levels and predecessors. Then deliberately change one level to make an invalid certificate and name the exact failed check.

Homework and proof repair

H1. Prove that undirected reachability is an equivalence relation using the stated walk convention. Explain why a path-only proof of transitivity needs an extra simplification step.

H2. Audit: “The BFS predecessor list gives a route of length four, therefore four is shortest.” State what is missing and show how layer or level-edge checks close the gap. Use K's a-to-e alternatives.

H3. Explain why the discovered-set closure certificate needs the complete graph specification. A fictional list says only “at least edges ab and bc are present” on {a,b,c,d}. Which reachability claims follow and which do not? Give two compatible completions with different component counts.

Retrieval and changed-data quiz

Each item is worth four formative points; maximum 24. Attempt before reading keys. No pass mark, semester grade or automated progress is created.

Q1. A simple undirected graph on five vertices is proposed to have degrees 4,4,4,4,1. Is it possible? Give a decisive reason.

Q2. A graph has seven edges, three vertices of degree two, one vertex of degree four and two vertices of the same unknown degree d. Find d. Does this arithmetic alone prove a realization exists?

Q3. For V={a,b,c,d,e}, E={ab,ac,bd,cd}, give BFS layers from a, unreachable vertices and the number of shortest a-to-d paths.

Q4. In Q3, classify a,b,d,c,a and a,b,a and e by the unit's route conventions, including lengths.

Q5. Directed arcs a→b,b→c,c→a,c→d are supplied. Give strong components and decide whether the graph is weakly and strongly connected.

Q6. A shortest-hop result chooses an edge of weight nine rather than a two-edge route with weights two and three. State precisely what the result optimizes and why it does not establish the cheapest route.

Project P1. Audit a fictional connection packet

The undirected simple packet has vertices A,B,C,D,E,F,G,H and edges AB,AC,BC,BD,CE,DE,DF,EF,GH. This is complete. Labels are abstract stations, not real transport advice.

(a) Supply an adjacency list, degrees, edge count and handshake/parity checks. Identify connected components using explicit reachability and boundary evidence, not only degree totals.

(b) Run BFS from A with alphabetic neighbor order. Give layers, predecessors, a shortest A-to-F path and all shortest A-to-F paths. Explain why G,H are unreachable. Supply a distance certificate with the edge-level check.

(c) Add FG only. Recompute degrees affected, components, distances from A and a shortest A-to-H path. Identify the logical reason connectedness changes. Do not infer travel time or physical suitability.

(d) Return to the ORIGINAL edge set and replace each edge with the following one-way arc: A→B,A→C,B→C,B→D,C→E,D→E,D→F,E→F,G→H. Calculate indegrees/outdegrees and their totals; find weak and strong components; compare reachability from A and F. Now add F→B to this directed model only. Recompute the strong classes with witness routes and a reason no outside vertex joins them.

(e) Audit three claims: “No isolated vertices means connected”; “The predecessor route is the only shortest route”; “Weak connectivity proves a one-way return journey.” Supply a packet-based witness or a carefully labelled counterexample for each, followed by a corrected statement.

(f) Keep a revision ledger showing a genuine repair or justified retention, the exact evidence used, and one changed example. Explain which model you used in each part so original, added-edge and directed conclusions are not mixed.

Formative project rubric, maximum 36: graph/degrees/components 6; BFS and certificate 8; added edge 5; directed models 9; audit/revision/scope 8. The keys provide anchors. Missing direction or an invalid edge cannot be compensated by fluent prose. All data are supplied; no participant contact or real network survey is assigned.

Delayed transfer D1

D1. After a break, consider a directed approval packet with vertices Draft,Check,Revise,Release,Archive and arcs Draft→Check, Check→Revise, Revise→Check, Check→Release. Archive is isolated. Find strong/weak components, shortest-hop distances from Draft and a route to Release. If Release→Archive is added, say exactly which component and reachability answers change. Explain why a mathematically available route does not establish that an actual document has been approved or that its content is correct.

Exit, next teaching and references

Create one pair of graphs that agree on a simple count but differ on the question you care about. State both specifications and justify the difference. Reattempt a failed search on changed data before claiming independent mastery. Continue with Unit 6, trees and spanning constructions. All eight planned units have manuscripts, but no semester-completion percentage is inferred.

Optional references checked 4 November 2026: Oscar Levin, Discrete Mathematics: An Open Introduction, fourth edition, Problems and Definitions, for simple graphs and degree counting; Joy Morris, Combinatorics, Paths and cycles, for no-repeated-vertex paths and walk simplification; Cornell CS2110, Graph Traversals, for FIFO search and unweighted distance; and Hawaiʻi ICS311, Notes on graphs, for directed connectivity and search. Terminology varies: this unit uses Morris-compatible paths with no repeated vertices, and separately defines cycles; do not silently import Levin’s allowance for matching path endpoints. Broader algorithms in the linked sources are optional, not undeclared assessed prerequisites. All examples, packets, diagrams, tasks and keys here are original. Links and conventional mathematical definitions do not constitute institutional endorsement. No protected exercise bank or source media is reproduced. The retained profile's whole-course sourceGap=true remains unchanged.