Macaulay2 » Documentation
Packages » Graphs :: laplacianMatrix
next | previous | forward | backward | up | index | toc

# laplacianMatrix -- Returns the laplacian matrix of a graph

- Usage:
    `L = laplacianMatrix G`
- Inputs:
  - G, a graph,
- Outputs:
  - L, a matrix, the laplacian matrix of graph G

## 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

- adjacencyMatrix -- Returns the adjacency matrix of a Graph or Digraph
- degreeMatrix -- Returns the degree matrix of a graph

## Ways to use laplacianMatrix:

- `laplacianMatrix(Graph)`

## For the programmer

The object laplacianMatrix is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:2075:0.