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.
AdjacencyList[{vw,…},…]
uses rules vw to specify the graph g.
Details
- AdjacencyList is typically used to represent the neighbors of each vertex.
- AdjacencyList returns the list of vertices in the order used by the graph g.
- AdjacencyList[g,v] is equivalent to AdjacencyList[g,v,1].
- AdjacencyList[g] gives the list of adjacent vertices to each vertex of g.
- AdjacencyList[g,All] is effectively equivalent to AdjacencyList[g].
Examples
open allclose allBasic Examples (3)
Scope (6)
AdjacencyList works with undirected graphs:
Use rules to specify the graph:
Use patterns to select a subset of vertices:
Find vertices at a distance 2 from vertex 1:
AdjacencyList works with large graphs:
Applications (1)
Properties & Relations (2)
Text
Wolfram Research (2012), AdjacencyList, Wolfram Language function, https://reference.wolfram.com/language/ref/AdjacencyList.html (updated 2018).
CMS
Wolfram Language. 2012. "AdjacencyList." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/AdjacencyList.html.
APA
Wolfram Language. (2012). AdjacencyList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AdjacencyList.html