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
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]);