Earlier in this chapter, in the Adjacency matrix section, we learned about the adjacency matrix and how we can use it to tell what the structure of a graph is. However, there are other ways of representing graphs in matrix form.
Now, let's suppose we have an undirected, unweighted graph. Then, its Laplacian matrix will be a symmetric n × n matrix, L, whose elements are as follows:
![](https://static.packt-cdn.com/products/9781838647292/graphics/assets/1bba5a9d-78d4-4bc0-b5d1-2c2f82f38562.png)
Here, . We can also write this as follows:
![](https://static.packt-cdn.com/products/9781838647292/graphics/assets/26bb8b67-a30f-437b-b0a0-466e0683d8b3.png)
Here, Ai,j is the adjacency matrix and δi,j is the Kronecker delta. We can rewrite this in matrix form, as follows:
![](https://static.packt-cdn.com/products/9781838647292/graphics/assets/31f0927b-ec76-4376-a0e2-55f912a9033e.png)
Here, we have the following:
![](https://static.packt-cdn.com/products/9781838647292/graphics/assets/12698959-6e57-4a51-8eb9-245fedbc3c7d.png)
Similarly, we can also write the graph Laplacian matrix for a weighted graph by replacing the adjacency matrix here with the one we defined previously for weighted graphs.