Public Member Functions

DigraphCopy< From, To > Class Template Reference


Detailed Description

template<typename From, typename To>
class lemon::DigraphCopy< From, To >

Class to copy a digraph to another digraph (duplicate a digraph). The simplest way of using it is through the digraphCopy() function.

This class not only make a copy of a digraph, but it can create references and cross references between the nodes and arcs of the two digraphs, and it can copy maps to use with the newly created digraph.

To make a copy from a digraph, first an instance of DigraphCopy should be created, then the data belongs to the digraph should assigned to copy. In the end, the run() member should be called.

The next code copies a digraph with several data:

       DigraphCopy<OrigGraph, NewGraph> cg(orig_graph, new_graph);
       // Create references for the nodes
       OrigGraph::NodeMap<NewGraph::Node> nr(orig_graph);
       cg.nodeRef(nr);
       // Create cross references (inverse) for the arcs
       NewGraph::ArcMap<OrigGraph::Arc> acr(new_graph);
       cg.arcCrossRef(acr);
       // Copy an arc map
       OrigGraph::ArcMap<double> oamap(orig_graph);
       NewGraph::ArcMap<double> namap(new_graph);
       cg.arcMap(oamap, namap);
       // Copy a node
       OrigGraph::Node on;
       NewGraph::Node nn;
       cg.node(on, nn);
       // Execute copying
       cg.run();

#include <lemon/core.h>

List of all members.

Public Member Functions

 DigraphCopy (const From &from, To &to)
 Constructor of DigraphCopy.
 ~DigraphCopy ()
template<typename NodeRef >
DigraphCopynodeRef (NodeRef &map)
 Copy the node references into the given map.
template<typename NodeCrossRef >
DigraphCopynodeCrossRef (NodeCrossRef &map)
 Copy the node cross references into the given map.
template<typename FromMap , typename ToMap >
DigraphCopynodeMap (const FromMap &map, ToMap &tmap)
 Make a copy of the given node map.
DigraphCopynode (const Node &node, TNode &tnode)
 Make a copy of the given node.
template<typename ArcRef >
DigraphCopyarcRef (ArcRef &map)
 Copy the arc references into the given map.
template<typename ArcCrossRef >
DigraphCopyarcCrossRef (ArcCrossRef &map)
 Copy the arc cross references into the given map.
template<typename FromMap , typename ToMap >
DigraphCopyarcMap (const FromMap &map, ToMap &tmap)
 Make a copy of the given arc map.
DigraphCopyarc (const Arc &arc, TArc &tarc)
 Make a copy of the given arc.
void run ()
 Execute copying.

Constructor & Destructor Documentation

DigraphCopy ( const From &  from,
To &  to 
) [inline]

Constructor of DigraphCopy for copying the content of the from digraph into the to digraph.

~DigraphCopy ( ) [inline]

Destructor of DigraphCopy.


Member Function Documentation

DigraphCopy& nodeRef ( NodeRef &  map) [inline]

This function copies the node references into the given map. The parameter should be a map, whose key type is the Node type of the source digraph, while the value type is the Node type of the destination digraph.

DigraphCopy& nodeCrossRef ( NodeCrossRef &  map) [inline]

This function copies the node cross references (reverse references) into the given map. The parameter should be a map, whose key type is the Node type of the destination digraph, while the value type is the Node type of the source digraph.

DigraphCopy& nodeMap ( const FromMap &  map,
ToMap &  tmap 
) [inline]

This function makes a copy of the given node map for the newly created digraph. The key type of the new map tmap should be the Node type of the destination digraph, and the key type of the original map map should be the Node type of the source digraph.

DigraphCopy& node ( const Node &  node,
TNode &  tnode 
) [inline]

This function makes a copy of the given node.

DigraphCopy& arcRef ( ArcRef &  map) [inline]

This function copies the arc references into the given map. The parameter should be a map, whose key type is the Arc type of the source digraph, while the value type is the Arc type of the destination digraph.

DigraphCopy& arcCrossRef ( ArcCrossRef &  map) [inline]

This function copies the arc cross references (reverse references) into the given map. The parameter should be a map, whose key type is the Arc type of the destination digraph, while the value type is the Arc type of the source digraph.

DigraphCopy& arcMap ( const FromMap &  map,
ToMap &  tmap 
) [inline]

This function makes a copy of the given arc map for the newly created digraph. The key type of the new map tmap should be the Arc type of the destination digraph, and the key type of the original map map should be the Arc type of the source digraph.

DigraphCopy& arc ( const Arc &  arc,
TArc &  tarc 
) [inline]

This function makes a copy of the given arc.

void run ( ) [inline]

This function executes the copying of the digraph along with the copying of the assigned data.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines