Home > matgraph > @graph > nsptrees.m

nsptrees

PURPOSE ^

nsptrees(g) --- number of spanning trees of g.

SYNOPSIS ^

function nt = nsptrees(g)

DESCRIPTION ^

 nsptrees(g) --- number of spanning trees of g.
 This computes the number of spanning trees of g using the matrix-tree
 theorem.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nt = nsptrees(g)
0002 % nsptrees(g) --- number of spanning trees of g.
0003 % This computes the number of spanning trees of g using the matrix-tree
0004 % theorem.
0005 
0006 A = diag(deg(g)) - matrix(g);
0007 n = nv(g)-1;
0008 nt = det(A(1:n,1:n));

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