Home > matgraph > @graph > complement.m

complement

PURPOSE ^

graph complement

SYNOPSIS ^

function complement(g,h)

DESCRIPTION ^

 graph complement
 complement(g) --- overwrite a graph with its own complement
 complement(g,h) --- overwrite g with the complement of h

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function complement(g,h)
0002 % graph complement
0003 % complement(g) --- overwrite a graph with its own complement
0004 % complement(g,h) --- overwrite g with the complement of h
0005 
0006 if nargin>1
0007     copy(g,h)
0008 end
0009 
0010 % complement only makes sense for full storage
0011 if (issparse(g))
0012     full(g);
0013 end
0014 
0015 n = nv(g);
0016 i = g.idx;
0017 
0018 fast_set_matrix(g, ones(n) - eye(n) - matrix(g))

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