Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::ClusterElement Class Reference

Representation of clusters in a clustered graph. More...

#include <ogdf/cluster/ClusterGraph.h>

+ Inheritance diagram for ogdf::ClusterElement:

Public Member Functions

 ClusterElement (const ClusterGraph *pClusterGraph, int id)
 Creates a new cluster element. More...
 
Access methods
const ClusterGraphgraphOf () const
 
int index () const
 Returns the (unique) index of the cluster. More...
 
int depth () const
 Returns the depth of the cluster in the cluster tree. More...
 
cluster parent ()
 Returns the parent of the cluster. More...
 
cluster succ () const
 Returns the successor of the cluster in the list of all clusters. More...
 
cluster pred () const
 Returns the predecessor of the cluster in the list of all clusters. More...
 
cluster pSucc () const
 Returns the postorder successor of the cluster in the list of all clusters. More...
 
cluster pPred () const
 Returns the postorder predecessor of the cluster in the list of all clusters. More...
 
void getClusterNodes (List< node > &clusterNodes)
 Returns the list of nodes in the cluster, i.e., all nodes in the subtree rooted at this cluster. More...
 
int getClusterNodes (NodeArray< bool > &clusterNode)
 Sets the entry for each node v to true if v is a member of the subgraph induced by the ClusterElement. More...
 
bool isDescendant (ClusterElement *child, bool allow_equal=false)
 Checks whether a cluster child is a descendant (i.e. child, child of a child, ...) of this cluster. More...
 
Iteration over tree structure

Alternatively you can use the containers ClusterElement::nodes, ClusterElement::children and ClusterElement::adjEntries directly.

ListConstIterator< ClusterElement * > cBegin () const
 Returns the first element in the list of child clusters. More...
 
ListConstIterator< ClusterElement * > crBegin () const
 Returns the last element in the list of child clusters. More...
 
int cCount ()
 Returns the number of child clusters. More...
 
ListConstIterator< nodenBegin () const
 Returns the first element in list of child nodes. More...
 
int nCount ()
 Returns the number of child nodes. More...
 
ListConstIterator< adjEntryfirstAdj () const
 Returns the first adjacency entry in the list of outgoing edges. More...
 
ListConstIterator< adjEntrylastAdj () const
 Returns the last adjacency entry in the list of outgoing edges. More...
 

Static Public Member Functions

static int compare (const ClusterElement &x, const ClusterElement &y)
 Standard Comparer (uses cluster indices). More...
 

Public Attributes

Graph object containers

These containers maintain the nodes and child clusters of the cluster, and provide iterators.

If computed they also provide access to the sorted list of adjacency entries of edges leaving the cluster.

ListContainer< node, ClusterElementnodes
 The container containing the nodes lying (directly) in this cluster. More...
 
ListContainer< cluster, ClusterElementchildren
 The container containing the child clusters (children in the cluster tree) of this cluster. More...
 
ListContainer< adjEntry, ClusterElementadjEntries
 The container containing the sorted list of adjacency entries of edges leaving this cluster. More...
 

Private Member Functions

List< adjEntry > & getAdjEntries ()
 Provides access to the encapsulated list of adjacency entries (for friends of ClusterElement). More...
 
List< cluster > & getChildren ()
 Provides access to the encapsulated list of children (for friends of ClusterElement). More...
 
void getClusterInducedNodes (List< node > &clusterNodes)
 Traverses the inclusion tree and adds nodes to clusterNodes. More...
 
void getClusterInducedNodes (NodeArray< bool > &clusterNode, int &num)
 
List< node > & getNodes ()
 Provides access to the encapsulated list of nodes (for friends of ClusterElement). More...
 

Private Attributes

int m_depth
 The depth of this cluster in the cluster tree. More...
 
int m_id
 The index of this cluster. More...
 
ListIterator< clusterm_it
 The position of this cluster within the children list of its parent. More...
 
cluster m_parent
 The parent of this cluster. More...
 
const ClusterGraphm_pClusterGraph
 
cluster m_pNext
 The postorder successor of this cluster. More...
 
cluster m_pPrev
 The postorder predecessor of this cluster. More...
 
- Private Attributes inherited from ogdf::internal::GraphElement
GraphElementm_next = nullptr
 The successor in the list. More...
 
GraphElementm_prev = nullptr
 The predecessor in the list. More...
 

Friends

class ClusterGraph
 
class internal::GraphList< ClusterElement >
 

Detailed Description

Representation of clusters in a clustered graph.

See also
ClusterGraph

Definition at line 62 of file ClusterGraph.h.

Constructor & Destructor Documentation

◆ ClusterElement()

ogdf::ClusterElement::ClusterElement ( const ClusterGraph pClusterGraph,
int  id 
)
inline

Creates a new cluster element.

Definition at line 123 of file ClusterGraph.h.

Member Function Documentation

◆ cBegin()

ListConstIterator<ClusterElement*> ogdf::ClusterElement::cBegin ( ) const
inline

Returns the first element in the list of child clusters.

Definition at line 216 of file ClusterGraph.h.

◆ cCount()

int ogdf::ClusterElement::cCount ( )
inline

Returns the number of child clusters.

Definition at line 222 of file ClusterGraph.h.

◆ compare()

static int ogdf::ClusterElement::compare ( const ClusterElement x,
const ClusterElement y 
)
inlinestatic

Standard Comparer (uses cluster indices).

Definition at line 239 of file ClusterGraph.h.

◆ crBegin()

ListConstIterator<ClusterElement*> ogdf::ClusterElement::crBegin ( ) const
inline

Returns the last element in the list of child clusters.

Definition at line 219 of file ClusterGraph.h.

◆ depth()

int ogdf::ClusterElement::depth ( ) const
inline

Returns the depth of the cluster in the cluster tree.

Definition at line 150 of file ClusterGraph.h.

◆ firstAdj()

ListConstIterator<adjEntry> ogdf::ClusterElement::firstAdj ( ) const
inline

Returns the first adjacency entry in the list of outgoing edges.

Definition at line 231 of file ClusterGraph.h.

◆ getAdjEntries()

List<adjEntry>& ogdf::ClusterElement::getAdjEntries ( )
inlineprivate

Provides access to the encapsulated list of adjacency entries (for friends of ClusterElement).

Definition at line 110 of file ClusterGraph.h.

◆ getChildren()

List<cluster>& ogdf::ClusterElement::getChildren ( )
inlineprivate

Provides access to the encapsulated list of children (for friends of ClusterElement).

Definition at line 104 of file ClusterGraph.h.

◆ getClusterInducedNodes() [1/2]

void ogdf::ClusterElement::getClusterInducedNodes ( List< node > &  clusterNodes)
private

Traverses the inclusion tree and adds nodes to clusterNodes.

Invoked by public function getClusterNodes(List<node> &clusterNodes).

◆ getClusterInducedNodes() [2/2]

void ogdf::ClusterElement::getClusterInducedNodes ( NodeArray< bool > &  clusterNode,
int &  num 
)
private

◆ getClusterNodes() [1/2]

void ogdf::ClusterElement::getClusterNodes ( List< node > &  clusterNodes)
inline

Returns the list of nodes in the cluster, i.e., all nodes in the subtree rooted at this cluster.

Recursively traverses the cluster tree starting at this cluster.

Definition at line 171 of file ClusterGraph.h.

◆ getClusterNodes() [2/2]

int ogdf::ClusterElement::getClusterNodes ( NodeArray< bool > &  clusterNode)
inline

Sets the entry for each node v to true if v is a member of the subgraph induced by the ClusterElement.

All other entries remain unchanged!

Precondition
clusterNode is a NodeArray initialized on the clustergraph this ClusterElement belongs to.
Returns
the number of entries set to true.

Definition at line 182 of file ClusterGraph.h.

◆ getNodes()

List<node>& ogdf::ClusterElement::getNodes ( )
inlineprivate

Provides access to the encapsulated list of nodes (for friends of ClusterElement).

Definition at line 107 of file ClusterGraph.h.

◆ graphOf()

const ClusterGraph* ogdf::ClusterElement::graphOf ( ) const
inline

Definition at line 142 of file ClusterGraph.h.

◆ index()

int ogdf::ClusterElement::index ( ) const
inline

Returns the (unique) index of the cluster.

Definition at line 147 of file ClusterGraph.h.

◆ isDescendant()

bool ogdf::ClusterElement::isDescendant ( ClusterElement child,
bool  allow_equal = false 
)
inline

Checks whether a cluster child is a descendant (i.e. child, child of a child, ...) of this cluster.

Parameters
childthe cluster that might be a descendant of this
allow_equalwhen not given or false, return false in the case that this == child
Returns
whether child is a descendant of this

Definition at line 194 of file ClusterGraph.h.

◆ lastAdj()

ListConstIterator<adjEntry> ogdf::ClusterElement::lastAdj ( ) const
inline

Returns the last adjacency entry in the list of outgoing edges.

Definition at line 234 of file ClusterGraph.h.

◆ nBegin()

ListConstIterator<node> ogdf::ClusterElement::nBegin ( ) const
inline

Returns the first element in list of child nodes.

Definition at line 225 of file ClusterGraph.h.

◆ nCount()

int ogdf::ClusterElement::nCount ( )
inline

Returns the number of child nodes.

Definition at line 228 of file ClusterGraph.h.

◆ parent()

cluster ogdf::ClusterElement::parent ( )
inline

Returns the parent of the cluster.

Definition at line 153 of file ClusterGraph.h.

◆ pPred()

cluster ogdf::ClusterElement::pPred ( ) const
inline

Returns the postorder predecessor of the cluster in the list of all clusters.

Definition at line 165 of file ClusterGraph.h.

◆ pred()

cluster ogdf::ClusterElement::pred ( ) const
inline

Returns the predecessor of the cluster in the list of all clusters.

Definition at line 159 of file ClusterGraph.h.

◆ pSucc()

cluster ogdf::ClusterElement::pSucc ( ) const
inline

Returns the postorder successor of the cluster in the list of all clusters.

Definition at line 162 of file ClusterGraph.h.

◆ succ()

cluster ogdf::ClusterElement::succ ( ) const
inline

Returns the successor of the cluster in the list of all clusters.

Definition at line 156 of file ClusterGraph.h.

Friends And Related Function Documentation

◆ ClusterGraph

friend class ClusterGraph
friend

Definition at line 63 of file ClusterGraph.h.

◆ internal::GraphList< ClusterElement >

friend class internal::GraphList< ClusterElement >
friend

Definition at line 64 of file ClusterGraph.h.

Member Data Documentation

◆ adjEntries

ListContainer<adjEntry, ClusterElement> ogdf::ClusterElement::adjEntries

The container containing the sorted list of adjacency entries of edges leaving this cluster.

This list is only available (i.e., non-empty) if explicitly computed (e.g., by a cluster-planar embedding algorithm).

Definition at line 87 of file ClusterGraph.h.

◆ children

ListContainer<cluster, ClusterElement> ogdf::ClusterElement::children

The container containing the child clusters (children in the cluster tree) of this cluster.

Definition at line 81 of file ClusterGraph.h.

◆ m_depth

int ogdf::ClusterElement::m_depth
private

The depth of this cluster in the cluster tree.

Definition at line 67 of file ClusterGraph.h.

◆ m_id

int ogdf::ClusterElement::m_id
private

The index of this cluster.

Definition at line 66 of file ClusterGraph.h.

◆ m_it

ListIterator<cluster> ogdf::ClusterElement::m_it
private

The position of this cluster within the children list of its parent.

Definition at line 95 of file ClusterGraph.h.

◆ m_parent

cluster ogdf::ClusterElement::m_parent
private

The parent of this cluster.

Definition at line 92 of file ClusterGraph.h.

◆ m_pClusterGraph

const ClusterGraph* ogdf::ClusterElement::m_pClusterGraph
private

Definition at line 99 of file ClusterGraph.h.

◆ m_pNext

cluster ogdf::ClusterElement::m_pNext
private

The postorder successor of this cluster.

Definition at line 94 of file ClusterGraph.h.

◆ m_pPrev

cluster ogdf::ClusterElement::m_pPrev
private

The postorder predecessor of this cluster.

Definition at line 93 of file ClusterGraph.h.

◆ nodes

ListContainer<node, ClusterElement> ogdf::ClusterElement::nodes

The container containing the nodes lying (directly) in this cluster.

Definition at line 78 of file ClusterGraph.h.


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