Manages the partitioning of Q-nodes in an instance of SyncPlan. More...
#include <ogdf/cluster/sync_plan/QPartitioning.h>
Public Member Functions | |
QPartitioning (const Graph *G) | |
int | begin () const |
int | calculateArraySize (int add) const |
Returns the array size currently requested by this registry. More... | |
int | end () const |
int | getPartitionOf (node n) const |
bool | isKeyAssociated (int key) const |
Returns whether key is associated with this registry. More... | |
bool | isQVertex (node n) const |
int | makeQVertex (node n, int p=NO_PARTITION) |
Mark a node as Q-node. More... | |
int | maxKeyIndex () const |
Returns the maximum index of all keys managed by this registry. More... | |
const List< node > & | nodesInPartition (int partition) const |
int | partitionCount () const |
int | qVertexCount () const |
void | releaseQVertex (node n) |
Public Member Functions inherited from ogdf::RegistryBase< int, QPartitioning, int > | |
RegistryBase (const RegistryBase ©)=delete | |
RegistryBase (RegistryBase &&move) noexcept=delete | |
virtual | ~RegistryBase () noexcept |
Destructor. Unregisters all associated arrays. More... | |
void | copyArrayEntries (int toIndex, int fromIndex) |
Copies the entry from fromIndex to toIndex in all registered arrays. More... | |
int | getArraySize () const |
Returns the current size of all registered arrays. More... | |
const registration_list_type & | getRegisteredArrays () const |
Returns a reference to the list of all registered arrays. More... | |
bool | isAutoShrink () const |
Returns whether the registry allows arrays to shrink when keys are removed. More... | |
void | keyAdded (int key) |
Records the addition of a new key and resizes all registered arrays if necessary. More... | |
void | keyRemoved (int key) |
Records the deletion of a key and resizes all registered arrays if auto shrink is enabled. More... | |
void | keysCleared () |
Records that all keys have been cleared. If auto shrink is enabled, all arrays are cleared and resized to 0. More... | |
void | moveRegisterArray (registration_iterator_type it, registered_array_type *pArray) const |
Stores array pArray at position it in the list of registered arrays. More... | |
RegistryBase & | operator= (const RegistryBase &other)=delete |
RegistryBase & | operator= (RegistryBase &&other) noexcept=delete |
OGDF_NODISCARD registration_iterator_type | registerArray (registered_array_type *pArray) const |
Registers a new array with this registry. More... | |
void | reserveSpace (int new_keys) |
Resizes all arrays to make space of new_keys new keys. More... | |
void | resizeArrays () |
Resizes all arrays to the size requested by calculateArraySize(). Only shrinks the arrays if auto shrink is enabled. More... | |
void | resizeArrays (int size) |
Resizes all arrays to size . Only shrinks the arrays if auto shrink is enabled. More... | |
void | resizeArrays (int size, bool shrink) |
Resizes all arrays to size . If shrink is true , the arrays may also shrink. More... | |
void | setAutoShrink (bool mAutoShrink) |
Specifies whether the registry allows arrays to shrink when keys are removed. More... | |
void | swapArrayEntries (int index1, int index2) |
Swaps the entries at index1 and index2 in all registered arrays. More... | |
void | unregisterArray (registration_iterator_type it) const noexcept |
Unregisters an array associated with this registry. More... | |
void | unregisterArrays () noexcept |
Unregister all associated arrays. More... | |
Static Public Member Functions | |
static int | keyToIndex (int key) |
Returns the index of key . More... | |
Static Public Attributes | |
static int | NO_PARTITION = -1 |
Protected Member Functions | |
void | cleared () override |
Called by watched graph when its clear function is called, just before things are removed. More... | |
void | edgeAdded (edge e) override |
Called by watched graph after an edge has been added. More... | |
void | edgeDeleted (edge e) override |
Called by watched graph just before an edge is deleted. More... | |
void | nodeAdded (node v) override |
Called by watched graph after a node has been added. More... | |
void | nodeDeleted (node v) override |
Called by watched graph just before a node is deleted. More... | |
Protected Member Functions inherited from ogdf::GraphObserver | |
GraphObserver ()=default | |
Constructs instance of GraphObserver class. More... | |
GraphObserver (const Graph *G) | |
Constructs instance of GraphObserver class. More... | |
const Graph * | getGraph () const |
Protected Member Functions inherited from ogdf::Observer< Graph, GraphObserver > | |
Observer ()=default | |
Constructs instance of Observer class. More... | |
Observer (const Observer ©)=delete | |
If you want to copy a subclass of Observer, call the default Observer() constructor and optionally also call reregister if it makes sense. More... | |
Observer (Observer &&move)=delete | |
If you want to move a subclass of Observer, call the default Observer() constructor and optionally also call reregister if it makes sense. More... | |
virtual | ~Observer () |
Destroys the instance, unregisters it from watched instance. More... | |
const Graph * | getObserved () const |
Observer & | operator= (const Observer ©)=delete |
Observer & | operator= (Observer &&move)=delete |
virtual void | registrationChanged (const Graph *old) |
Called after reregister() changed the observed instance. More... | |
void | reregister (const Graph *obs) |
Associates observer instance with instance obs . More... | |
Protected Member Functions inherited from ogdf::RegistryBase< int, QPartitioning, int > | |
RegistryBase ()=default | |
RegistryBase (const RegistryBase ©)=delete | |
RegistryBase (RegistryBase &&move) noexcept=delete | |
virtual | ~RegistryBase () noexcept |
Destructor. Unregisters all associated arrays. More... | |
void | copyArrayEntries (int toIndex, int fromIndex) |
Copies the entry from fromIndex to toIndex in all registered arrays. More... | |
int | getArraySize () const |
Returns the current size of all registered arrays. More... | |
const registration_list_type & | getRegisteredArrays () const |
Returns a reference to the list of all registered arrays. More... | |
bool | isAutoShrink () const |
Returns whether the registry allows arrays to shrink when keys are removed. More... | |
void | keyAdded (int key) |
Records the addition of a new key and resizes all registered arrays if necessary. More... | |
void | keyRemoved (int key) |
Records the deletion of a key and resizes all registered arrays if auto shrink is enabled. More... | |
void | keysCleared () |
Records that all keys have been cleared. If auto shrink is enabled, all arrays are cleared and resized to 0. More... | |
void | moveRegisterArray (registration_iterator_type it, registered_array_type *pArray) const |
Stores array pArray at position it in the list of registered arrays. More... | |
RegistryBase & | operator= (const RegistryBase &other)=delete |
RegistryBase & | operator= (RegistryBase &&other) noexcept=delete |
OGDF_NODISCARD registration_iterator_type | registerArray (registered_array_type *pArray) const |
Registers a new array with this registry. More... | |
void | reserveSpace (int new_keys) |
Resizes all arrays to make space of new_keys new keys. More... | |
void | resizeArrays () |
Resizes all arrays to the size requested by calculateArraySize(). Only shrinks the arrays if auto shrink is enabled. More... | |
void | resizeArrays (int size) |
Resizes all arrays to size . Only shrinks the arrays if auto shrink is enabled. More... | |
void | resizeArrays (int size, bool shrink) |
Resizes all arrays to size . If shrink is true , the arrays may also shrink. More... | |
void | setAutoShrink (bool mAutoShrink) |
Specifies whether the registry allows arrays to shrink when keys are removed. More... | |
void | swapArrayEntries (int index1, int index2) |
Swaps the entries at index1 and index2 in all registered arrays. More... | |
void | unregisterArray (registration_iterator_type it) const noexcept |
Unregisters an array associated with this registry. More... | |
void | unregisterArrays () noexcept |
Unregister all associated arrays. More... | |
Private Attributes | |
int | partition_next_id = 0 |
PartitionArray< List< node > > | partitioned_nodes |
NodeArray< int > | partitions |
int | q_vertex_count = 0 |
Additional Inherited Members | |
Public Types inherited from ogdf::RegistryBase< int, QPartitioning, int > | |
using | iterator_type = int |
using | key_type = int |
using | registered_array_type = internal::RegisteredArrayBase< QPartitioning > |
using | registration_iterator_type = typename registration_list_type::iterator |
using | registration_list_type = std::list< registered_array_type *, OGDFAllocator< registered_array_type * > > |
using | registry_type = QPartitioning |
Protected Types inherited from ogdf::RegistryBase< int, QPartitioning, int > | |
using | iterator_type = int |
using | key_type = int |
using | registered_array_type = internal::RegisteredArrayBase< QPartitioning > |
using | registration_iterator_type = typename registration_list_type::iterator |
using | registration_list_type = std::list< registered_array_type *, OGDFAllocator< registered_array_type * > > |
using | registry_type = QPartitioning |
Manages the partitioning of Q-nodes in an instance of SyncPlan.
Definition at line 46 of file QPartitioning.h.
|
inlineexplicit |
Definition at line 57 of file QPartitioning.h.
|
inline |
Definition at line 89 of file QPartitioning.h.
|
inline |
Returns the array size currently requested by this registry.
Definition at line 87 of file QPartitioning.h.
|
inlineoverrideprotectedvirtual |
Called by watched graph when its clear function is called, just before things are removed.
Implements ogdf::GraphObserver.
Definition at line 102 of file QPartitioning.h.
|
inlineoverrideprotectedvirtual |
Called by watched graph after an edge has been added.
Implements ogdf::GraphObserver.
Definition at line 100 of file QPartitioning.h.
|
inlineoverrideprotectedvirtual |
Called by watched graph just before an edge is deleted.
Implements ogdf::GraphObserver.
Definition at line 98 of file QPartitioning.h.
|
inline |
Definition at line 91 of file QPartitioning.h.
int ogdf::sync_plan::QPartitioning::getPartitionOf | ( | node | n | ) | const |
|
inline |
Returns whether key
is associated with this registry.
Definition at line 81 of file QPartitioning.h.
bool ogdf::sync_plan::QPartitioning::isQVertex | ( | node | n | ) | const |
|
inlinestatic |
Returns the index of key
.
Definition at line 78 of file QPartitioning.h.
int ogdf::sync_plan::QPartitioning::makeQVertex | ( | node | n, |
int | p = NO_PARTITION |
||
) |
Mark a node as Q-node.
|
inline |
Returns the maximum index of all keys managed by this registry.
Definition at line 84 of file QPartitioning.h.
|
inlineoverrideprotectedvirtual |
Called by watched graph after a node has been added.
Implements ogdf::GraphObserver.
Definition at line 96 of file QPartitioning.h.
|
overrideprotectedvirtual |
Called by watched graph just before a node is deleted.
Implements ogdf::GraphObserver.
Definition at line 75 of file QPartitioning.h.
|
inline |
Definition at line 71 of file QPartitioning.h.
|
inline |
Definition at line 73 of file QPartitioning.h.
void ogdf::sync_plan::QPartitioning::releaseQVertex | ( | node | n | ) |
|
inlinestatic |
Definition at line 55 of file QPartitioning.h.
|
private |
Definition at line 52 of file QPartitioning.h.
|
private |
Definition at line 49 of file QPartitioning.h.
|
private |
Definition at line 50 of file QPartitioning.h.
|
private |
Definition at line 51 of file QPartitioning.h.