WOLFRAM LANGUAGE FEATURED EXAMPLE

Topological Ordering of Connected Components

Find a topological ordering of connected graph components.

    
In[1]:=
Click for copyable input
Reordering vertices by connected components:
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
In[5]:=
Click for copyable input
View the graphs and compare adjacency matrices before and after the reordering of vertices:
In[6]:=
Click for copyable input
Out[6]=