Definition
An instance A of the parameterized data type face_array<E>
is a partial mapping from the face set of a graph G to the set of
variables of type E, called the element type of the array. The domain
I of A is called the index set of A and A(f ) is called the element
at position f. A is said to be valid for all faces in I.
The array access operator A[f] checks its precondition
(A must be valid for f). The check can be turned off by compiling
with the flag -DLEDA_CHECKING_OFF
.
#include < LEDA/graph/face_array.h >
Creation
face_array<E> | A | creates an instance A of type face_array<E> with empty index set. |
face_array<E> | A(const graph_t& G) | creates an instance A of type face_array<E> and initializes the index set of A to the current face set of graph G. |
face_array<E> | A(const graph_t& G, E x) | creates an instance A of type face_array<E>, sets the index set of A to the current face set of graph G and initializes A(f ) with x for all faces f of G. |
face_array<E> | A(const graph_t& G, int n, E x) | |
creates an instance A of type face_array<E> valid for
up to n faces of graph G and initializes A(f ) with x
for all faces f of G.
Precondition n > = | V|. A is also valid for the next n - | V| faces added to G. |
Operations
Implementation
Node arrays for a graph G are implemented by C++vectors and an internal numbering of the faces and edges of G. The access operation takes constant time, init takes time O(n), where n is the number of faces in G. The space requirement is O(n).
Remark: A face array is only valid for a bounded number of faces of G. This number is either the number of faces of G at the moment of creation of the array or it is explicitely set by the user. Dynamic face arrays can be realized by face maps (cf. section Node Maps).