next up previous contents index
Next: Plane Graph Copies ( Up: Graphs and Generators Previous: Graphs and Generators   Contents   Index


Graph Copies ( GraphCopy )

Baseclasses


\begin{picture}(6.5,2.5)
\thicklines
\put(0,1.5){\framebox (5,1){\bf graph}}...
...2){\vector(0,-1){1}}\put(1.5,0){\framebox (5,1){\bf GraphCopy}}
\end{picture}

Definition

An instance GC of type GraphCopy is a copy of an original graph G. For each node v' of GC, GraphCopy stores the corresponding node original(v') in the original graph G, for each node v in G the newly created copy copy(v) in GC, for each edge e' in GC the corresponding edge original(e') in G, and for each edge e in G a list of dummy edges chain(e) in GC.

For nodes or edges which are created afterwards with new_node or new_edge, the corresponding node or edge is set to nil.

#include < AGD/GraphCopy.h >

Creation

GraphCopy GC creates an instance GC of type GraphCopy initialized to an empty graph without original graph.

GraphCopy GC(const leda_graph& G) creates an instance GC of type GraphCopy initialized to a copy of G.

GraphCopy GC(const GraphCopy& GC) creates an instance GC of type GraphCopy initialized to a copy of original(GC).

GraphCopy GC(const GraphCopy& GC, leda_node_array<leda_node>& v_copy, leda_edge_array<leda_edge>& e_copy)
    creates an instance GC of type GraphCopy initialized to a copy of original(GC). Returns in v_copy the newly created nodes, i.e., v$ \_$copy[v] is the node created for node v $ \in$ GC, and in e_copy the newly created edges, i.e., e$ \_$copy[e] is the edge created for edge e $ \in$ GC.

Operations

const leda_graph& GC.original() returns the original graph G.

leda_node GC.original(leda_node v) returns the node of the original graph G that corresponds to v, nil if v was not in G, e.g. v was created afterwards.

leda_edge GC.original(leda_edge e) returns the edge of the original graph G that corresponds to e, nil if e was not in G, e.g. e was created afterwards.

leda_node GC.copy(leda_node v) returns copy(v). Precondition: v $ \in$ G.

const leda_list<leda_edge>& GC.chain(leda_edge e) returns the list of dummy edges for edge e. Precondition: e is an edge in G.

bool GC.is_dummy(leda_node v) returns true iff v has a corresponding node in the original graph.

bool GC.is_dummy(leda_edge e) returns true iff e has a corresponding edge in the original graph.

bool GC.is_reversed(leda_edge e)
    returns true iff e $ \in$ G has been reversed in GC.

leda_edge GC.split(leda_edge e) splits edge e = (v, w) into edges (v, u), (u, w) by introducing a new node u. Returns the edge (u, w).

bool GC.is_map() virtual method returning false.

Implementation

All operations for graphs are available for instances of type GraphCopy, too. All additional operations take constant time.


next up previous contents index
Next: Plane Graph Copies ( Up: Graphs and Generators Previous: Graphs and Generators   Contents   Index

© Copyright 1998-2001, Algorithmic Solutions Software GmbH. All rights reserved.
2001-08-13