get_label(g) or get_label(g,v) --- get vertex label(s)
SYNOPSIS
function out = get_label(g,v)
DESCRIPTION
get_label(g) or get_label(g,v) --- get vertex label(s)
get_label(g) returns a cell array of the labels of the vertices
get_label(g,v) returns v's label
CROSS-REFERENCE INFORMATION
This function calls:
is_labeled is_labeled(g) --- determine if there are labels on vertices.
This function is called by:
cartesian cartesian(g,h1,h2) --- overwrite g with the product of h1 and h2
copy_labels copy_labels(g,h) --- copy labels from h to g
dot dot(g,filename) --- save graph for use by graphviz.
draw_labels draw_labels(g) --- add labels to a drawing of g
0001 function out = get_label(g,v)
0002 % get_label(g) or get_label(g,v) --- get vertex label(s)
0003 % get_label(g) returns a cell array of the labels of the vertices
0004 % get_label(g,v) returns v's label
0005
0006 global GRAPH_MAGIC;
0007
0008 if ~is_labeled(g)
0009 disp('graph is not labeled');
0010 out = {};
0011 if nargin==2
0012 out='';
0013 end
0014 return
0015 end
0016
0017 if nargin==2
0018 out = GRAPH_MAGIC.graphs{g.idx}.labels{v};
0019 return
0020 end
0021
0022 out = GRAPH_MAGIC.graphs{g.idx}.labels;