gives the vertex-vertex adjacency matrix of the graph g.


  • AdjacencyMatrix returns a SparseArray object, which can be converted to an ordinary matrix using Normal.
  • An entry of the adjacency matrix is the number of directed edges from vertex to vertex .
  • The diagonal entries count the number of loops for vertex .
  • An undirected edge is interpreted as two directed edges with opposite directions.
  • The vertices are assumed to be in the order given by VertexList[g].
  • The adjacency matrix for a graph will have dimensions ×, where is the number of vertices.
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »