Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
WSPD.h
Go to the documentation of this file.
1
32#pragma once
33
36
37#include <cstdint>
38
39namespace ogdf {
40namespace fast_multipole_embedder {
41
43class WSPD {
44public:
46
48 explicit WSPD(uint32_t maxNumNodes);
49
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
93private:
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}
Datastructures for edge chains itself and the edge chains of nodes.
Declaration of class LinearQuadtree.
Information about an edge (16 bytes).
Definition EdgeChain.h:53
uint32_t nextEdgeAdjIndex(uint32_t index) const
Returns the index of the next pair of index.
Definition EdgeChain.h:67
uint32_t twinNode(uint32_t index) const
Returns the other node (not index).
Definition EdgeChain.h:61
Information about incident edges (16 bytes).
Definition EdgeChain.h:44
uint32_t firstEntry
The first pair in the edges chain.
Definition EdgeChain.h:47
uint32_t degree
Total count of pairs where is either the first or second node.
Definition EdgeChain.h:46
Class for the Well-Separated-Pairs-Decomposition (WSPD)
Definition WSPD.h:43
uint32_t maxNumNodes() const
Returns the maximum number of nodes. Equals the maximum number of nodes in the LinearQuadtree.
Definition WSPD.h:54
NodeAdjInfo * m_nodeInfo
Array which holds the wspd information for one quadtree node.
Definition WSPD.h:101
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
void deallocate()
Releases all memory.
uint32_t m_numPairs
Total number of pairs.
Definition WSPD.h:103
~WSPD()
Destructor. Deallocates via OGDF_FREE_16.
uint32_t maxNumPairs() const
Returns the maximum number of pairs.
Definition WSPD.h:63
EdgeAdjInfo * m_pairs
Array containing all pairs.
Definition WSPD.h:102
uint32_t m_maxNumNodes
Maximum number of nodes.
Definition WSPD.h:100
unsigned long sizeInBytes() const
uint32_t m_maxNumPairs
Upper bound for the number of pairs.
Definition WSPD.h:104
void clear()
Resets the array m_nodeInfo.
LinearQuadtree::NodeID NodeID
Definition WSPD.h:45
void addWSP(NodeID a, NodeID b)
Adds a well separated pair (a, b)
uint32_t firstPairEntry(NodeID nodeID) const
Returns the index of the first pair of node nodeID.
Definition WSPD.h:88
WSPD(uint32_t maxNumNodes)
Constructor. Allocates the memory via OGDF_MALLOC_16.
NodeAdjInfo & nodeInfo(NodeID nodeID) const
Returns the node info for index nodeID.
Definition WSPD.h:75
EdgeAdjInfo & pairInfo(uint32_t pairIndex) const
Returns the pair info for index pairIndex.
Definition WSPD.h:72
uint32_t numWSNodes(NodeID a) const
Returns the number of well separated nodes for node a.
Definition WSPD.h:57
void allocate()
Allocates 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:83
uint32_t numPairs() const
Returns the total number of pairs.
Definition WSPD.h:60
The namespace for all OGDF objects.