Download - All IT eBooks

Transcript
GRAPH TRAVERSAL
75
(a)
(b)
FIGURE 4.33
of G.
(c)
(a) A graph G; (b) some spanning trees of G; (c) some more spanning trees
We can also observe that d(T1 , T2 ) satisfies the following properties for a metric:
1. d(J,T 2 ) > Q and d(Tx ,T 2 ) = 0 if and only if T = T 2 .
2. d(Tu T 2 ) = d(T 2 ,T 0 ).
3. d(Tu T 2 ) < d(T,T 3 ) + d(T 3 + T 2 ) for any spanning tree T 3 other than Tx or T 2 .
Also, d(T, T2 ) cannot exceed the rank or nullity of the graph. Let G be a connected
graph and T be the collection of all the spanning trees of G. A graph can be formulate
dusing J as a vertex set. Let the graph be denoted by G T = (T, E T ), where two
vertices T1 and T2 are joined by an edge and only if d(T1 , T2 ) = 11. The graph GT is
called the tree graph of G.
4.9
GRAPH TRAVERSAL
In order to visit all the vertices of a graph, there must be some systematic way
to ensure that no vertex is left unvisited. There are two methods for traversing the
vertices: (1) Breadth-First Search (BFS) and (2) Depth-First Search (DFS).
Let v be the starting vertex for traversing the graph G. The BFS starts by visiting
the vertex v. After visiting v, all its adjacent vertices are visited in some defined order.
Let the adjacent vertices of v, be v, v2 , . . . , vd . After visiting these vertices, we must