Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

WSPD.h
Go to the documentation of this file.
1 
32 #pragma once
33 
36 
37 namespace ogdf {
38 namespace fast_multipole_embedder {
39 
41 class WSPD
42 {
43 public:
45 
47  explicit WSPD(uint32_t maxNumNodes);
48 
50  ~WSPD();
51 
53  inline uint32_t maxNumNodes() const
54  {
55  return m_maxNumNodes;
56  }
57 
59  inline uint32_t numWSNodes(NodeID a) const
60  {
61  return m_nodeInfo[a].degree;
62  }
63 
65  inline uint32_t numPairs() const
66  {
67  return m_numPairs;
68  }
69 
71  inline uint32_t maxNumPairs() const
72  {
73  return m_maxNumPairs;
74  }
75 
77  void clear();
78 
80  void addWSP(NodeID a, NodeID b);
81 
83  inline EdgeAdjInfo& pairInfo(uint32_t pairIndex) const
84  {
85  return m_pairs[pairIndex];
86  }
87 
89  inline NodeAdjInfo& nodeInfo(NodeID nodeID) const
90  {
91  return m_nodeInfo[nodeID];
92  }
93 
95  inline uint32_t nextPair(uint32_t currPairIndex, NodeID a) const
96  {
97  return pairInfo(currPairIndex).nextEdgeAdjIndex(a);
98  }
99 
101  inline uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const
102  {
103  return pairInfo(currPairIndex).twinNode(a);
104  }
105 
107  inline uint32_t firstPairEntry(NodeID nodeID) const
108  {
109  return m_nodeInfo[nodeID].firstEntry;
110  }
111 
112  // Returns the size excluding small member vars (for profiling only).
113  unsigned long sizeInBytes() const;
114 
115 private:
117  void allocate();
118 
120  void deallocate();
121 
122  uint32_t m_maxNumNodes;
125  uint32_t m_numPairs;
126  uint32_t m_maxNumPairs;
127 };
128 
129 }
130 }
void clear()
Resets the array m_nodeInfo.
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
Definition: WSPD.h:107
uint32_t m_maxNumNodes
Maximum number of nodes.
Definition: WSPD.h:122
WSPD(uint32_t maxNumNodes)
Constructor. Allocates the memory via OGDF_MALLOC_16.
uint32_t m_numPairs
Total number of pairs.
Definition: WSPD.h:125
NodeAdjInfo & nodeInfo(NodeID nodeID) const
Returns the node info for index nodeID.
Definition: WSPD.h:89
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
Definition: WSPD.h:59
Information about incident edges (16 bytes).
Definition: EdgeChain.h:42
~WSPD()
Destructor. Deallocates via OGDF_FREE_16.
uint32_t twinNode(uint32_t index) const
Returns the other node (not index).
Definition: EdgeChain.h:59
EdgeAdjInfo & pairInfo(uint32_t pairIndex) const
Returns the pair info for index pairIndex.
Definition: WSPD.h:83
uint32_t m_maxNumPairs
Upper bound for the number of pairs.
Definition: WSPD.h:126
void allocate()
Allocates all memory.
uint32_t firstEntry
The first pair in the edges chain.
Definition: EdgeChain.h:45
void deallocate()
Releases all memory.
uint32_t wsNodeOfPair(uint32_t currPairIndex, NodeID a) const
Returns the other node (not a) of the pair with index currPairIndex.
Definition: WSPD.h:101
unsigned long sizeInBytes() const
Information about an edge (16 bytes).
Definition: EdgeChain.h:51
uint32_t degree
Total count of pairs where is either the first or second node.
Definition: EdgeChain.h:44
Datastructures for edge chains itself and the edge chains of nodes.
uint32_t maxNumNodes() const
Returns the maximum number of nodes. Equals the maximum number of nodes in the LinearQuadtree.
Definition: WSPD.h:53
Declaration of class LinearQuadtree.
void addWSP(NodeID a, NodeID b)
Adds a well separated pair (a, b)
uint32_t nextEdgeAdjIndex(uint32_t index) const
Returns the index of the next pair of index.
Definition: EdgeChain.h:65
EdgeAdjInfo * m_pairs
Array containing all pairs.
Definition: WSPD.h:124
Class for the Well-Separated-Pairs-Decomposition (WSPD)
Definition: WSPD.h:41
The namespace for all OGDF objects.
LinearQuadtree::NodeID NodeID
Definition: WSPD.h:44
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:95
NodeAdjInfo * m_nodeInfo
Array which holds the wspd information for one quadtree node.
Definition: WSPD.h:123
uint32_t maxNumPairs() const
Returns the maximum number of pairs.
Definition: WSPD.h:71
uint32_t numPairs() const
Returns the total number of pairs.
Definition: WSPD.h:65