11.1. igraph_laplacian — Returns the Laplacian matrix of a graph

int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res,
		     igraph_bool_t normalized);

The graph Laplacian matrix is similar to an adjacency matrix but contains -1's instead of 1's and the vertex degrees are included in the diagonal. So the result for edge i--j is -1 if i!=j and is equal to the degree of vertex i if i==j. igraph_laplacian will work on a directed graph (although this does not seem to make much sense) and ignores loops.

The normalized version of the Laplacian matrix has 1 in the diagonal and -1/sqrt(d[i]d[j]) if there is an edge from i to j.

The first version of this function was written by Vincent Matossian.

Arguments: 

graph:

Pointer to the graph to convert.

res:

Pointer to an initialized matrix object, it will be resized if needed.

normalized:

Whether to create a normalized Laplacian matrix.

Returns: 

Error code.

Time complexity: O(|V||V|), |V| is the number of vertices in the graph.