AdjacencyList

AdjacencyList[g, v]
gives a list of vertices adjacent to vertex v.

AdjacencyList[g, patt]
gives a list of vertices adjacent to vertices that match the pattern patt.

AdjacencyList[g, patt, d]
gives a list of vertices that are at distance at most d.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

A list of vertices adjacent to the vertex 1:

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

Find all vertices adjacent to vertices that match a pattern:

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

Highlight adjacent vertices:

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