next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Graphs :: laplacianMatrix

laplacianMatrix -- Returns the laplacian matrix of a graph

Synopsis

Description

The laplacian matrix of a graph is the adjacency matrix of the graph subtracted from the degree matrix of the graph.

i1 : G = graph({1,2,3,4,5},{{1,2},{2,3},{3,4},{3,5},{4,5}});
i2 : laplacianMatrix G

o2 = | 1  -1 0  0  0  |
     | -1 2  -1 0  0  |
     | 0  -1 3  -1 -1 |
     | 0  0  -1 2  -1 |
     | 0  0  -1 -1 2  |

              5        5
o2 : Matrix ZZ  <--- ZZ

See also

Ways to use laplacianMatrix :

For the programmer

The object laplacianMatrix is a method function.