Code covered by the BSD License  

Highlights from
Matgraph

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

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

match_join

PURPOSE ^

match_join(g,h1,h2) --- overwrite g with a graph formed from disjoint

SYNOPSIS ^

function match_join(g,h1,h2)

DESCRIPTION ^

 match_join(g,h1,h2) --- overwrite g with a graph formed from disjoint
 graphs g1,g2 with a matching added between them. The graphs h1 and h2
 must have the same number of vertices.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • matrix matrix(g) --- return (a copy of) the adjacency matrix of g
  • nv nv(g) --- number of vertices in g
  • set_matrix set_matrix(g,A) --- set g to be the graph specificed in the matrix A.
This function is called by:

SOURCE CODE ^

0001 function match_join(g,h1,h2)
0002 % match_join(g,h1,h2) --- overwrite g with a graph formed from disjoint
0003 % graphs g1,g2 with a matching added between them. The graphs h1 and h2
0004 % must have the same number of vertices.
0005 
0006 if (nv(h1) ~= nv(h2))
0007     error('In match_join(g,h1,h2) graphs h1 and h2 must have the same number of vertices');
0008 end
0009 
0010 A = matrix(h1);
0011 B = matrix(h2);
0012 n = nv(h1);
0013 
0014 set_matrix(g, [A, eye(n); eye(n), B]);

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

Contact us at files@mathworks.com