Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition Class Reference

#include <ogdf/graphalg/SteinerTreePreprocessing.h>

Public Member Functions

 HeavyPathDecomposition (const EdgeWeightedGraphCopy< T > &treeEWGraphCopy)
 
T getBottleneckSteinerDistance (node x, node y) const
 computes in the bottleneck distance between terminals x and y More...
 
node lowestCommonAncestor (node x, node y) const
 computes the lowest common ancestor of nodes x and y using the hpd More...
 

Private Member Functions

node binarySearchUpmostTerminal (node v, const std::vector< node > &chainOfTerminals) const
 performs a binary search on chainOfTerminals, searches for the closest node to the root on chainOfTerminals that sits below v More...
 
void buildMaxSegmentTree (std::vector< T > &segmentTree, const int nodeIndex, const int left, const int right, const std::vector< T > &baseArray) const
 builds a max segment tree on the baseArray More...
 
void computeBottleneckOnBranch (node x, node ancestor, T &longestPathDistance, T &fromLowestToAncestor) const
 computes for the path from x to ancestor the maximum distance (sum of edges) between any two consecutive terminals using the hpd updates it in longestPathDistance also puts in fromLowestToAncestor the sum of edges from the last terminal found to the ancestor (the last terminal is special since its Steiner ancestor is ancestor for ancestor as well, so we would consider a wrong part of the path More...
 
void computeLongestDistToSteinerAncestorOnChain ()
 creates for every chain an array with the maximum of every prefix of a fictive array which keeps for every node the sum of the edges on the path from it to its closest terminal ancestor More...
 
void computeLongestDistToSteinerAncestorSegTree ()
 creates for every chain a segment tree built on a fictive array which keeps for every node the sum of the edges on the path from it to its closest terminal ancestor More...
 
void dfsHeavyPathDecomposition (node v, node closestSteinerUpNode)
 performs the heavy path decomposition on the tree belonging to the class updates the fields of the class More...
 
T distanceToAncestor (node v, node ancestor) const
 computes the sum of all edges on the path from v to ancestor v must be in ancestor's subtree More...
 
T getMaxSegmentTree (const std::vector< T > &segmentTree, const int nodeIndex, const int left, const int right, const int queryLeft, const int queryRight) const
 extracts the maximum on the required interval More...
 

Private Attributes

NodeArray< int > chainOfNode
 the index of a node's chain More...
 
std::vector< std::vector< node > > chains
 list of chains of nodes corresponding to the decomposition More...
 
std::vector< std::vector< node > > chainsOfTerminals
 list of chains only of terminals corresponding to the decomposition More...
 
NodeArray< node > closestSteinerAncestor
 the highest-level Steiner ancestor of the current node More...
 
NodeArray< T > distanceToRoot
 the length of the edge to his father More...
 
std::vector< node > fatherOfChain
 the first node from bottom up that does not belong to the chain More...
 
const NodeArray< bool > isTerminal
 isTerminal of the desc tree More...
 
std::vector< std::vector< T > > longestDistToSteinerAncestorOnChain
 the max of the interval 0..i for every i on chains More...
 
std::vector< std::vector< T > > longestDistToSteinerAncestorSegTree
 segment tree for segment maxs on every chain More...
 
NodeArray< int > nodeLevel
 the level of a node in the tree More...
 
NodeArray< int > positionOnChain
 position of a node on his chain More...
 
List< node > terminals
 list of terminals of the desc tree More...
 
const EdgeWeightedGraphCopy< T > & tree
 constant ref to the tree to be decomposed More...
 
NodeArray< int > weightOfSubtree
 weight of the subtree rooted in one node More...
 

Detailed Description

template<typename T>
class ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition

Definition at line 804 of file SteinerTreePreprocessing.h.

Constructor & Destructor Documentation

◆ HeavyPathDecomposition()

template<typename T >
ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::HeavyPathDecomposition ( const EdgeWeightedGraphCopy< T > &  treeEWGraphCopy)
inline

Definition at line 1045 of file SteinerTreePreprocessing.h.

Member Function Documentation

◆ binarySearchUpmostTerminal()

template<typename T >
node ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::binarySearchUpmostTerminal ( node  v,
const std::vector< node > &  chainOfTerminals 
) const
inlineprivate

performs a binary search on chainOfTerminals, searches for the closest node to the root on chainOfTerminals that sits below v

  • Time: O(log n)

Definition at line 981 of file SteinerTreePreprocessing.h.

◆ buildMaxSegmentTree()

template<typename T >
void ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::buildMaxSegmentTree ( std::vector< T > &  segmentTree,
const int  nodeIndex,
const int  left,
const int  right,
const std::vector< T > &  baseArray 
) const
inlineprivate

builds a max segment tree on the baseArray

  • Time: O(n)

Definition at line 827 of file SteinerTreePreprocessing.h.

◆ computeBottleneckOnBranch()

template<typename T >
void ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::computeBottleneckOnBranch ( node  x,
node  ancestor,
T &  longestPathDistance,
T &  fromLowestToAncestor 
) const
inlineprivate

computes for the path from x to ancestor the maximum distance (sum of edges) between any two consecutive terminals using the hpd updates it in longestPathDistance also puts in fromLowestToAncestor the sum of edges from the last terminal found to the ancestor (the last terminal is special since its Steiner ancestor is ancestor for ancestor as well, so we would consider a wrong part of the path

  • Time: O(log n)

Definition at line 1009 of file SteinerTreePreprocessing.h.

◆ computeLongestDistToSteinerAncestorOnChain()

template<typename T >
void ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::computeLongestDistToSteinerAncestorOnChain ( )
inlineprivate

creates for every chain an array with the maximum of every prefix of a fictive array which keeps for every node the sum of the edges on the path from it to its closest terminal ancestor

Definition at line 892 of file SteinerTreePreprocessing.h.

◆ computeLongestDistToSteinerAncestorSegTree()

template<typename T >
void ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::computeLongestDistToSteinerAncestorSegTree ( )
inlineprivate

creates for every chain a segment tree built on a fictive array which keeps for every node the sum of the edges on the path from it to its closest terminal ancestor

Definition at line 911 of file SteinerTreePreprocessing.h.

◆ dfsHeavyPathDecomposition()

template<typename T >
void ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::dfsHeavyPathDecomposition ( node  v,
node  closestSteinerUpNode 
)
inlineprivate

performs the heavy path decomposition on the tree belonging to the class updates the fields of the class

Definition at line 931 of file SteinerTreePreprocessing.h.

◆ distanceToAncestor()

template<typename T >
T ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::distanceToAncestor ( node  v,
node  ancestor 
) const
inlineprivate

computes the sum of all edges on the path from v to ancestor v must be in ancestor's subtree

Definition at line 879 of file SteinerTreePreprocessing.h.

◆ getBottleneckSteinerDistance()

template<typename T >
T ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::getBottleneckSteinerDistance ( node  x,
node  y 
) const
inline

computes in the bottleneck distance between terminals x and y

  • Time: O(log n)

Definition at line 1101 of file SteinerTreePreprocessing.h.

◆ getMaxSegmentTree()

template<typename T >
T ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::getMaxSegmentTree ( const std::vector< T > &  segmentTree,
const int  nodeIndex,
const int  left,
const int  right,
const int  queryLeft,
const int  queryRight 
) const
inlineprivate

extracts the maximum on the required interval

  • Time: O(log n)

Definition at line 847 of file SteinerTreePreprocessing.h.

◆ lowestCommonAncestor()

template<typename T >
node ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::lowestCommonAncestor ( node  x,
node  y 
) const
inline

computes the lowest common ancestor of nodes x and y using the hpd

  • Time: O(log n)

Definition at line 1078 of file SteinerTreePreprocessing.h.

Member Data Documentation

◆ chainOfNode

template<typename T >
NodeArray<int> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::chainOfNode
private

the index of a node's chain

Definition at line 812 of file SteinerTreePreprocessing.h.

◆ chains

template<typename T >
std::vector<std::vector<node> > ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::chains
private

list of chains of nodes corresponding to the decomposition

Definition at line 810 of file SteinerTreePreprocessing.h.

◆ chainsOfTerminals

template<typename T >
std::vector<std::vector<node> > ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::chainsOfTerminals
private

list of chains only of terminals corresponding to the decomposition

Definition at line 811 of file SteinerTreePreprocessing.h.

◆ closestSteinerAncestor

template<typename T >
NodeArray<node> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::closestSteinerAncestor
private

the highest-level Steiner ancestor of the current node

Definition at line 817 of file SteinerTreePreprocessing.h.

◆ distanceToRoot

template<typename T >
NodeArray<T> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::distanceToRoot
private

the length of the edge to his father

Definition at line 816 of file SteinerTreePreprocessing.h.

◆ fatherOfChain

template<typename T >
std::vector<node> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::fatherOfChain
private

the first node from bottom up that does not belong to the chain

Definition at line 818 of file SteinerTreePreprocessing.h.

◆ isTerminal

template<typename T >
const NodeArray<bool> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::isTerminal
private

isTerminal of the desc tree

Definition at line 808 of file SteinerTreePreprocessing.h.

◆ longestDistToSteinerAncestorOnChain

template<typename T >
std::vector<std::vector<T> > ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::longestDistToSteinerAncestorOnChain
private

the max of the interval 0..i for every i on chains

Definition at line 820 of file SteinerTreePreprocessing.h.

◆ longestDistToSteinerAncestorSegTree

template<typename T >
std::vector<std::vector<T> > ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::longestDistToSteinerAncestorSegTree
private

segment tree for segment maxs on every chain

Definition at line 821 of file SteinerTreePreprocessing.h.

◆ nodeLevel

template<typename T >
NodeArray<int> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::nodeLevel
private

the level of a node in the tree

Definition at line 815 of file SteinerTreePreprocessing.h.

◆ positionOnChain

template<typename T >
NodeArray<int> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::positionOnChain
private

position of a node on his chain

Definition at line 813 of file SteinerTreePreprocessing.h.

◆ terminals

template<typename T >
List<node> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::terminals
private

list of terminals of the desc tree

Definition at line 807 of file SteinerTreePreprocessing.h.

◆ tree

template<typename T >
const EdgeWeightedGraphCopy<T>& ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::tree
private

constant ref to the tree to be decomposed

Definition at line 806 of file SteinerTreePreprocessing.h.

◆ weightOfSubtree

template<typename T >
NodeArray<int> ogdf::SteinerTreePreprocessing< T >::HeavyPathDecomposition::weightOfSubtree
private

weight of the subtree rooted in one node

Definition at line 814 of file SteinerTreePreprocessing.h.


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