Open
Graph Drawing
Framework

 v.2012.07
 

ogdf::EdgeArray< T > Class Template Reference

Dynamic arrays indexed with edges. More...

#include <ogdf/basic/EdgeArray.h>

+ Inheritance diagram for ogdf::EdgeArray< T >:

List of all members.

Public Member Functions

 EdgeArray ()
 Constructs an empty edge array associated with no graph.
 EdgeArray (const Graph &G)
 Constructs an edge array associated with G.
 EdgeArray (const Graph &G, const T &x)
 Constructs an edge array associated with G.
 EdgeArray (const EdgeArray< T > &A)
 Constructs an edge array that is a copy of A.
void fill (const T &x)
 Sets all array elements to x.
const GraphgraphOf () const
 Returns a pointer to the associated graph.
void init ()
 Reinitializes the array. Associates the array with no graph.
void init (const Graph &G)
 Reinitializes the array. Associates the array with G.
void init (const Graph &G, const T &x)
 Reinitializes the array. Associates the array with G.
EdgeArray< T > & operator= (const EdgeArray< T > &a)
 Assignment operator.
const T & operator[] (edge e) const
 Returns a reference to the element with index e.
T & operator[] (edge e)
 Returns a reference to the element with index e.
const T & operator[] (adjEntry adj) const
 Returns a reference to the element with index edge of adj.
T & operator[] (adjEntry adj)
 Returns a reference to the element with index edge of adj.
const T & operator[] (int index) const
 Returns a reference to the element with index index.
T & operator[] (int index)
 Returns a reference to the element with index index.
bool valid () const
 Returns true iff the array is associated with a graph.

Private Member Functions

virtual void disconnect ()
 Virtual function called when array is disconnected from the graph.
virtual void enlargeTable (int newTableSize)
 Virtual function called when table size has to be enlarged.
virtual void reinit (int initTableSize)
 Virtual function called when table has to be reinitialized.
- Private Member Functions inherited from ogdf::Array< T >
 Array ()
 Creates an array with empty index set.
 Array (ints)
 Creates an array with index set [0..s-1].
 Array (inta, intb)
 Creates an array with index set [a..b].
 Array (inta, intb, const T &x)
 Creates an array with index set [a..b] and initializes each element with x.
 Array (const Array< T > &A)
 Creates an array that is a copy of A.
 ~Array ()
T * begin ()
 Returns a pointer to the first element.
const T * begin () const
 Returns a pointer to the first element.
int binarySearch (const T &x) const
 Performs a binary search for element x.
int binarySearch (const T &e, const COMPARER &comp) const
 Performs a binary search for element x with comparer comp.
T * end ()
 Returns a pointer to one past the last element.
const T * end () const
 Returns a pointer to one past the last element.
void fill (inti, intj, const T &x)
 Sets elements in the intervall [i..j] to x.
void grow (intadd, const T &x)
 Enlarges the array by add elements and sets new elements to x.
void grow (intadd)
 Enlarges the array by add elements.
int high () const
 Returns the maximal array index.
void init (ints)
 Reinitializes the array to an array with index set [0..s-1].
void init (inta, intb)
 Reinitializes the array to an array with index set [a..b].
void init (inta, intb, const T &x)
 Reinitializes the array to an array with index set [a..b] and sets all entries to x.
int linearSearch (const T &e) const
 Performs a linear search for element x.
int linearSearch (const T &e, const COMPARER &comp) const
 Performs a linear search for element x with comparer comp.
int low () const
 Returns the minimal array index.
Array< T, int > & operator= (const Array< T, int > &array2)
 Assignment operator.
void permute (intl, intr)
 Randomly permutes the subarray with index set [l..r].
void permute ()
 Randomly permutes the array.
void quicksort ()
 Sorts array using Quicksort.
void quicksort (intl, intr)
 Sorts subarray with index set [l..r] using Quicksort.
void quicksort (const COMPARER &comp)
 Sorts array using Quicksort and a user-defined comparer comp.
void quicksort (intl, intr, const COMPARER &comp)
 Sorts the subarray with index set [l..r] using Quicksort and a user-defined comparer comp.
T * rbegin ()
 Returns a pointer to the last element.
const T * rbegin () const
 Returns a pointer to the last element.
T * rend ()
 Returns a pointer to one before the first element.
const T * rend () const
 Returns a pointer to one before the first element.
int size () const
 Returns the size (number of elements) of the array.
void swap (inti, intj)
 Swaps the elements at position i and j.

Private Attributes

m_x
 The default value for array elements.

Additional Inherited Members

- Protected Member Functions inherited from ogdf::EdgeArrayBase
 EdgeArrayBase ()
 Initializes an edge array not associated with a graph.
 EdgeArrayBase (const Graph *pG)
 Initializes an edge array associated with pG.
virtual ~EdgeArrayBase ()
void reregister (const Graph *pG)
 Associates the array with a new graph.
- Protected Attributes inherited from ogdf::EdgeArrayBase
const Graphm_pGraph
 The associated graph.
- Private Types inherited from ogdf::Array< T >
enum  

Detailed Description

template<class T>
class ogdf::EdgeArray< T >

Dynamic arrays indexed with edges.

Edge arrays represent a mapping from edges to data of type T. They adjust their table size automatically when the graph grows.

Template Parameters:
Tis the element type.

Definition at line 107 of file EdgeArray.h.


Constructor & Destructor Documentation

template<class T>
ogdf::EdgeArray< T >::EdgeArray ( )
inline

Constructs an empty edge array associated with no graph.

Definition at line 112 of file EdgeArray.h.

template<class T>
ogdf::EdgeArray< T >::EdgeArray ( const Graph G)
inline

Constructs an edge array associated with G.

Definition at line 114 of file EdgeArray.h.

template<class T>
ogdf::EdgeArray< T >::EdgeArray ( const Graph G,
const T &  x 
)
inline

Constructs an edge array associated with G.

Parameters:
Gis the associated graph.
xis the default value for all array elements.

Definition at line 120 of file EdgeArray.h.

template<class T>
ogdf::EdgeArray< T >::EdgeArray ( const EdgeArray< T > &  A)
inline

Constructs an edge array that is a copy of A.

Associates the array with the same graph as A and copies all elements.

Definition at line 126 of file EdgeArray.h.


Member Function Documentation

template<class T>
virtual void ogdf::EdgeArray< T >::disconnect ( )
inlineprivatevirtual

Virtual function called when array is disconnected from the graph.

Implements ogdf::EdgeArrayBase.

Definition at line 221 of file EdgeArray.h.

template<class T>
virtual void ogdf::EdgeArray< T >::enlargeTable ( int  newTableSize)
inlineprivatevirtual

Virtual function called when table size has to be enlarged.

Implements ogdf::EdgeArrayBase.

Definition at line 213 of file EdgeArray.h.

template<class T>
void ogdf::EdgeArray< T >::fill ( const T &  x)
inline

Sets all array elements to x.

Reimplemented from ogdf::Array< T >.

Definition at line 206 of file EdgeArray.h.

template<class T>
const Graph* ogdf::EdgeArray< T >::graphOf ( ) const
inline

Returns a pointer to the associated graph.

Definition at line 132 of file EdgeArray.h.

template<class T>
void ogdf::EdgeArray< T >::init ( )
inline

Reinitializes the array. Associates the array with no graph.

Reimplemented from ogdf::Array< T >.

Definition at line 187 of file EdgeArray.h.

template<class T>
void ogdf::EdgeArray< T >::init ( const Graph G)
inline

Reinitializes the array. Associates the array with G.

Definition at line 192 of file EdgeArray.h.

template<class T>
void ogdf::EdgeArray< T >::init ( const Graph G,
const T &  x 
)
inline

Reinitializes the array. Associates the array with G.

Parameters:
Gis the associated graph.
xis the default value.

Definition at line 201 of file EdgeArray.h.

template<class T>
EdgeArray<T>& ogdf::EdgeArray< T >::operator= ( const EdgeArray< T > &  a)
inline

Assignment operator.

Definition at line 179 of file EdgeArray.h.

template<class T>
const T& ogdf::EdgeArray< T >::operator[] ( edge  e) const
inline

Returns a reference to the element with index e.

Definition at line 137 of file EdgeArray.h.

template<class T>
T& ogdf::EdgeArray< T >::operator[] ( edge  e)
inline

Returns a reference to the element with index e.

Definition at line 143 of file EdgeArray.h.

template<class T>
const T& ogdf::EdgeArray< T >::operator[] ( adjEntry  adj) const
inline

Returns a reference to the element with index edge of adj.

Definition at line 149 of file EdgeArray.h.

template<class T>
T& ogdf::EdgeArray< T >::operator[] ( adjEntry  adj)
inline

Returns a reference to the element with index edge of adj.

Definition at line 155 of file EdgeArray.h.

template<class T>
const T& ogdf::EdgeArray< T >::operator[] ( int  index) const
inline

Returns a reference to the element with index index.

Attention:
Make sure that index is a valid index for an edge in the associated graph!

Reimplemented from ogdf::Array< T >.

Definition at line 165 of file EdgeArray.h.

template<class T>
T& ogdf::EdgeArray< T >::operator[] ( int  index)
inline

Returns a reference to the element with index index.

Attention:
Make sure that index is a valid index for an edge in the associated graph!

Reimplemented from ogdf::Array< T >.

Definition at line 174 of file EdgeArray.h.

template<class T>
virtual void ogdf::EdgeArray< T >::reinit ( int  initTableSize)
inlineprivatevirtual

Virtual function called when table has to be reinitialized.

Implements ogdf::EdgeArrayBase.

Definition at line 217 of file EdgeArray.h.

template<class T>
bool ogdf::EdgeArray< T >::valid ( ) const
inline

Returns true iff the array is associated with a graph.

Definition at line 129 of file EdgeArray.h.


Member Data Documentation

template<class T>
T ogdf::EdgeArray< T >::m_x
private

The default value for array elements.

Definition at line 108 of file EdgeArray.h.


The documentation for this class was generated from the following file: