Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::planar_separators::BFSTreeClassical Class Reference

BFS tree used by both classical algorithms (LT and Dual). More...

#include <ogdf/graphalg/PlanarSeparatorModule.h>

+ Inheritance diagram for ogdf::planar_separators::BFSTreeClassical:

Public Member Functions

 BFSTreeClassical (GraphCopy &G, node rootNode, unsigned int heightMaxIterations, bool findLevelsSimple=false)
 Constructor. More...
 
 ~BFSTreeClassical ()
 
void construct (node rootNode, unsigned int numIterations)
 Constructs the tree. More...
 
void createNewRoot (bool useTriBFS=false)
 Creates a new root node for the graph, replacing all levels below t0. More...
 
int get_t0 () const
 
int get_t1 () const
 
int get_t2 () const
 
List< nodegetLevel (int level) const
 Returns a level of the tree. More...
 
List< nodegetNodesFrom (int start) const
 Returns all nodes from a given level onwards. More...
 
List< nodegetNodesFromTo (int start, int end) const
 Returns all nodes between two levels. More...
 
int getSeparatorLevel () const
 
int getSizeOfLevel (int level) const
 Gets the size of a specific level. More...
 
bool isVisited (node n) const
 Checks whether a node is visited by BFS. More...
 
void reconstruct ()
 Reconstructs the tree using triangulating bfs. More...
 
void removeSeparatorLevels (List< node > &separator, List< node > &second)
 Removes the two separator levels t0 and t2 from the tree. More...
 
void restructure (List< node > &separator, List< node > &second, bool useTriBFS=false)
 Restructures the tree by adding a new root and deleting all nodes below t0 and above t2, adding all nodes that are removed to the second component and keeping levels t0 and t2 in the separator. More...
 
- Public Member Functions inherited from ogdf::planar_separators::ArrayBFSTree
 ArrayBFSTree (GraphCopy &G, node rootNode)
 Constructor. More...
 
adjEntry getAdjToParent (node n) const override
 Returns the adjEntry that leads up to the parent of n. More...
 
List< nodegetChildrenOfNode (node n) const override
 Returns all (immediate) children of a node. More...
 
int getDescendantsOfNode (node n) const override
 Returns the total number of children, grandchildren etc. More...
 
GraphCopygetGraph () const override
 Allows access to a copy of the graph. More...
 
int getGraphSize () const override
 Gets the number of nodes of the graph. More...
 
int getLevelOfNode (node n) const override
 Returns the level (=depth in the tree) for a node. More...
 
node getParentOfNode (node n) const override
 Returns the node that is the parent of n in the tree. More...
 
node getRoot () const override
 Gets the current root node of the tree. More...
 
void init ()
 Initializes all internal arrays. More...
 
bool isInTree (edge e) const override
 Checks if an edge is a tree-edge. More...
 
- Public Member Functions inherited from ogdf::planar_separators::BFSTree
virtual ~BFSTree ()=default
 

Protected Member Functions

void findLevels ()
 Finds the levels t0 and t2 of the tree that might serve as separators. More...
 
void findLevelsSimple ()
 Simplified version of findLevels that simply finds a level smaller than sqrt(n). More...
 

Private Member Functions

void visit (node v, node parent, adjEntry adj, SListPure< node > &bfs)
 

Private Attributes

bool belowMiddle = true
 
int currentLevel = 0
 
unsigned int heightMaxIterations
 
int k
 
List< List< node > > levels
 
double m_ratio
 
bool simple
 
int t0
 
int t1
 
int t2
 

Additional Inherited Members

- Protected Attributes inherited from ogdf::planar_separators::ArrayBFSTree
NodeArray< List< node > > childrenOfNode
 
NodeArray< int > descendantsOfNode
 
NodeArray< adjEntryedgeToParent
 
EdgeArray< bool > inTree
 
NodeArray< int > levelOfNode
 
NodeArray< bool > mark
 
NodeArray< nodeparentOfNode
 
GraphCopypGraph
 
node root
 

Detailed Description

BFS tree used by both classical algorithms (LT and Dual).

Definition at line 233 of file PlanarSeparatorModule.h.

Constructor & Destructor Documentation

◆ BFSTreeClassical()

ogdf::planar_separators::BFSTreeClassical::BFSTreeClassical ( GraphCopy G,
node  rootNode,
unsigned int  heightMaxIterations,
bool  findLevelsSimple = false 
)

Constructor.

Parameters
Gthe graph
rootNodenode at which tree should be rooted
heightMaxIterationshow many iterations of tree height maximization to run
findLevelsSimplewhether the levels should be found using the simple method or not

◆ ~BFSTreeClassical()

ogdf::planar_separators::BFSTreeClassical::~BFSTreeClassical ( )
inline

Definition at line 246 of file PlanarSeparatorModule.h.

Member Function Documentation

◆ construct()

void ogdf::planar_separators::BFSTreeClassical::construct ( node  rootNode,
unsigned int  numIterations 
)

Constructs the tree.

Parameters
rootNodethe root node at which construction starts in this iteration
numIterationshow many iterations of tree height maximization to run

◆ createNewRoot()

void ogdf::planar_separators::BFSTreeClassical::createNewRoot ( bool  useTriBFS = false)

Creates a new root node for the graph, replacing all levels below t0.

Parameters
useTriBFSwhether to use triangulating BFS or not

◆ findLevels()

void ogdf::planar_separators::BFSTreeClassical::findLevels ( )
protected

Finds the levels t0 and t2 of the tree that might serve as separators.

This is the original version described by Lipton & Tarjan.

◆ findLevelsSimple()

void ogdf::planar_separators::BFSTreeClassical::findLevelsSimple ( )
protected

Simplified version of findLevels that simply finds a level smaller than sqrt(n).

◆ get_t0()

int ogdf::planar_separators::BFSTreeClassical::get_t0 ( ) const
inline

Definition at line 329 of file PlanarSeparatorModule.h.

◆ get_t1()

int ogdf::planar_separators::BFSTreeClassical::get_t1 ( ) const
inline

Definition at line 331 of file PlanarSeparatorModule.h.

◆ get_t2()

int ogdf::planar_separators::BFSTreeClassical::get_t2 ( ) const
inline

Definition at line 333 of file PlanarSeparatorModule.h.

◆ getLevel()

List<node> ogdf::planar_separators::BFSTreeClassical::getLevel ( int  level) const

Returns a level of the tree.

Parameters
levelindex of the desired level
Returns
List of nodes in that level

◆ getNodesFrom()

List<node> ogdf::planar_separators::BFSTreeClassical::getNodesFrom ( int  start) const

Returns all nodes from a given level onwards.

Parameters
startindex of the start level
Returns
all nodes from this level on

◆ getNodesFromTo()

List<node> ogdf::planar_separators::BFSTreeClassical::getNodesFromTo ( int  start,
int  end 
) const

Returns all nodes between two levels.

Parameters
startindex of the start level
endindex of the end level
Returns
a list containing all nodes between levels start and end

◆ getSeparatorLevel()

int ogdf::planar_separators::BFSTreeClassical::getSeparatorLevel ( ) const
inline

Definition at line 327 of file PlanarSeparatorModule.h.

◆ getSizeOfLevel()

int ogdf::planar_separators::BFSTreeClassical::getSizeOfLevel ( int  level) const

Gets the size of a specific level.

Parameters
levelindex of the desired level
Returns
the number of nodes in that level

◆ isVisited()

bool ogdf::planar_separators::BFSTreeClassical::isVisited ( node  n) const
inline

Checks whether a node is visited by BFS.

Parameters
nthe node
Returns
true if this node was visited

Definition at line 325 of file PlanarSeparatorModule.h.

◆ reconstruct()

void ogdf::planar_separators::BFSTreeClassical::reconstruct ( )

Reconstructs the tree using triangulating bfs.

◆ removeSeparatorLevels()

void ogdf::planar_separators::BFSTreeClassical::removeSeparatorLevels ( List< node > &  separator,
List< node > &  second 
)

Removes the two separator levels t0 and t2 from the tree.

Parameters
separatorthe list of separator nodes
secondthe second component

◆ restructure()

void ogdf::planar_separators::BFSTreeClassical::restructure ( List< node > &  separator,
List< node > &  second,
bool  useTriBFS = false 
)

Restructures the tree by adding a new root and deleting all nodes below t0 and above t2, adding all nodes that are removed to the second component and keeping levels t0 and t2 in the separator.

Parameters
separatorthe list of separator nodes
secondthe second component of the separation
useTriBFSwhether to use triangulating BFS

◆ visit()

void ogdf::planar_separators::BFSTreeClassical::visit ( node  v,
node  parent,
adjEntry  adj,
SListPure< node > &  bfs 
)
private

Member Data Documentation

◆ belowMiddle

bool ogdf::planar_separators::BFSTreeClassical::belowMiddle = true
private

Definition at line 356 of file PlanarSeparatorModule.h.

◆ currentLevel

int ogdf::planar_separators::BFSTreeClassical::currentLevel = 0
private

Definition at line 355 of file PlanarSeparatorModule.h.

◆ heightMaxIterations

unsigned int ogdf::planar_separators::BFSTreeClassical::heightMaxIterations
private

Definition at line 351 of file PlanarSeparatorModule.h.

◆ k

int ogdf::planar_separators::BFSTreeClassical::k
private

Definition at line 363 of file PlanarSeparatorModule.h.

◆ levels

List<List<node> > ogdf::planar_separators::BFSTreeClassical::levels
private

Definition at line 349 of file PlanarSeparatorModule.h.

◆ m_ratio

double ogdf::planar_separators::BFSTreeClassical::m_ratio
private

Definition at line 357 of file PlanarSeparatorModule.h.

◆ simple

bool ogdf::planar_separators::BFSTreeClassical::simple
private

Definition at line 352 of file PlanarSeparatorModule.h.

◆ t0

int ogdf::planar_separators::BFSTreeClassical::t0
private

Definition at line 360 of file PlanarSeparatorModule.h.

◆ t1

int ogdf::planar_separators::BFSTreeClassical::t1
private

Definition at line 361 of file PlanarSeparatorModule.h.

◆ t2

int ogdf::planar_separators::BFSTreeClassical::t2
private

Definition at line 362 of file PlanarSeparatorModule.h.


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