TOPICS
Search

Adjacency List


The adjacency list representation of a graph consists of n lists one for each vertex v_i, 1<=i<=n, which gives the vertices to which v_i is adjacent. The adjacency lists of a graph g may be computed in the Wolfram Language using

  AdjacencyList[g, #]& /@ VertexList[g]

and a graph may be constructed from adjacency lists l using

  Graph[UndirectedEdge @@@ Union[
      Sort /@ Flatten[
      MapIndexed[{#, #2[[1]]}&, l, {2}],
    1]]]

See also

Adjacency Matrix

Explore with Wolfram|Alpha

References

Skiena, S. "Adjacency Lists." §3.1.2 in Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, pp. 86-87, 1990.

Referenced on Wolfram|Alpha

Adjacency List

Cite this as:

Weisstein, Eric W. "Adjacency List." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/AdjacencyList.html

Subject classifications