Code covered by the BSD License  

Highlights from
Matgraph

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

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

copy

PURPOSE ^

copy(g,h) --- overwrite g with a copy of h

SYNOPSIS ^

function copy(g,h)

DESCRIPTION ^

 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.

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:
  • bridges bridges(g,algo) --- find all cut edges in g
  • complement graph complement
  • cube cube(g,k) --- create a k-cube (default k = 3)
  • dfstree dfstree(t,g,v) --- create a depth-first spanning tree of g
  • euler_trail euler_trail(g) --- find an euler trail in g (if one exists)
  • hamiltonian_cycle hamiltonian_cycle(g) --- find a Hamiltonian cycle in g (if one exists)
  • intersect intersect(g,h1,h2) --- g is set to the intersection of h1 and h2.
  • iso [yn,p] = iso(g,h,options) --- is g isomorphic to h?
  • omega [w,S] = omega(g) --- clique number
  • prufer prufer --- convert a tree to/from its Prufer code
  • random_regular random_regular(g,n,k) --- create a random regular graph
  • union union(g,h1,h2) --- set g equal to the union of h1 and h2.

SOURCE CODE ^

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

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

Contact us at files@mathworks.com