algorithm - Spanning Tree VS. Spanning Forest -
what's difference between spanning tree , spanning forest in graphs, conceptually.
also, possible construct spanning forest through dfs or bfs traversals? why? how?
i understand spanning tree, couldn't find clear explanations spanning forests. wikipedia (https://en.wikipedia.org/wiki/spanning_tree), doesn't give clear definition it. book (data structures & algorithms, wiley - sixth edition) has no definition spanning forests.
i wondering, if have graph example 3 connected components in it, possible construct spanning forest dfs/bfs traversals?
when there one connected component in graph, spanning tree = spanning forest.
but when there multiple connected components in graph. example in following picture have 3 connected components.:
so each component, have spanning tree, , 3 spanning trees constitute spanning forest
i wondering, if have graph example 3 connected components in it, possible construct spanning forest dfs/bfs traversals?
yes possible. when there 1 connected component, bfs or dfs terminate visiting vertices , have spanning tree (which in case equal spanning forest). 
but when have more 1 connected component, in picture, thing have start bfs or dfs unvisited vertex. algorithm terminates when there no unvisited vertex left , each bfs or dfs traversal yield spanning tree.

Comments
Post a Comment