Hierarchical graph representation used by GlobalSifting and GridSifting algorithms. More...
#include <ogdf/layered/BlockOrder.h>
Public Member Functions | |
BlockOrder (Hierarchy &hierarchy, bool longEdgesOnly=true) | |
~BlockOrder () | |
int | blocksCount () |
Returns the number of blocks. | |
void | globalSifting (int rho=1, int nRepeats=10, int *pNumCrossings=nullptr) |
Calls the global sifting algorithm on graph (its hierarchy). | |
HierarchyLevelsBase members | |
const ArrayLevel & | operator[] (int i) const override |
Returns the i-th level. | |
int | pos (node v) const override |
Returns the position of node v on its level. | |
int | size () const override |
Returns the number of levels. | |
const Hierarchy & | hierarchy () const override |
const Array< node > & | adjNodes (node v, TraversingDir dir) const override |
Returns the adjacent nodes of v . | |
Public Member Functions inherited from ogdf::HierarchyLevelsBase | |
HierarchyLevelsBase ()=default | |
HierarchyLevelsBase (const HierarchyLevelsBase &)=default | |
virtual | ~HierarchyLevelsBase () |
int | calculateCrossings () const |
Computes the total number of crossings. | |
int | calculateCrossings (int i) const |
Computes the number of crossings between level i and i+1 . | |
virtual int | high () const |
Returns the maximal array index of a level (= size()-1). | |
HierarchyLevelsBase & | operator= (const HierarchyLevelsBase &)=default |
Private Types | |
enum class | Direction { Plus , Minus } |
Private Member Functions | |
void | buildAdjNodes () |
Builds lists of adjacent nodes (needed by HierarchyLevelsBase). | |
void | buildDummyNodesLists () |
Builds list of dummy nodes laying inside edge blocks. | |
void | buildHierarchy () |
Builds arrays that allow using BlockOrder as HierarchyLevelsBase implementation. | |
void | buildLevels () |
Builds levels of vertices from original graph. | |
void | deconstruct () |
Deletes levels and blocks owned by this instance of BlockOrder. | |
void | doInit (bool longEdgesOnly=true) |
Does some initialization. | |
int | siftingStep (Block *blockOfA) |
Performs sifting for a single block. | |
int | siftingSwap (Block *blockOfA, Block *blockOfB) |
Swaps two consecutive blocks. | |
void | sortAdjacencies () |
Creates sorted lists of neighbours for all blocks. | |
void | updateAdjacencies (Block *blockOfA, Block *blockOfB, Direction d) |
Updates adjacencies lists before swaping two blocks. | |
int | uswap (Block *blockOfA, Block *blockOfB, Direction d, int level) |
Calculates change of crossings made by a single swap. | |
Private Attributes | |
int | m_activeBlocksCount |
int | m_bestCrossings |
The lowest number of crossing found in the sifting step. | |
Array< int > | m_bestPerm |
The best found permutation in the sifting step. | |
Array< Block * > | m_Blocks |
The array of all blocks. | |
Array< int > | m_currentPerm |
The permutation modified in the sifting step. | |
Array< int > | m_currentPermInv |
Inversion of m_currenPerm. | |
EdgeArray< Block * > | m_EdgeBlocks |
The array of all edge blocks. | |
GraphCopy | m_GC |
The graph copy representing the topology of the proper hierarchy. | |
Hierarchy & | m_hierarchy |
The hierarchy on grid- and globalsifting operates. | |
EdgeArray< bool > | m_isActiveEdge |
Stores information about active edge blocks. | |
Array< ArrayLevel * > | m_levels |
The array of all levels. | |
NodeArray< Array< node > > | m_lowerAdjNodes |
(Sorted) adjacent nodes on lower level. | |
NodeArray< Block * > | m_NodeBlocks |
The array of all vertex blocks. | |
NodeArray< int > | m_nSet |
(Only used by buildAdjNodes().) | |
NodeArray< int > | m_pos |
The position of a node on its level. | |
NodeArray< int > | m_ranks |
The rank (level) of a node. | |
int | m_storedCrossings |
Numebr of crossings stored in the sifting step. | |
Array< int > | m_storedPerm |
The permutation from which the sifting step starts. | |
NodeArray< Array< node > > | m_upperAdjNodes |
(Sorted) adjacent nodes on upper level. | |
GridSifting | |
Array< int > | m_nNodesOnLvls |
int | m_verticalStepsBound |
int | verticalSwap (Block *b, int level) |
Moves block to next level. | |
int | localCountCrossings (const Array< int > &levels) |
Only used in verticalSwap(). | |
void | verticalStep (Block *b) |
Performs vertical step for block b. | |
void | gridSifting (int nRepeats=10) |
Calls the grid sifting algorithm on a graph (its hierarchy). | |
Additional Inherited Members | |
Public Types inherited from ogdf::HierarchyLevelsBase | |
enum class | TraversingDir { downward , upward } |
Hierarchical graph representation used by GlobalSifting and GridSifting algorithms.
This representation is based on blocks. Each block is a single vertex from the original graph or edge that consists of some dummy vertices in hierarchical embedding of this graph.
BlockOrder stores permutation of blocks (their x-coordinates) and uses this information in translation to Hierarchy and HierarchyLevelsBase.
Definition at line 122 of file BlockOrder.h.
|
strongprivate |
Enumerator | |
---|---|
Plus | |
Minus |
Definition at line 124 of file BlockOrder.h.
|
inline |
Definition at line 197 of file BlockOrder.h.
|
inlineoverridevirtual |
Returns the adjacent nodes of v
.
Implements ogdf::HierarchyLevelsBase.
Definition at line 186 of file BlockOrder.h.
|
inline |
Returns the number of blocks.
Definition at line 200 of file BlockOrder.h.
|
private |
Builds lists of adjacent nodes (needed by HierarchyLevelsBase).
|
private |
Builds list of dummy nodes laying inside edge blocks.
|
inlineprivate |
Builds arrays that allow using BlockOrder as HierarchyLevelsBase implementation.
Definition at line 276 of file BlockOrder.h.
|
private |
Builds levels of vertices from original graph.
|
private |
Deletes levels and blocks owned by this instance of BlockOrder.
void ogdf::BlockOrder::globalSifting | ( | int | rho = 1 , |
int | nRepeats = 10 , |
||
int * | pNumCrossings = nullptr |
||
) |
Calls the global sifting algorithm on graph (its hierarchy).
Calls the grid sifting algorithm on a graph (its hierarchy).
Implements ogdf::HierarchyLevelsBase.
Definition at line 183 of file BlockOrder.h.
Only used in verticalSwap().
|
inlineoverridevirtual |
Returns the i-th level.
Implements ogdf::HierarchyLevelsBase.
Definition at line 175 of file BlockOrder.h.
Returns the position of node v
on its level.
Implements ogdf::HierarchyLevelsBase.
Definition at line 178 of file BlockOrder.h.
Performs sifting for a single block.
See SIFTING-STEP in papers.
Swaps two consecutive blocks.
See SIFTING-STEP in papers.
|
inlineoverridevirtual |
Returns the number of levels.
Implements ogdf::HierarchyLevelsBase.
Definition at line 181 of file BlockOrder.h.
|
private |
Creates sorted lists of neighbours for all blocks.
See function SORT-ADJACENCIES in paper.
|
private |
Updates adjacencies lists before swaping two blocks.
Updates adjacencies lists of two blocks and their neighbours in direction d
. This function is called before blocks are swapped. See UPDATE-ADJACENCIES in papers.
Calculates change of crossings made by a single swap.
Calculates change in number of crossing after swapping two consecutive blocks in current permutation. See USWAP in papers.
Performs vertical step for block b.
See VERTICAL-STEP in papers.
|
private |
Definition at line 155 of file BlockOrder.h.
|
private |
The lowest number of crossing found in the sifting step.
Definition at line 139 of file BlockOrder.h.
The best found permutation in the sifting step.
Definition at line 133 of file BlockOrder.h.
The array of all blocks.
Definition at line 146 of file BlockOrder.h.
The permutation modified in the sifting step.
Definition at line 132 of file BlockOrder.h.
Inversion of m_currenPerm.
Definition at line 136 of file BlockOrder.h.
The array of all edge blocks.
Definition at line 148 of file BlockOrder.h.
|
private |
The graph copy representing the topology of the proper hierarchy.
Definition at line 126 of file BlockOrder.h.
|
private |
The hierarchy on grid- and globalsifting operates.
Definition at line 157 of file BlockOrder.h.
Stores information about active edge blocks.
Definition at line 150 of file BlockOrder.h.
|
private |
The array of all levels.
Definition at line 163 of file BlockOrder.h.
(Sorted) adjacent nodes on lower level.
Definition at line 165 of file BlockOrder.h.
Definition at line 301 of file BlockOrder.h.
The array of all vertex blocks.
Definition at line 147 of file BlockOrder.h.
(Only used by buildAdjNodes().)
Definition at line 168 of file BlockOrder.h.
The position of a node on its level.
Definition at line 161 of file BlockOrder.h.
The rank (level) of a node.
Definition at line 128 of file BlockOrder.h.
|
private |
Numebr of crossings stored in the sifting step.
Definition at line 138 of file BlockOrder.h.
The permutation from which the sifting step starts.
Definition at line 131 of file BlockOrder.h.
(Sorted) adjacent nodes on upper level.
Definition at line 166 of file BlockOrder.h.
int ogdf::BlockOrder::m_verticalStepsBound |
Definition at line 304 of file BlockOrder.h.