Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::Level Class Reference

Representation of levels in hierarchies. More...

#include <ogdf/layered/Level.h>

+ Inheritance diagram for ogdf::Level:

Public Member Functions

 Level (HierarchyLevels *pLevels, int index, int num)
 Creates a level with index index in hierarchy pLevels. More...
 
 ~Level ()
 
const Array< node > & adjNodes (node v) const
 Returns the (sorted) array of adjacent nodes of v (according to direction()). More...
 
int high () const override
 Returns the maximal array index (= size()-1). More...
 
int index () const
 Returns the array index of this level in the hierarchy. More...
 
const HierarchyLevelslevels () const
 Returns the hierarchy to which this level belongs. More...
 
const nodeoperator[] (int i) const override
 Returns the node at position i. More...
 
nodeoperator[] (int i) override
 Returns the node at position i. More...
 
void recalcPos ()
 
int size () const override
 Returns the number of nodes on this level. More...
 
void sort (NodeArray< double > &weight)
 Sorts the nodes according to weight using quicksort. More...
 
void sort (NodeArray< int > &weight, int minBucket, int maxBucket)
 Sorts the nodes according to weight using bucket sort. More...
 
void sortByWeightOnly (NodeArray< double > &weight)
 Sorts the nodes according to weight (without special placement for "isolated" nodes). More...
 
template<class C >
void sortOrder (C &orderComparer)
 Sorts the nodes according to orderComparer. More...
 
void swap (int i, int j)
 Exchanges nodes at position i and j. More...
 
- Public Member Functions inherited from ogdf::LevelBase
virtual ~LevelBase ()
 

Private Member Functions

void getIsolatedNodes (SListPure< Tuple2< node, int >> &isolated) const
 
void setIsolatedNodes (SListPure< Tuple2< node, int >> &isolated)
 

Private Attributes

int m_index
 The index of this level. More...
 
Array< nodem_nodes
 The nodes on this level. More...
 
HierarchyLevelsm_pLevels
 The hierarchy to which this level belongs. More...
 

Friends

class HierarchyLayoutModule
 
class HierarchyLevels
 
class LayerBasedUPRLayout
 
std::ostream & operator<< (std::ostream &os, const Level &L)
 

Detailed Description

Representation of levels in hierarchies.

See also
Hierarchy, SugiyamaLayout

Definition at line 66 of file Level.h.

Constructor & Destructor Documentation

◆ Level()

ogdf::Level::Level ( HierarchyLevels pLevels,
int  index,
int  num 
)
inline

Creates a level with index index in hierarchy pLevels.

Parameters
pLevelsis a pointer to the hierarchy to which the created level will belong.
indexis the index of the level.
numis the number of nodes on this level.

Definition at line 82 of file Level.h.

◆ ~Level()

ogdf::Level::~Level ( )
inline

Definition at line 86 of file Level.h.

Member Function Documentation

◆ adjNodes()

const Array<node>& ogdf::Level::adjNodes ( node  v) const

Returns the (sorted) array of adjacent nodes of v (according to direction()).

◆ getIsolatedNodes()

void ogdf::Level::getIsolatedNodes ( SListPure< Tuple2< node, int >> &  isolated) const
private

◆ high()

int ogdf::Level::high ( ) const
inlineoverridevirtual

Returns the maximal array index (= size()-1).

Implements ogdf::LevelBase.

Definition at line 98 of file Level.h.

◆ index()

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

Returns the array index of this level in the hierarchy.

Definition at line 101 of file Level.h.

◆ levels()

const HierarchyLevels& ogdf::Level::levels ( ) const
inline

Returns the hierarchy to which this level belongs.

Definition at line 107 of file Level.h.

◆ operator[]() [1/2]

const node& ogdf::Level::operator[] ( int  i) const
inlineoverridevirtual

Returns the node at position i.

Implements ogdf::LevelBase.

Definition at line 89 of file Level.h.

◆ operator[]() [2/2]

node& ogdf::Level::operator[] ( int  i)
inlineoverridevirtual

Returns the node at position i.

Implements ogdf::LevelBase.

Definition at line 92 of file Level.h.

◆ recalcPos()

void ogdf::Level::recalcPos ( )

◆ setIsolatedNodes()

void ogdf::Level::setIsolatedNodes ( SListPure< Tuple2< node, int >> &  isolated)
private

◆ size()

int ogdf::Level::size ( ) const
inlineoverridevirtual

Returns the number of nodes on this level.

Implements ogdf::LevelBase.

Definition at line 95 of file Level.h.

◆ sort() [1/2]

void ogdf::Level::sort ( NodeArray< double > &  weight)

Sorts the nodes according to weight using quicksort.

◆ sort() [2/2]

void ogdf::Level::sort ( NodeArray< int > &  weight,
int  minBucket,
int  maxBucket 
)

Sorts the nodes according to weight using bucket sort.

◆ sortByWeightOnly()

void ogdf::Level::sortByWeightOnly ( NodeArray< double > &  weight)

Sorts the nodes according to weight (without special placement for "isolated" nodes).

◆ sortOrder()

template<class C >
void ogdf::Level::sortOrder ( C &  orderComparer)
inline

Sorts the nodes according to orderComparer.

Definition at line 123 of file Level.h.

◆ swap()

void ogdf::Level::swap ( int  i,
int  j 
)

Exchanges nodes at position i and j.

Friends And Related Function Documentation

◆ HierarchyLayoutModule

friend class HierarchyLayoutModule
friend

Definition at line 68 of file Level.h.

◆ HierarchyLevels

friend class HierarchyLevels
friend

Definition at line 67 of file Level.h.

◆ LayerBasedUPRLayout

friend class LayerBasedUPRLayout
friend

Definition at line 69 of file Level.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Level L 
)
friend

Definition at line 130 of file Level.h.

Member Data Documentation

◆ m_index

int ogdf::Level::m_index
private

The index of this level.

Definition at line 73 of file Level.h.

◆ m_nodes

Array<node> ogdf::Level::m_nodes
private

The nodes on this level.

Definition at line 71 of file Level.h.

◆ m_pLevels

HierarchyLevels* ogdf::Level::m_pLevels
private

The hierarchy to which this level belongs.

Definition at line 72 of file Level.h.


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