next up previous contents index
Next: Face Maps ( face_map Up: Graphs and Related Data Previous: Node Maps ( node_map   Contents   Index


Edge Maps ( edge_map )

Definition

An instance of the data type edge_map<E> is a map for the edges of a graph G, i.e., equivalent to map<edge,E> (cf. Maps). It can be used as a dynamic variant of the data type edge_array (cf. Edge Arrays). New: Since edge_map<E> is derived from edge_array<E> edge maps can be passed (by reference) to functions with edge array parameters. In particular, all LEDA graph algorithms expecting an edge_array<E>& argument can be passed an edge_map<E>& instead.

#include < LEDA/edge _map.h >

Creation

edge_map<E> M introduces a variable M of type edge_map<E> and initializes it to the map with empty domain.

edge_map<E> M(graph G) introduces a variable M of type edge_map<E> and initializes it with a mapping m from the set of all edges of G into the set of variables of type E. The variables in the range of m are initialized by a call of the default constructor of type E.

edge_map<E> M(graph G, E x) introduces a variable M of type edge_map<E> and initializes it with a mapping m from the set of all edges of G into the set of variables of type E. The variables in the range of m are initialized with a copy of x.

Operations

graph M.get_graph() returns a reference to the graph of M.

void M.init() makes M a edge map with empty domain.

void M.init(graph G) makes M a mapping m from the set of all edges of G into the set of variables of type E. The variables in the range of m are initialized by a call of the default constructor of type E.

void M.init(graph G, E x) makes M a mapping m from the set of all edges of G into the set of variables of type E. The variables in the range of m are initialized with a copy of x.

E& M[edge e] returns the variable M(v).

Implementation

Edge maps are implemented by an efficient hashing method based on the internal numbering of the edges. An access operation takes expected time O(1).


next up previous contents index
Next: Face Maps ( face_map Up: Graphs and Related Data Previous: Node Maps ( node_map   Contents   Index
LEDA research project
2000-02-09