44namespace fast_multipole_embedder {
89 template<
typename CoordinateType,
typename LengthType,
typename SizeType>
99 for (
node v : G.nodes) {
109 for (
edge e : G.edges) {
110 pushBackEdge(nodeIndex[e->source()], nodeIndex[e->target()], (
float)edgeLength[e]);
133 template<
typename CoordinateType>
136 for (
node v : G.nodes) {
205 inline uint32_t
twinNodeIndex(uint32_t currEdgeAdjIndex, uint32_t nodeIndex)
const {
211 for (uint32_t i =
begin; i <=
end; i++) {
Datastructures for edge chains itself and the edge chains of nodes.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Class for the representation of edges.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Class for the representation of nodes.
uint32_t twinNodeIndex(uint32_t currEdgeAdjIndex, uint32_t nodeIndex) const
Returns the other node (not nodeIndex) of the pair with index currEdgeAdjIndex.
const float * nodeSize() const
Returns the node size array for all nodes.
float * m_nodeYPos
The y coordinates.
void clear()
Clear the arrays.
float * nodeMoveRadius()
Returns the node movement radius array for all nodes.
double m_desiredAvgEdgeLength
Avg.
float * nodeXPos()
Returns the x coord array for all nodes.
uint32_t numEdges() const
Returns the number of edges.
void writeTo(const Graph &G, NodeArray< CoordinateType > &xPos, NodeArray< CoordinateType > &yPos)
Store the data back to NodeArray arrays with the given coordinate type.
~ArrayGraph()
Destructor. Deallocates the memory via OGDF_FREE_16 if needed.
EdgeAdjInfo & edgeInfo(uint32_t i)
Returns the adjacency information for the edge at index i in m_edgeAdj.
void transform(float translate, float scale)
Transforms all positions via shifting them by translate and afterwards scaling by scale.
float * nodeYPos()
Returns the y coord array for all nodes.
void writeTo(GraphAttributes &GA)
Store the data back in GraphAttributes.
void for_all_nodes(uint32_t begin, uint32_t end, std::function< void(uint32_t)> func)
Calls func on all nodes with indices from begin to end.
void allocate(uint32_t numNodes, uint32_t numEdges)
Allocate all arrays.
uint32_t m_numEdges
Number of edges in the graph.
NodeAdjInfo * m_nodeAdj
Information about adjacent edges.
ArrayGraph()
Constructor. Does not allocate memory for the members.
const float * desiredEdgeLength() const
Returns the edge length array for all edges.
const float * nodeYPos() const
Returns the y coord array for all nodes.
const float * nodeXPos() const
Returns the x coord array for all nodes.
NodeAdjInfo & nodeInfo(uint32_t i)
Returns the adjacency information for the node at index i in m_nodeAdj.
EdgeAdjInfo * edgeInfo()
Returns the EdgeAdjInfo array for all edges.
float * nodeSize()
Returns the node size array for all nodes.
const NodeAdjInfo * nodeInfo() const
Returns the NodeAdjInfo array for all nodes.
void centerGraph()
Transforming all positions such that the new center is at (0,0).
NodeAdjInfo * nodeInfo()
Returns the NodeAdjInfo array for all nodes.
uint32_t m_numNodes
Number of nodes in the graph.
void readFrom(const GraphAttributes &GA, const EdgeArray< float > &edgeLength, const NodeArray< float > &nodeSize)
Updates an ArrayGraph from GraphAttributes with the given edge lengths and node sizes and creates the...
void readFrom(const Graph &G, NodeArray< CoordinateType > &xPos, NodeArray< CoordinateType > &yPos, const EdgeArray< LengthType > &edgeLength, const NodeArray< SizeType > &nodeSize)
Updates an ArrayGraph with the given positions, edge lengths and node sizes and creates the edges.
float * m_desiredEdgeLength
Edge lengths.
const NodeAdjInfo & nodeInfo(uint32_t i) const
Returns the adjacency information for the node at index i in m_nodeAdj.
uint32_t numNodes() const
Returns the number of nodes.
const EdgeAdjInfo & edgeInfo(uint32_t i) const
Returns the adjacency information for the edge at index i in m_edgeAdj.
ArrayGraph(const GraphAttributes &GA, const EdgeArray< float > &edgeLength, const NodeArray< float > &nodeSize)
Constructor.
float * desiredEdgeLength()
Returns the edge length array for all edges.
float avgDesiredEdgeLength() const
Average edge length.
uint32_t nextEdgeAdjIndex(uint32_t currEdgeAdjIndex, uint32_t nodeIndex) const
Returns the index of the next pair of currEdgeAdjIndex of the node with index nodeIndex.
float * m_nodeXPos
The x coordinates.
float avgNodeSize() const
Average node size.
void deallocate()
Deallocate all arrays.
const EdgeAdjInfo * edgeInfo() const
Returns the EdgeAdjInfo array for all edges.
float * m_nodeMoveRadius
Maximum node movement lengths.
void pushBackEdge(uint32_t a, uint32_t b, float desiredEdgeLength)
Internal function used by readFrom.
float * m_nodeSize
Sizes of the nodes.
ArrayGraph(uint32_t maxNumNodes, uint32_t maxNumEdges)
Constructor. Allocates memory via OGDF_MALLOC_16.
uint32_t firstEdgeAdjIndex(uint32_t nodeIndex) const
Returns the index of the first pair of the node with index nodeIndex in m_nodeAdj.
EdgeAdjInfo * m_edgeAdj
Information about adjacent nodes.
Information about an edge (16 bytes).
uint32_t nextEdgeAdjIndex(uint32_t index) const
Returns the index of the next pair of index.
uint32_t twinNode(uint32_t index) const
Returns the other node (not index).
Information about incident edges (16 bytes).
uint32_t firstEntry
The first pair in the edges chain.
uint32_t degree
Total count of pairs where is either the first or second node.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
The namespace for all OGDF objects.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)