Code covered by the BSD License  

Highlights from
Matgraph

from Matgraph by Ed Scheinerman
Toolbox for working with simple, undirected graphs

Description of check
Home > matgraph > @partition > check.m

check

PURPOSE ^

check(p) --- check that the datastructure holding p is a valid partition

SYNOPSIS ^

function yn = check(p)

DESCRIPTION ^

 check(p) --- check that the datastructure holding p is a valid partition

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:
  • partition partition --- constructor for the partition class

SOURCE CODE ^

0001 function yn = check(p)
0002 % check(p) --- check that the datastructure holding p is a valid partition
0003 
0004 s = full(sum(p.array,1));  % col sums should all be 1
0005 t = full(sum(p.array,2));  % row sums should all be positive
0006 yn = all(s == 1)  & all(t>0);

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

Contact us at files@mathworks.com