SplitNodes adaptor can be used for splitting each node into an in-node and an out-node in a digraph. Formaly, the adaptor replaces each node in the digraph with two nodes, namely node and node . If there is a arc in the original digraph, then the new target of the arc will be and similarly the source of each original arc will be . The adaptor adds an additional bind arc from to for each node of the original digraph.
The aim of this class is running an algorithm with respect to node costs or capacities if the algorithm considers only arc costs or capacities directly. In this case you can use SplitNodes
adaptor, and set the node costs/capacities of the original digraph to the bind arcs in the adaptor.
DGR | The type of the adapted digraph. It must conform to the Digraph concept. It is implicitly const . |
Node
type of this adaptor is converible to the Node
type of the adapted digraph. #include <lemon/adaptors.h>
Classes | |
class | CombinedArcMap |
Arc map combined from an arc map and a node map of the original digraph. More... | |
class | CombinedNodeMap |
Node map combined from two original node maps. More... | |
Public Member Functions | |
SplitNodes (const DGR &g) | |
Constructor. | |
Static Public Member Functions | |
static bool | inNode (const Node &n) |
static bool | outNode (const Node &n) |
static bool | origArc (const Arc &a) |
Returns true if the given arc is an original arc. | |
static bool | bindArc (const Arc &a) |
Returns true if the given arc is a bind arc. | |
static Node | inNode (const DigraphNode &n) |
static Node | outNode (const DigraphNode &n) |
static Arc | arc (const DigraphNode &n) |
Returns the bind arc that corresponds to the given original node. | |
static Arc | arc (const DigraphArc &a) |
Returns the arc that corresponds to the given original arc. | |
template<typename IN , typename OUT > | |
static CombinedNodeMap< IN, OUT > | combinedNodeMap (IN &in_map, OUT &out_map) |
Returns a combined node map. | |
template<typename ArcMap , typename NodeMap > | |
static CombinedArcMap< ArcMap, NodeMap > | combinedArcMap (ArcMap &arc_map, NodeMap &node_map) |
Returns a combined arc map. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename DGR > | |
SplitNodes< DGR > | splitNodes (const DGR &digraph) |
Returns a (read-only) SplitNodes adaptor. |
SplitNodes | ( | const DGR & | g | ) | [inline] |
Constructor of the adaptor.
static bool inNode | ( | const Node & | n | ) | [inline, static] |
Returns true
if the given node is an in-node.
static bool outNode | ( | const Node & | n | ) | [inline, static] |
Returns true
if the given node is an out-node.
static bool origArc | ( | const Arc & | a | ) | [inline, static] |
Returns true
if the given arc is one of the arcs in the original digraph.
static bool bindArc | ( | const Arc & | a | ) | [inline, static] |
Returns true
if the given arc is a bind arc, i.e. it connects an in-node and an out-node.
static Node inNode | ( | const DigraphNode & | n | ) | [inline, static] |
Returns the in-node created from the given original node.
static Node outNode | ( | const DigraphNode & | n | ) | [inline, static] |
Returns the out-node created from the given original node.
static Arc arc | ( | const DigraphNode & | n | ) | [inline, static] |
Returns the bind arc in the adaptor that corresponds to the given original node, i.e. the arc connecting the in-node and out-node of n
.
static Arc arc | ( | const DigraphArc & | a | ) | [inline, static] |
Returns the arc in the adaptor that corresponds to the given original arc.
static CombinedNodeMap<IN, OUT> combinedNodeMap | ( | IN & | in_map, |
OUT & | out_map | ||
) | [inline, static] |
This function just returns a combined node map.
static CombinedArcMap<ArcMap, NodeMap> combinedArcMap | ( | ArcMap & | arc_map, |
NodeMap & | node_map | ||
) | [inline, static] |
This function just returns a combined arc map.