Name

graph_union — union of two graphs

Calling Sequence

g2 = graph_union(g,g1 [,opt])

Parameters

g

a graph_data_structure.

g1

a graph data structure.

opt

a boolean, with %t as default value.

g2

graph data structure of the new graph

Description

  • graph_union(g,g1) creates a new graph g2. The node set of g2 is the union (in the usual sense) of the node sets of g and g1. If node names are given in both graph, nodes with equal names in g1 and g2 are considered as common nodes.

    g2 has an edge for each edge of g and an edge for each edge of g1. The edges of g and g1 having the same endpoints are kept and in this case g2 has multiple edges.

  • graph_union(g,g1,%f) creates a new graph g2. The node set of g2 is the union (in the usual sense) of the node sets of tg and g1. In this case the function does not looks for common nodes.

    g2 has an edge for each edge of g and an edge for each edge of g1. The edges of g and g1 having the same endpoints are kept and in this case g2 has multiple edges.

Examples


ta1=[1,2,3,4,4,4,4,5,6,7,7];he1=[2,3,1,1,5,7,7,6,7,3,4];
g1=make_graph('foo1',1,7,ta1,he1);
g1.nodes.graphics.x= [273,271,339,384,504,513,439];
g1.nodes.graphics.y= [221,324,432,141,209,319,428];
g1.nodes.graphics.display= 'name';
g1.nodes.graphics.name= ['A' 'B' 'C' 'D' 'E' 'F' 'G'];
w1=show_graph(g1);

ta2=[1,1,2,2,3,5,6,6,7,8];he2=[2,8,3,5,4,6,4,7,5,5];
g2=make_graph('foo2',1,8,ta2,he2);
g2.nodes.graphics.x= [233,113,114,114,223,221,289,334];
g2.nodes.graphics.y= [59, 133,227,319,221,324,432,141];
g2.nodes.graphics.name= ['H' 'I' 'J' 'K' 'A' 'B' 'C' 'D'];
g2.nodes.graphics.display= 'name';
w2=show_graph(g2,'new');


g=graph_union(g1,g2);
show_graph(g,'new');

g=graph_union(g1,g2,%f);
show_graph(g,'new');

 
  

See Also

supernode , subgraph