next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Graphs :: adjacencyMatrix

adjacencyMatrix -- Computes the adjacency matrix of a graph or digraph

Synopsis

Description

The (i,j)-entry of the adjacency matrix is 1 if there exists an arc or edge connected the ith vertex to the jth vertex and 0 otherwise.
i1 : adjacencyMatrix completeGraph 5

o1 = | 0 1 1 1 1 |
     | 1 0 1 1 1 |
     | 1 1 0 1 1 |
     | 1 1 1 0 1 |
     | 1 1 1 1 0 |

              5        5
o1 : Matrix ZZ  <--- ZZ

Ways to use adjacencyMatrix :