Code covered by the BSD License  

Highlights from
Matgraph

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

Description of join
Home > matgraph > @graph > join.m

join

PURPOSE ^

join(g,h1,h2) --- overwrite g with the join of h1 and h2

SYNOPSIS ^

function join(g,h1,h2)

DESCRIPTION ^

 join(g,h1,h2) --- overwrite g with the join of h1 and h2

CROSS-REFERENCE INFORMATION ^

This function calls:
  • embed embed --- create an embedding for a graph
  • getxy getxy(g) --- give g's embedding (or [] if g doesn't have one)
  • hasxy hasxy(g) --- determine if an embedding has been created for g
  • nv nv(g) --- number of vertices in g
  • rmxy rmxy(g) --- erase g's embedding
This function is called by:

SOURCE CODE ^

0001 function join(g,h1,h2)
0002 % join(g,h1,h2) --- overwrite g with the join of h1 and h2
0003 
0004 global GRAPH_MAGIC
0005 
0006 n1 = nv(h1);
0007 n2 = nv(h2);
0008 
0009 z = logical(ones(n1,n2));
0010 
0011 rmxy(g);
0012 
0013 
0014 GRAPH_MAGIC.graphs{g.idx}.array = ...
0015     [GRAPH_MAGIC.graphs{h1.idx}.array, z; ...
0016      z', GRAPH_MAGIC.graphs{h2.idx}.array
0017     ];
0018 
0019 
0020 if (hasxy(h1) & hasxy(h2))
0021     xy = [getxy(h1);getxy(h2)];
0022     embed(g,xy);
0023 end

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

Contact us at files@mathworks.com