Graph search (traversal)
Problem: Given a directed graph and a starting node u, follow arcs of the
graph to visit each node exactly once
(Note: if we allowed nodes to be
revisited, search procedure may not terminate)
The set of arcs that are
followed has no cycle (since nodes never revisited) -- so it forms a search
tree
To avoid cycles, we can mark nodes as we visit them and never
revisit marked nodes
Which arcs to visit, and in what order?
DFS(G,v):
DFSForest(G):
Proof : see page 333-334 of the text.
A tree T is a spanning tree of a graph G if T is a subgraph of G that contains all of the vertices of G.
Let G be a weighted graph. A minimal spanning tree of G is a spanning tree of G with minimum weight.
There are two well-known algorithms to find a minimal spanning tree:
Reference
A binary tree is a rooted tree in which each vertex has either no children, one child or two children. A vertex , with the excetion of being the root, is either left child or right child of its parent.