copy(g,h) --- overwrite g with a copy of h This is different from writing g = h which makes g another view of the same graph h (so changes to h affect g). Rather, copy(g,h) makes g an identical, but independent copy of h. Note that g = graph(h) has a similar effect, but grabs a new slot in GRAPH_MAGIC. The syntax copy(g,h) is preferred when g is already a handle to a graph object.
0001 function copy(g,h) 0002 % copy(g,h) --- overwrite g with a copy of h 0003 % 0004 % This is different from writing g = h which makes g another view of the 0005 % same graph h (so changes to h affect g). Rather, copy(g,h) makes g an 0006 % identical, but independent copy of h. 0007 % 0008 % Note that g = graph(h) has a similar effect, but grabs a new slot in 0009 % GRAPH_MAGIC. The syntax copy(g,h) is preferred when g is already a handle 0010 % to a graph object. 0011 0012 global GRAPH_MAGIC 0013 0014 GRAPH_MAGIC.graphs{g.idx} = GRAPH_MAGIC.graphs{h.idx}; 0015 0016