Another common graph algorithm it testing for connectivity
The graph is connected if and only if for each vertex v in a graph containing n vertices, the size of the result of a breadth-first traversal starting a v is n
27.
FIGURE 18.8 Connectivity in an undirected graph
28.
TABLE 18.1 Breadth-first traversals for a connected undirected graph
29.
TABLE 18.2 Breadth-first traversals for an unconnected undirected graph
A minimum spanning tree is a spanning tree where the sum of the weights of the edges is less than or equal to the sum of the weights for any other spanning tree for the same graph
The algorithm for creating a minimum spanning tree makes use of a minheap to order the edges
There are two principle approaches to implementing graphs
Adjacency lists
Adjacency matrices
The adjacency list approach is modeled closely to the way we implemented linked implementations of trees
However, instead of building a graph node that contains a fixed number of references (as we did with BinaryTreeNode) we will build a graph node that simply maintain a linked lists of references to other nodes