Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

WSPD.h
Go to the documentation of this file.
1 
32 #pragma once
33 
36 
37 #include <cstdint>
38 
39 namespace ogdf {
40 namespace fast_multipole_embedder {
41 
43 class WSPD {
44 public:
46 
48  explicit WSPD(uint32_t maxNumNodes);
49 
51  ~WSPD();
52 
54  inline uint32_t maxNumNodes() const { return m_maxNumNodes; }
55 
57  inline uint32_t numWSNodes(NodeID a) const { return m_nodeInfo[a].degree; }
58 
60  inline uint32_t numPairs() const { return m_numPairs; }
61 
63  inline uint32_t maxNumPairs() const { return m_maxNumPairs; }
64 
66  void clear();
67 
69  void addWSP(NodeID a, NodeID b);
70 
72  inline EdgeAdjInfo& pairInfo(uint32_t pairIndex) const { return m_pairs[pairIndex]; }
73 
75  inline NodeAdjInfo& nodeInfo(NodeID nodeID) const { return m_nodeInfo[nodeID]; }
76 
78  inline uint32_t nextPair(uint32_t currPairIndex, NodeID a) const {
79  return pairInfo(currPairIndex).nextEdgeAdjIndex(a);
80  }
81 
83  inline uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const {
84  return pairInfo(currPairIndex).twinNode(a);
85  }
86 
88  inline uint32_t firstPairEntry(NodeID nodeID) const { return m_nodeInfo[nodeID].firstEntry; }
89 
90  // Returns the size excluding small member vars (for profiling only).
91  unsigned long sizeInBytes() const;
92 
93 private:
95  void allocate();
96 
98  void deallocate();
99 
100  uint32_t m_maxNumNodes;
103  uint32_t m_numPairs;
104  uint32_t m_maxNumPairs;
105 };
106 
107 }
108 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::fast_multipole_embedder::LinearQuadtree::NodeID
unsigned int NodeID
Definition: LinearQuadtree.h:55
LinearQuadtree.h
Declaration of class LinearQuadtree.
ogdf::fast_multipole_embedder::EdgeAdjInfo::nextEdgeAdjIndex
uint32_t nextEdgeAdjIndex(uint32_t index) const
Returns the index of the next pair of index.
Definition: EdgeChain.h:67
ogdf::fast_multipole_embedder::EdgeAdjInfo::twinNode
uint32_t twinNode(uint32_t index) const
Returns the other node (not index).
Definition: EdgeChain.h:61
ogdf::fast_multipole_embedder::WSPD::allocate
void allocate()
Allocates all memory.
ogdf::fast_multipole_embedder::NodeAdjInfo
Information about incident edges (16 bytes).
Definition: EdgeChain.h:44
ogdf::fast_multipole_embedder::WSPD
Class for the Well-Separated-Pairs-Decomposition (WSPD)
Definition: WSPD.h:43
ogdf::fast_multipole_embedder::WSPD::m_maxNumNodes
uint32_t m_maxNumNodes
Maximum number of nodes.
Definition: WSPD.h:100
ogdf::fast_multipole_embedder::WSPD::clear
void clear()
Resets the array m_nodeInfo.
ogdf::fast_multipole_embedder::WSPD::wsNodeOfPair
uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const
Returns the other node (not a) of the pair with index currPairIndex.
Definition: WSPD.h:83
ogdf::fast_multipole_embedder::WSPD::m_numPairs
uint32_t m_numPairs
Total number of pairs.
Definition: WSPD.h:103
ogdf::fast_multipole_embedder::WSPD::sizeInBytes
unsigned long sizeInBytes() const
ogdf::fast_multipole_embedder::WSPD::m_nodeInfo
NodeAdjInfo * m_nodeInfo
Array which holds the wspd information for one quadtree node.
Definition: WSPD.h:101
ogdf::fast_multipole_embedder::WSPD::nextPair
uint32_t nextPair(uint32_t currPairIndex, NodeID a) const
Returns the index of the next pair of currPairIndex of the node with index a.
Definition: WSPD.h:78
ogdf::fast_multipole_embedder::NodeAdjInfo::firstEntry
uint32_t firstEntry
The first pair in the edges chain.
Definition: EdgeChain.h:47
ogdf::fast_multipole_embedder::WSPD::~WSPD
~WSPD()
Destructor. Deallocates via OGDF_FREE_16.
ogdf::fast_multipole_embedder::WSPD::numPairs
uint32_t numPairs() const
Returns the total number of pairs.
Definition: WSPD.h:60
ogdf::fast_multipole_embedder::WSPD::maxNumPairs
uint32_t maxNumPairs() const
Returns the maximum number of pairs.
Definition: WSPD.h:63
ogdf::fast_multipole_embedder::WSPD::m_pairs
EdgeAdjInfo * m_pairs
Array containing all pairs.
Definition: WSPD.h:102
ogdf::fast_multipole_embedder::WSPD::NodeID
LinearQuadtree::NodeID NodeID
Definition: WSPD.h:45
EdgeChain.h
Datastructures for edge chains itself and the edge chains of nodes.
ogdf::fast_multipole_embedder::WSPD::deallocate
void deallocate()
Releases all memory.
ogdf::fast_multipole_embedder::WSPD::firstPairEntry
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
Definition: WSPD.h:88
ogdf::fast_multipole_embedder::WSPD::nodeInfo
NodeAdjInfo & nodeInfo(NodeID nodeID) const
Returns the node info for index nodeID.
Definition: WSPD.h:75
ogdf::fast_multipole_embedder::NodeAdjInfo::degree
uint32_t degree
Total count of pairs where is either the first or second node.
Definition: EdgeChain.h:46
ogdf::fast_multipole_embedder::WSPD::maxNumNodes
uint32_t maxNumNodes() const
Returns the maximum number of nodes. Equals the maximum number of nodes in the LinearQuadtree.
Definition: WSPD.h:54
ogdf::fast_multipole_embedder::WSPD::m_maxNumPairs
uint32_t m_maxNumPairs
Upper bound for the number of pairs.
Definition: WSPD.h:104
ogdf::fast_multipole_embedder::EdgeAdjInfo
Information about an edge (16 bytes).
Definition: EdgeChain.h:53
ogdf::fast_multipole_embedder::WSPD::WSPD
WSPD(uint32_t maxNumNodes)
Constructor. Allocates the memory via OGDF_MALLOC_16.
ogdf::fast_multipole_embedder::WSPD::addWSP
void addWSP(NodeID a, NodeID b)
Adds a well separated pair (a, b)
ogdf::fast_multipole_embedder::WSPD::numWSNodes
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
Definition: WSPD.h:57
ogdf::fast_multipole_embedder::WSPD::pairInfo
EdgeAdjInfo & pairInfo(uint32_t pairIndex) const
Returns the pair info for index pairIndex.
Definition: WSPD.h:72