Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::HyperedgeArray< T > Class Template Reference

Dynamic arrays indexed with nodes. More...

#include <ogdf/hypergraph/HypergraphArray.h>

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

Public Member Functions

 HyperedgeArray ()
 Constructs an empty hypernode array associated with no graph.
 
 HyperedgeArray (const Hypergraph &H, const T &x)
 Constructs a hypernode array associated with H.
 
virtual ~HyperedgeArray ()
 Destructor.
 
void init (const Hypergraph &H)
 Reinitializes the array. Associates the array with H.
 
void init (const Hypergraph &H, const T &x)
 Reinitializes the array. Associates the array with H.
 
HyperedgeArray< T > & operator= (const HyperedgeArray< T > &a)
 Assignment operator.
 
T & operator[] (hyperedge e)
 Returns a reference to the element with the index of e.
 
T & operator[] (int index)
 Returns a reference to the element with index index.
 
const T & operator[] (int index) const
 Returns a reference to the element with index index.
 
virtual void reregister (const Hypergraph *H)
 Associates the array with a new hypergraph.
 
bool valid () const
 Returns true iff the array is associated with a hypergraph.
 

Private Member Functions

virtual void disconnect ()
 Disconnetion from the hypergraph.
 
virtual void enlargeTable (int newTableSize)
 Table size enlargement.
 
virtual void reinit (int initTableSize)
 Table re-initialization.
 
- Private Member Functions inherited from ogdf::Array< T >
 Array ()
 Creates an array with empty index set.
 
 Array (Array< T, int > &&A)
 Creates an array containing the elements of A (move semantics).
 
 Array (const Array< T, int > &A)
 Creates an array that is a copy of A.
 
 Array (const ArrayBuffer< T, int > &A)
 Creates an array that is a copy of A. The array-size is set to be the number of elements (not the capacity) of the buffer.
 
 Array (int a, int b)
 Creates an array with index set [a..b].
 
 Array (int a, int b, const T &x)
 Creates an array with index set [a..b] and initializes each element with x.
 
 Array (int s)
 Creates an array with index set [0..s-1].
 
 Array (std::initializer_list< T > initList)
 Creates an array containing the elements in the initializer list initList.
 
 ~Array ()
 Destruction.
 
int low () const
 Returns the minimal array index.
 
int high () const
 Returns the maximal array index.
 
int size () const
 Returns the size (number of elements) of the array.
 
bool empty () const
 Returns true iff there are no elements in the array.
 
const_reference operator[] (int i) const
 Returns a reference to the element at position i.
 
reference operator[] (int i)
 Returns a reference to the element at position i.
 
iterator begin ()
 Returns an iterator to the first element.
 
const_iterator begin () const
 Returns a const iterator to the first element.
 
const_iterator cbegin () const
 Returns a const iterator to the first element.
 
iterator end ()
 Returns an iterator to one past the last element.
 
const_iterator end () const
 Returns a const iterator to one past the last element.
 
const_iterator cend () const
 Returns a const iterator to one past the last element.
 
reverse_iterator rbegin ()
 Returns an reverse iterator to the last element.
 
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the last element.
 
const_reverse_iterator crbegin () const
 Returns a const reverse iterator to the last element.
 
reverse_iterator rend ()
 Returns an reverse iterator to one before the first element.
 
const_reverse_iterator rend () const
 Returns a const reverse iterator to one before the first element.
 
const_reverse_iterator crend () const
 Returns a const reverse iterator to one before the first element.
 
void init ()
 Reinitializes the array to an array with empty index set.
 
void init (int s)
 Reinitializes the array to an array with index set [0..s-1].
 
void init (int a, int b)
 Reinitializes the array to an array with index set [a..b].
 
void init (int a, int b, const T &x)
 Reinitializes the array to an array with index set [a..b] and sets all entries to x.
 
void fill (const T &x)
 Sets all elements to x.
 
void fill (int i, int j, const T &x)
 Sets elements in the intervall [i..j] to x.
 
void grow (int add, const T &x)
 Enlarges the array by add elements and sets new elements to x.
 
void grow (int add)
 Enlarges the array by add elements.
 
void resize (int newSize, const T &x)
 Resizes (enlarges or shrinks) the array to hold newSize elements and sets new elements to x.
 
void resize (int newSize)
 Resizes (enlarges or shrinks) the array to hold newSize elements.
 
Array< T, int > & operator= (const Array< T, int > &A)
 Assignment operator.
 
Array< T, int > & operator= (Array< T, int > &&A)
 Assignment operator (move semantics).
 
bool operator== (const Array< T, int > &L) const
 Equality operator.
 
bool operator!= (const Array< T, int > &L) const
 Inequality operator.
 
void swap (int i, int j)
 Swaps the elements at position i and j.
 
void permute (int l, int r)
 Randomly permutes the subarray with index set [l..r].
 
void permute ()
 Randomly permutes the array.
 
void permute (int l, int r, RNG &rng)
 Randomly permutes the subarray with index set [l..r] using random number generator rng.
 
void permute (RNG &rng)
 Randomly permutes the array using random number generator rng.
 
int binarySearch (const T &e) const
 Performs a binary search for element e.
 
int binarySearch (int l, int r, const T &e) const
 Performs a binary search for element e within the array section [l, ..., r] .
 
int binarySearch (const T &e, const COMPARER &comp) const
 Performs a binary search for element e with comparer comp.
 
int binarySearch (int l, int r, const T &e, const COMPARER &comp) const
 Performs a binary search for element e within the array section [l, ..., r] with comparer comp.
 
int linearSearch (const T &e) const
 Performs a linear search for element e.
 
int linearSearch (const T &e, const COMPARER &comp) const
 Performs a linear search for element e with comparer comp.
 
void quicksort ()
 Sorts array using Quicksort.
 
void quicksort (int l, int r)
 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 (int l, int r, const COMPARER &comp)
 Sorts the subarray with index set [l, ..., r] using Quicksort and a user-defined comparer comp.
 
void leftShift (ArrayBuffer< int, int > &ind)
 Removes the components listed in ind by shifting the remaining components to the left.
 
void leftShift (ArrayBuffer< int, int > &ind, const T &val)
 Removes the components listed in ind by shifting the remaining components to the left.
 

Private Attributes

m_x
 The default value for array elements.
 
 OGDF_NEW_DELETE
 

Additional Inherited Members

- Protected Member Functions inherited from ogdf::HypergraphArrayBase
 HypergraphArrayBase ()
 Initializes an array not associated with a hypergraph.
 
 HypergraphArrayBase (const Hypergraph *pH)
 Initializes an array associated with pH.
 
virtual ~HypergraphArrayBase ()
 Destructor, unregisters the array.
 
const HypergraphhypergraphOf () const
 Returns a pointer to the associated hypergraph.
 
- Protected Attributes inherited from ogdf::HypergraphArrayBase
const Hypergraphm_hypergraph
 The associated hypergraph.
 
ListIterator< HypergraphArrayBase * > m_it
 Pointer to list element in the list of all registered hypergraph arrays which references this array.
 
- Private Types inherited from ogdf::Array< T >
using const_iterator = ArrayConstIterator< T >
 Provides a random-access iterator that can read a const element in an array.
 
using const_reference = const T &
 Provides a reference to a const element stored in an array for reading and performing const operations.
 
using const_reverse_iterator = ArrayConstReverseIterator< T >
 Provides a reverse random-access iterator that can read a const element in an array.
 
using iterator = ArrayIterator< T >
 Provides a random-access iterator that can read or modify any element in an array.
 
using reference = T &
 Provides a reference to an element stored in an array.
 
using reverse_iterator = ArrayReverseIterator< T >
 Provides a reverse random-access iterator that can read or modify any element in an array.
 
using value_type = T
 Represents the data type stored in an array element.
 
- Static Private Attributes inherited from ogdf::Array< T >
static const int maxSizeInsertionSort
 Threshold used by quicksort() such that insertion sort is called for instances smaller than maxSizeInsertionSort.
 

Detailed Description

template<class T>
class ogdf::HyperedgeArray< T >

Dynamic arrays indexed with nodes.

Warning
Undefined behavior can occur when the array is used in the left-hand side of an assignment and the observed graph is changed in the right-hand side. To resolve the issue, use:
auto tmp = RHS; LHS = std::move(tmp);
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()

Definition at line 159 of file HypergraphArray.h.

Constructor & Destructor Documentation

◆ HyperedgeArray() [1/2]

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

Constructs an empty hypernode array associated with no graph.

Definition at line 165 of file HypergraphArray.h.

◆ HyperedgeArray() [2/2]

template<class T >
ogdf::HyperedgeArray< T >::HyperedgeArray ( const Hypergraph H,
const T &  x 
)
inline

Constructs a hypernode array associated with H.

Definition at line 168 of file HypergraphArray.h.

◆ ~HyperedgeArray()

template<class T >
virtual ogdf::HyperedgeArray< T >::~HyperedgeArray ( )
inlinevirtual

Destructor.

Definition at line 174 of file HypergraphArray.h.

Member Function Documentation

◆ disconnect()

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

Disconnetion from the hypergraph.

Implements ogdf::HypergraphArrayBase.

Definition at line 227 of file HypergraphArray.h.

◆ enlargeTable()

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

Table size enlargement.

Implements ogdf::HypergraphArrayBase.

Definition at line 223 of file HypergraphArray.h.

◆ init() [1/2]

template<class T >
void ogdf::HyperedgeArray< T >::init ( const Hypergraph H)
inline

Reinitializes the array. Associates the array with H.

Definition at line 201 of file HypergraphArray.h.

◆ init() [2/2]

template<class T >
void ogdf::HyperedgeArray< T >::init ( const Hypergraph H,
const T &  x 
)
inline

Reinitializes the array. Associates the array with H.

Definition at line 207 of file HypergraphArray.h.

◆ operator=()

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

Assignment operator.

Definition at line 193 of file HypergraphArray.h.

◆ operator[]() [1/3]

template<class T >
T & ogdf::HyperedgeArray< T >::operator[] ( hyperedge  e)
inline

Returns a reference to the element with the index of e.

Definition at line 184 of file HypergraphArray.h.

◆ operator[]() [2/3]

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

Returns a reference to the element with index index.

Definition at line 190 of file HypergraphArray.h.

◆ operator[]() [3/3]

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

Returns a reference to the element with index index.

Definition at line 187 of file HypergraphArray.h.

◆ reinit()

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

Table re-initialization.

Implements ogdf::HypergraphArrayBase.

Definition at line 225 of file HypergraphArray.h.

◆ reregister()

template<class T >
virtual void ogdf::HyperedgeArray< T >::reregister ( const Hypergraph H)
inlinevirtual

Associates the array with a new hypergraph.

Implements ogdf::HypergraphArrayBase.

Definition at line 212 of file HypergraphArray.h.

◆ valid()

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

Returns true iff the array is associated with a hypergraph.

Definition at line 181 of file HypergraphArray.h.

Member Data Documentation

◆ m_x

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

The default value for array elements.

Definition at line 161 of file HypergraphArray.h.

◆ OGDF_NEW_DELETE

template<class T >
ogdf::HyperedgeArray< T >::OGDF_NEW_DELETE
private

Definition at line 232 of file HypergraphArray.h.


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