Code covered by the BSD License  

Highlights from
Matgraph

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

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

copy_labels

PURPOSE ^

copy_labels(g,h) --- copy labels from h to g

SYNOPSIS ^

function copy_labels(g,h)

DESCRIPTION ^

 copy_labels(g,h) --- copy labels from h to g

CROSS-REFERENCE INFORMATION ^

This function calls:
  • get_label get_label(g) or get_label(g,v) --- get vertex label(s)
  • is_labeled is_labeled(g) --- determine if there are labels on vertices.
  • label Assign labels to vertices of g
  • nv nv(g) --- number of vertices in g
This function is called by:
  • bfstree bfstree(t,g,v) --- create a breadth-first spanning tree of g
  • dfstree dfstree(t,g,v) --- create a depth-first spanning tree of g

SOURCE CODE ^

0001 function copy_labels(g,h)
0002 % copy_labels(g,h) --- copy labels from h to g
0003 
0004 if ~is_labeled(h)
0005     error('Source graph (2nd argument) must be labeled')
0006 end
0007 
0008 ng = nv(g);
0009 nh = nv(h);
0010 
0011 label(g);
0012 for v=1:min(ng,nh)
0013     label(g,v,get_label(h,v));
0014 end

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

Contact us at files@mathworks.com