In the appendix: The CBS Theorem.
Recap of last time
- a graph is a pair $G=(V,E)$ of a set of nodes $V$ and a set of edges $E$.
- nodes can be anything
- edges are unordered pairs of nodes.
- a digraph is a pair $G=(V,E)$ of a set of nodes $V$ and a set of directed edges $E$
- each edge is an ordered pair $(u,v)$ indicating an edge from $u$ to $v$.
- two nodes are adjacent in an undirected graph if there is an edge between them
- mathematically, $\{ u, v\} \in E$
Walks, Paths, Reachability
A walk in a graph is a sequence of one or more nodes $v_1, v_2, \dots, v_n$ such that any two consecutive nodes in the sequence are adjacent.
- the length of the walk $v_1,v_2, \dots, v_n$ is $n-1$ (number of edges)
A closed walk in a graph is a walk from a node back to itself. (By convention, a closed walk cannot have length zero, i.e. a walk with just one node).
A path in a graph is a walk that does not repeat any nodes. (This also implies a path never repeats an edge).
A cycle in a graph is a closed walk that does not repeat any nodes or edges except the first/last node.
- “closed walk” prevents a single node from being a cycle. (however, in a digraph, a self-directed edge makes a cycle of length 1!!)
- “does not repeat edges” prevents the A → B → A case from being a cycle. (however, in a digraph, A → B → A does count, because such a closed walk does not repeat edges!)
Reachability
A node $v$ is reachable from a node $u$ if there exists a path from $u$ to $v$.
- intuitively, you can reach $v$ from $u$ in zero or more steps
- note that exists a path and exists a walk would be equivalent
a graph $G$ is called connected if all pairs of distinct nodes in $G$ are reachable.
a connected component (or CC) of $G$ is a maximal set of mutually reachable nodes.