({{, (RefLink[AdjacencyList, paclet:ref/AdjacencyList])[g,v]
gives a list of vertices adjacent to vertex v.}, {, (RefLink[AdjacencyList, paclet:ref/AdjacencyList])[g,patt]
gives a list of vertices adjacent to vertices that match the pattern patt.}, {, (RefLink[AdjacencyList, paclet:ref/AdjacencyList])[g,patt,d]
gives a list of vertices that are at distance at most d.}, {, (RefLink[AdjacencyList, paclet:ref/AdjacencyList])[{v->w,…},…]
uses rules v->w to specify the graph g. }})

OpenersNotesSection(Spacer1)Details

(RefLink[AdjacencyList, paclet:ref/AdjacencyList]) returns the list of vertices in the order used by the graph g.

(RefLink[AdjacencyList, paclet:ref/AdjacencyList])[g,v] is equivalent to (RefLink[AdjacencyList, paclet:ref/AdjacencyList])[g,v,1].

OpenersPrimaryExamplesSection(Spacer1)Examples  (12)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

A list of vertices adjacent to the vertex 1:

AdjacencyList[, 1]

Find all vertices adjacent to vertices that match a pattern:

AdjacencyList[, _?(#<3&)]

Highlight adjacent vertices:

g=GridGraph[{11,11},VertexSize->0.6,VertexStyle->{61->Blue}];

Table[HighlightGraph[g,AdjacencyList[g,61,i]], {i,3}]

OpenersExampleSection1(Spacer1)Scope  (6)

(RefLink[AdjacencyList, paclet:ref/AdjacencyList]) works with undirected graphs:

AdjacencyList[,1]

Directed graphs:

AdjacencyList[,1]

Use rules to specify the graph:

AdjacencyList[{1->3,2->1,3->6,4->6,1->5,5->4,6->1},1]

Use patterns to select a subset of vertices:

AdjacencyList[, _Integer]

Find vertices at a distance 2 from vertex 1:

AdjacencyList[,1,2]

(RefLink[AdjacencyList, paclet:ref/AdjacencyList]) works with large graphs:

g=GridGraph[{10,10,10,10}];

AdjacencyList[g,100]//Timing

OpenersExampleSection3(Spacer1)Applications  (1)

A family network consisting of the closest relatives, including parents, siblings, and children:

g=ExampleData[{"NetworkGraph","FamilyGathering"}]

Immediate family members of Nancy:

AdjacencyList[g,"Nancy"]

Highlight:

HighlightGraph[g,%]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

(RefLink[AdjacencyList, paclet:ref/AdjacencyList]) can be found using (RefLink[NeighborhoodGraph, paclet:ref/NeighborhoodGraph]):

g=;

AdjacencyList[g,1]

VertexList[NeighborhoodGraph[g,1],Except[1]]

(RefLink[AdjacencyList, paclet:ref/AdjacencyList]) can be found using (RefLink[IncidenceList, paclet:ref/IncidenceList]):

g=;

AdjacencyList[g,2]

DeleteCases[Flatten[List@@@IncidenceList[g,2]],2]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[AdjacencyMatrix, paclet:ref/AdjacencyMatrix])  ▪  (RefLink[VertexOutComponent, paclet:ref/VertexOutComponent])  ▪  (RefLink[VertexInComponent, paclet:ref/VertexInComponent])  ▪  (RefLink[VertexComponent, paclet:ref/VertexComponent])  ▪  (RefLink[IncidenceList, paclet:ref/IncidenceList])  ▪  (RefLink[IncidenceMatrix, paclet:ref/IncidenceMatrix])  ▪  (RefLink[NeighborhoodGraph, paclet:ref/NeighborhoodGraph])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Graph Construction & Representation, paclet:guide/GraphConstructionAndRepresentation])}})}})