Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::sync_plan::QPartitioning Class Reference

Manages the partitioning of Q-nodes in an instance of SyncPlan. More...

#include <ogdf/cluster/sync_plan/QPartitioning.h>

+ Inheritance diagram for ogdf::sync_plan::QPartitioning:

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 &copy)=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_typegetRegisteredArrays () 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...
 
RegistryBaseoperator= (const RegistryBase &other)=delete
 
RegistryBaseoperator= (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 GraphgetGraph () const
 
- Protected Member Functions inherited from ogdf::Observer< Graph, GraphObserver >
 Observer ()=default
 Constructs instance of Observer class. More...
 
 Observer (const Observer &copy)=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 GraphgetObserved () const
 
Observeroperator= (const Observer &copy)=delete
 
Observeroperator= (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 &copy)=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_typegetRegisteredArrays () 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...
 
RegistryBaseoperator= (const RegistryBase &other)=delete
 
RegistryBaseoperator= (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
 

Detailed Description

Manages the partitioning of Q-nodes in an instance of SyncPlan.

Definition at line 46 of file QPartitioning.h.

Constructor & Destructor Documentation

◆ QPartitioning()

ogdf::sync_plan::QPartitioning::QPartitioning ( const Graph G)
inlineexplicit

Definition at line 57 of file QPartitioning.h.

Member Function Documentation

◆ begin()

int ogdf::sync_plan::QPartitioning::begin ( ) const
inline

Definition at line 89 of file QPartitioning.h.

◆ calculateArraySize()

int ogdf::sync_plan::QPartitioning::calculateArraySize ( int  add) const
inline

Returns the array size currently requested by this registry.

Definition at line 87 of file QPartitioning.h.

◆ cleared()

void ogdf::sync_plan::QPartitioning::cleared ( )
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.

◆ edgeAdded()

void ogdf::sync_plan::QPartitioning::edgeAdded ( edge  e)
inlineoverrideprotectedvirtual

Called by watched graph after an edge has been added.

Implements ogdf::GraphObserver.

Definition at line 100 of file QPartitioning.h.

◆ edgeDeleted()

void ogdf::sync_plan::QPartitioning::edgeDeleted ( edge  e)
inlineoverrideprotectedvirtual

Called by watched graph just before an edge is deleted.

Implements ogdf::GraphObserver.

Definition at line 98 of file QPartitioning.h.

◆ end()

int ogdf::sync_plan::QPartitioning::end ( ) const
inline

Definition at line 91 of file QPartitioning.h.

◆ getPartitionOf()

int ogdf::sync_plan::QPartitioning::getPartitionOf ( node  n) const

◆ isKeyAssociated()

bool ogdf::sync_plan::QPartitioning::isKeyAssociated ( int  key) const
inline

Returns whether key is associated with this registry.

Definition at line 81 of file QPartitioning.h.

◆ isQVertex()

bool ogdf::sync_plan::QPartitioning::isQVertex ( node  n) const

◆ keyToIndex()

static int ogdf::sync_plan::QPartitioning::keyToIndex ( int  key)
inlinestatic

Returns the index of key.

Definition at line 78 of file QPartitioning.h.

◆ makeQVertex()

int ogdf::sync_plan::QPartitioning::makeQVertex ( node  n,
int  p = NO_PARTITION 
)

Mark a node as Q-node.

Note
it is assumed that the graph structure ensures that only two rotations are possible, i.e. by calling SyncPlan::makeWheel()

◆ maxKeyIndex()

int ogdf::sync_plan::QPartitioning::maxKeyIndex ( ) const
inline

Returns the maximum index of all keys managed by this registry.

Definition at line 84 of file QPartitioning.h.

◆ nodeAdded()

void ogdf::sync_plan::QPartitioning::nodeAdded ( node  v)
inlineoverrideprotectedvirtual

Called by watched graph after a node has been added.

Implements ogdf::GraphObserver.

Definition at line 96 of file QPartitioning.h.

◆ nodeDeleted()

void ogdf::sync_plan::QPartitioning::nodeDeleted ( node  v)
overrideprotectedvirtual

Called by watched graph just before a node is deleted.

Implements ogdf::GraphObserver.

◆ nodesInPartition()

const List<node>& ogdf::sync_plan::QPartitioning::nodesInPartition ( int  partition) const
inline

Definition at line 75 of file QPartitioning.h.

◆ partitionCount()

int ogdf::sync_plan::QPartitioning::partitionCount ( ) const
inline

Definition at line 71 of file QPartitioning.h.

◆ qVertexCount()

int ogdf::sync_plan::QPartitioning::qVertexCount ( ) const
inline

Definition at line 73 of file QPartitioning.h.

◆ releaseQVertex()

void ogdf::sync_plan::QPartitioning::releaseQVertex ( node  n)

Member Data Documentation

◆ NO_PARTITION

int ogdf::sync_plan::QPartitioning::NO_PARTITION = -1
inlinestatic

Definition at line 55 of file QPartitioning.h.

◆ partition_next_id

int ogdf::sync_plan::QPartitioning::partition_next_id = 0
private

Definition at line 52 of file QPartitioning.h.

◆ partitioned_nodes

PartitionArray<List<node> > ogdf::sync_plan::QPartitioning::partitioned_nodes
private

Definition at line 49 of file QPartitioning.h.

◆ partitions

NodeArray<int> ogdf::sync_plan::QPartitioning::partitions
private

Definition at line 50 of file QPartitioning.h.

◆ q_vertex_count

int ogdf::sync_plan::QPartitioning::q_vertex_count = 0
private

Definition at line 51 of file QPartitioning.h.


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