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]=
Introduced in 2012
(9.0)