Code covered by the BSD License
induce --- create induced subgraphs induce(g,vset) --- g overwritten with induced subgraph on vset induce(g,h,vset) --- g overwritten with induced subgraph of h on vertex set vset
0001 function induce(g,arg1,arg2) 0002 % induce --- create induced subgraphs 0003 % induce(g,vset) --- g overwritten with induced subgraph on vset 0004 % induce(g,h,vset) --- g overwritten with induced subgraph of h on vertex 0005 % set vset 0006 0007 0008 global GRAPH_MAGIC 0009 0010 if nargin == 2 0011 vset = arg1; 0012 if hasxy(g) 0013 GRAPH_MAGIC.graphs{g.idx}.xy = ... 0014 GRAPH_MAGIC.graphs{g.idx}.xy(vset,:); 0015 end 0016 if is_labeled(g) 0017 GRAPH_MAGIC.graphs{g.idx}.labels = ... 0018 GRAPH_MAGIC.graphs{g.idx}.labels(vset); 0019 end 0020 GRAPH_MAGIC.graphs{g.idx}.array = ... 0021 GRAPH_MAGIC.graphs{g.idx}.array(vset,vset); 0022 return 0023 end 0024 0025 h = arg1; 0026 vset = arg2; 0027 0028 GRAPH_MAGIC.graphs{g.idx}.array = ... 0029 GRAPH_MAGIC.graphs{h.idx}.array(vset,vset); 0030 0031 if (hasxy(h)) 0032 xy = getxy(h); 0033 xy = xy(vset,:); 0034 embed(g,xy); 0035 end 0036 0037 if is_labeled(g) 0038 label(h); 0039 GRAPH_MAGIC.graphs{g.idx}.labels = ... 0040 GRAPH_MAGIC.graphs{h.idx}.labels(vset); 0041 end
Contact us at files@mathworks.com