Graph Connectivity
Path
A path is a sequences of vertices such that:
- No vertex appears more than once.
- is adjacent to . for each .
- The length of the path is which is the number of edges.
Example
- is a path of length 3.
- is a path of length 1.
- is a path of length 2.
Cycle
A cycle is just like a path, but , so that it loops back on itself.
- The length of a cycle is , which is the number of edges, and also the number of vertices.
- We don't care about the starting vertex of a cycle. So is the same cycle as .
- We might not use the above notation (duplicate the start/end vertex) to represent a cycle. Instead we will use "cycle ". Note: this is different from path, path can be represented by "path ".
Example
- is a cycle of length 3.
Connectedness
If there is a path from to for every , then we say that is connected. Otherwise, we say is disconnected.
Example
The graph is connected.
Connected Component
If for every there is a path between and , and there are no paths to any vertices outside .
Then we call is a connected component of .
Example
The graph is disconnected.
The connected components are and
Distance
The distance between vertices and is the length of a shortest path from to .
Calculating Distances
Given a fixed vertex , we define:
- to be the set of vertices that is distance from . (explored)
- to contain the set of vertices that has distance at least from . (unexplored)