New in Wolfram
Mathematica
8: Graph & Network Analysis
◄
previous
|
next
►
Application Areas
Highlight BFS and DFS trees
Highlighting graph elements on a BFS or DFS tree.
In[1]:=
X
g = PetersenGraph[6, 5];
In[2]:=
X
Row[{HighlightGraph[ g, {TreeGraph[VertexList[g], BreadthFirstScan[g, 1]]}, VertexSize -> {1 -> 0.2}], Spacer[20], HighlightGraph[g, TreeGraph[VertexList[g], DepthFirstScan[g, 1]], VertexSize -> {1 -> 0.2}]}]
Out[2]=