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 |
The object laplacianMatrix is a method function.