BFS tree used by both classical algorithms (LT and Dual). More...
#include <ogdf/graphalg/PlanarSeparatorModule.h>
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< node > | getLevel (int level) const |
Returns a level of the tree. More... | |
List< node > | getNodesFrom (int start) const |
Returns all nodes from a given level onwards. More... | |
List< node > | getNodesFromTo (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< node > | getChildrenOfNode (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... | |
GraphCopy * | getGraph () 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< adjEntry > | edgeToParent |
EdgeArray< bool > | inTree |
NodeArray< int > | levelOfNode |
NodeArray< bool > | mark |
NodeArray< node > | parentOfNode |
GraphCopy * | pGraph |
node | root |
BFS tree used by both classical algorithms (LT and Dual).
Definition at line 233 of file PlanarSeparatorModule.h.
ogdf::planar_separators::BFSTreeClassical::BFSTreeClassical | ( | GraphCopy & | G, |
node | rootNode, | ||
unsigned int | heightMaxIterations, | ||
bool | findLevelsSimple = false |
||
) |
Constructor.
G | the graph |
rootNode | node at which tree should be rooted |
heightMaxIterations | how many iterations of tree height maximization to run |
findLevelsSimple | whether the levels should be found using the simple method or not |
|
inline |
Definition at line 246 of file PlanarSeparatorModule.h.
void ogdf::planar_separators::BFSTreeClassical::construct | ( | node | rootNode, |
unsigned int | numIterations | ||
) |
Constructs the tree.
rootNode | the root node at which construction starts in this iteration |
numIterations | how many iterations of tree height maximization to run |
void ogdf::planar_separators::BFSTreeClassical::createNewRoot | ( | bool | useTriBFS = false | ) |
Creates a new root node for the graph, replacing all levels below t0.
useTriBFS | whether to use triangulating BFS or not |
|
protected |
Finds the levels t0 and t2 of the tree that might serve as separators.
This is the original version described by Lipton & Tarjan.
|
protected |
Simplified version of findLevels that simply finds a level smaller than sqrt(n).
|
inline |
Definition at line 329 of file PlanarSeparatorModule.h.
|
inline |
Definition at line 331 of file PlanarSeparatorModule.h.
|
inline |
Definition at line 333 of file PlanarSeparatorModule.h.
Returns a level of the tree.
level | index of the desired level |
Returns all nodes from a given level onwards.
start | index of the start level |
Returns all nodes between two levels.
start | index of the start level |
end | index of the end level |
|
inline |
Definition at line 327 of file PlanarSeparatorModule.h.
int ogdf::planar_separators::BFSTreeClassical::getSizeOfLevel | ( | int | level | ) | const |
Gets the size of a specific level.
level | index of the desired level |
|
inline |
Checks whether a node is visited by BFS.
n | the node |
Definition at line 325 of file PlanarSeparatorModule.h.
void ogdf::planar_separators::BFSTreeClassical::reconstruct | ( | ) |
Reconstructs the tree using triangulating bfs.
void ogdf::planar_separators::BFSTreeClassical::removeSeparatorLevels | ( | List< node > & | separator, |
List< node > & | second | ||
) |
Removes the two separator levels t0 and t2 from the tree.
separator | the list of separator nodes |
second | the second component |
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.
separator | the list of separator nodes |
second | the second component of the separation |
useTriBFS | whether to use triangulating BFS |
|
private |
|
private |
Definition at line 356 of file PlanarSeparatorModule.h.
|
private |
Definition at line 355 of file PlanarSeparatorModule.h.
|
private |
Definition at line 351 of file PlanarSeparatorModule.h.
|
private |
Definition at line 363 of file PlanarSeparatorModule.h.
Definition at line 349 of file PlanarSeparatorModule.h.
|
private |
Definition at line 357 of file PlanarSeparatorModule.h.
|
private |
Definition at line 352 of file PlanarSeparatorModule.h.
|
private |
Definition at line 360 of file PlanarSeparatorModule.h.
|
private |
Definition at line 361 of file PlanarSeparatorModule.h.
|
private |
Definition at line 362 of file PlanarSeparatorModule.h.