VertexComponent

VertexComponent[g, {v1, v2, ...}]
gives the vertices in the graph g that have a path to at least one of , , ....

VertexComponent[g, {v1, v2, ...}, k]
gives the vertices with a path to at least one of , , ... of at most length k.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Find the component containing vertex 7:

In[1]:=
Click for copyable input
Out[1]=

Find the vertices connected to any of :

In[1]:=
Click for copyable input
Out[1]=
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »