Home > matgraph > @graph > laplacian.m

laplacian

PURPOSE ^

laplacian(g) --- get the Laplacian matrix of g

SYNOPSIS ^

function m = laplacian(g)

DESCRIPTION ^

 laplacian(g) --- get the Laplacian matrix of g
 equal to D-A where A is the adjacency matrix and D is a diagonal matrix
 of the degrees of the vertices.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function m = laplacian(g)
0002 % laplacian(g) --- get the Laplacian matrix of g
0003 % equal to D-A where A is the adjacency matrix and D is a diagonal matrix
0004 % of the degrees of the vertices.
0005 
0006 
0007 n = nv(g);
0008 d = deg(g);
0009 m = -matrix(g);
0010 for k=1:n
0011     m(k,k) = d(k);
0012 end

Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003