Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::fast_multipole_embedder::ArrayGraph Class Reference

#include <ogdf/energybased/fast_multipole_embedder/ArrayGraph.h>

Public Member Functions

 ArrayGraph ()
 Constructor. Does not allocate memory for the members. More...
 
 ArrayGraph (const GraphAttributes &GA, const EdgeArray< float > &edgeLength, const NodeArray< float > &nodeSize)
 Constructor. More...
 
 ArrayGraph (uint32_t maxNumNodes, uint32_t maxNumEdges)
 Constructor. Allocates memory via OGDF_MALLOC_16. More...
 
 ~ArrayGraph ()
 Destructor. Deallocates the memory via OGDF_FREE_16 if needed. More...
 
float avgDesiredEdgeLength () const
 Average edge length. More...
 
float avgNodeSize () const
 Average node size. More...
 
void centerGraph ()
 Transforming all positions such that the new center is at (0,0). More...
 
float * desiredEdgeLength ()
 Returns the edge length array for all edges. More...
 
const float * desiredEdgeLength () const
 Returns the edge length array for all edges. More...
 
EdgeAdjInfoedgeInfo ()
 Returns the EdgeAdjInfo array for all edges. More...
 
const EdgeAdjInfoedgeInfo () const
 Returns the EdgeAdjInfo array for all edges. More...
 
EdgeAdjInfoedgeInfo (uint32_t i)
 Returns the adjacency information for the edge at index i in m_edgeAdj. More...
 
const EdgeAdjInfoedgeInfo (uint32_t i) const
 Returns the adjacency information for the edge at index i in m_edgeAdj. More...
 
uint32_t firstEdgeAdjIndex (uint32_t nodeIndex) const
 Returns the index of the first pair of the node with index nodeIndex in m_nodeAdj. More...
 
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. More...
 
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. More...
 
NodeAdjInfonodeInfo ()
 Returns the NodeAdjInfo array for all nodes. More...
 
const NodeAdjInfonodeInfo () const
 Returns the NodeAdjInfo array for all nodes. More...
 
NodeAdjInfonodeInfo (uint32_t i)
 Returns the adjacency information for the node at index i in m_nodeAdj. More...
 
const NodeAdjInfonodeInfo (uint32_t i) const
 Returns the adjacency information for the node at index i in m_nodeAdj. More...
 
float * nodeMoveRadius ()
 Returns the node movement radius array for all nodes. More...
 
float * nodeSize ()
 Returns the node size array for all nodes. More...
 
const float * nodeSize () const
 Returns the node size array for all nodes. More...
 
float * nodeXPos ()
 Returns the x coord array for all nodes. More...
 
const float * nodeXPos () const
 Returns the x coord array for all nodes. More...
 
float * nodeYPos ()
 Returns the y coord array for all nodes. More...
 
const float * nodeYPos () const
 Returns the y coord array for all nodes. More...
 
uint32_t numEdges () const
 Returns the number of edges. More...
 
uint32_t numNodes () const
 Returns the number of nodes. More...
 
template<typename CoordinateType , typename LengthType , typename SizeType >
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. More...
 
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 edges. More...
 
void transform (float translate, float scale)
 Transforms all positions via shifting them by translate and afterwards scaling by scale. More...
 
uint32_t twinNodeIndex (uint32_t currEdgeAdjIndex, uint32_t nodeIndex) const
 Returns the other node (not nodeIndex) of the pair with index currEdgeAdjIndex. More...
 
template<typename CoordinateType >
void writeTo (const Graph &G, NodeArray< CoordinateType > &xPos, NodeArray< CoordinateType > &yPos)
 Store the data back to NodeArray arrays with the given coordinate type. More...
 
void writeTo (GraphAttributes &GA)
 Store the data back in GraphAttributes. More...
 

Private Member Functions

void allocate (uint32_t numNodes, uint32_t numEdges)
 Allocate all arrays. More...
 
void clear ()
 Clear the arrays. More...
 
void deallocate ()
 Deallocate all arrays. More...
 
void pushBackEdge (uint32_t a, uint32_t b, float desiredEdgeLength)
 Internal function used by readFrom. More...
 

Private Attributes

double m_avgNodeSize
 Avg. More...
 
double m_desiredAvgEdgeLength
 Avg. More...
 
float * m_desiredEdgeLength
 Edge lengths. More...
 
EdgeAdjInfom_edgeAdj
 Information about adjacent nodes. More...
 
NodeAdjInfom_nodeAdj
 Information about adjacent edges. More...
 
float * m_nodeMoveRadius
 Maximum node movement lengths. More...
 
float * m_nodeSize
 Sizes of the nodes. More...
 
float * m_nodeXPos
 The x coordinates. More...
 
float * m_nodeYPos
 The y coordinates. More...
 
uint32_t m_numEdges
 Number of edges in the graph. More...
 
uint32_t m_numNodes
 Number of nodes in the graph. More...
 

Detailed Description

Definition at line 46 of file ArrayGraph.h.

Constructor & Destructor Documentation

◆ ArrayGraph() [1/3]

ogdf::fast_multipole_embedder::ArrayGraph::ArrayGraph ( )

Constructor. Does not allocate memory for the members.

◆ ArrayGraph() [2/3]

ogdf::fast_multipole_embedder::ArrayGraph::ArrayGraph ( uint32_t  maxNumNodes,
uint32_t  maxNumEdges 
)

Constructor. Allocates memory via OGDF_MALLOC_16.

◆ ArrayGraph() [3/3]

ogdf::fast_multipole_embedder::ArrayGraph::ArrayGraph ( const GraphAttributes GA,
const EdgeArray< float > &  edgeLength,
const NodeArray< float > &  nodeSize 
)

Constructor.

◆ ~ArrayGraph()

ogdf::fast_multipole_embedder::ArrayGraph::~ArrayGraph ( )

Destructor. Deallocates the memory via OGDF_FREE_16 if needed.

Member Function Documentation

◆ allocate()

void ogdf::fast_multipole_embedder::ArrayGraph::allocate ( uint32_t  numNodes,
uint32_t  numEdges 
)
private

Allocate all arrays.

◆ avgDesiredEdgeLength()

float ogdf::fast_multipole_embedder::ArrayGraph::avgDesiredEdgeLength ( ) const
inline

Average edge length.

Definition at line 217 of file ArrayGraph.h.

◆ avgNodeSize()

float ogdf::fast_multipole_embedder::ArrayGraph::avgNodeSize ( ) const
inline

Average node size.

Definition at line 220 of file ArrayGraph.h.

◆ centerGraph()

void ogdf::fast_multipole_embedder::ArrayGraph::centerGraph ( )

Transforming all positions such that the new center is at (0,0).

◆ clear()

void ogdf::fast_multipole_embedder::ArrayGraph::clear ( )
inlineprivate

Clear the arrays.

Definition at line 239 of file ArrayGraph.h.

◆ deallocate()

void ogdf::fast_multipole_embedder::ArrayGraph::deallocate ( )
private

Deallocate all arrays.

◆ desiredEdgeLength() [1/2]

float* ogdf::fast_multipole_embedder::ArrayGraph::desiredEdgeLength ( )
inline

Returns the edge length array for all edges.

Definition at line 189 of file ArrayGraph.h.

◆ desiredEdgeLength() [2/2]

const float* ogdf::fast_multipole_embedder::ArrayGraph::desiredEdgeLength ( ) const
inline

Returns the edge length array for all edges.

Definition at line 192 of file ArrayGraph.h.

◆ edgeInfo() [1/4]

EdgeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::edgeInfo ( )
inline

Returns the EdgeAdjInfo array for all edges.

Definition at line 162 of file ArrayGraph.h.

◆ edgeInfo() [2/4]

const EdgeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::edgeInfo ( ) const
inline

Returns the EdgeAdjInfo array for all edges.

Definition at line 165 of file ArrayGraph.h.

◆ edgeInfo() [3/4]

EdgeAdjInfo& ogdf::fast_multipole_embedder::ArrayGraph::edgeInfo ( uint32_t  i)
inline

Returns the adjacency information for the edge at index i in m_edgeAdj.

Definition at line 150 of file ArrayGraph.h.

◆ edgeInfo() [4/4]

const EdgeAdjInfo& ogdf::fast_multipole_embedder::ArrayGraph::edgeInfo ( uint32_t  i) const
inline

Returns the adjacency information for the edge at index i in m_edgeAdj.

Definition at line 153 of file ArrayGraph.h.

◆ firstEdgeAdjIndex()

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::firstEdgeAdjIndex ( uint32_t  nodeIndex) const
inline

Returns the index of the first pair of the node with index nodeIndex in m_nodeAdj.

Definition at line 195 of file ArrayGraph.h.

◆ for_all_nodes()

void ogdf::fast_multipole_embedder::ArrayGraph::for_all_nodes ( uint32_t  begin,
uint32_t  end,
std::function< void(uint32_t)>  func 
)
inline

Calls func on all nodes with indices from begin to end.

Definition at line 210 of file ArrayGraph.h.

◆ nextEdgeAdjIndex()

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::nextEdgeAdjIndex ( uint32_t  currEdgeAdjIndex,
uint32_t  nodeIndex 
) const
inline

Returns the index of the next pair of currEdgeAdjIndex of the node with index nodeIndex.

Definition at line 200 of file ArrayGraph.h.

◆ nodeInfo() [1/4]

NodeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::nodeInfo ( )
inline

Returns the NodeAdjInfo array for all nodes.

Definition at line 156 of file ArrayGraph.h.

◆ nodeInfo() [2/4]

const NodeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::nodeInfo ( ) const
inline

Returns the NodeAdjInfo array for all nodes.

Definition at line 159 of file ArrayGraph.h.

◆ nodeInfo() [3/4]

NodeAdjInfo& ogdf::fast_multipole_embedder::ArrayGraph::nodeInfo ( uint32_t  i)
inline

Returns the adjacency information for the node at index i in m_nodeAdj.

Definition at line 144 of file ArrayGraph.h.

◆ nodeInfo() [4/4]

const NodeAdjInfo& ogdf::fast_multipole_embedder::ArrayGraph::nodeInfo ( uint32_t  i) const
inline

Returns the adjacency information for the node at index i in m_nodeAdj.

Definition at line 147 of file ArrayGraph.h.

◆ nodeMoveRadius()

float* ogdf::fast_multipole_embedder::ArrayGraph::nodeMoveRadius ( )
inline

Returns the node movement radius array for all nodes.

Definition at line 186 of file ArrayGraph.h.

◆ nodeSize() [1/2]

float* ogdf::fast_multipole_embedder::ArrayGraph::nodeSize ( )
inline

Returns the node size array for all nodes.

Definition at line 180 of file ArrayGraph.h.

◆ nodeSize() [2/2]

const float* ogdf::fast_multipole_embedder::ArrayGraph::nodeSize ( ) const
inline

Returns the node size array for all nodes.

Definition at line 183 of file ArrayGraph.h.

◆ nodeXPos() [1/2]

float* ogdf::fast_multipole_embedder::ArrayGraph::nodeXPos ( )
inline

Returns the x coord array for all nodes.

Definition at line 168 of file ArrayGraph.h.

◆ nodeXPos() [2/2]

const float* ogdf::fast_multipole_embedder::ArrayGraph::nodeXPos ( ) const
inline

Returns the x coord array for all nodes.

Definition at line 171 of file ArrayGraph.h.

◆ nodeYPos() [1/2]

float* ogdf::fast_multipole_embedder::ArrayGraph::nodeYPos ( )
inline

Returns the y coord array for all nodes.

Definition at line 174 of file ArrayGraph.h.

◆ nodeYPos() [2/2]

const float* ogdf::fast_multipole_embedder::ArrayGraph::nodeYPos ( ) const
inline

Returns the y coord array for all nodes.

Definition at line 177 of file ArrayGraph.h.

◆ numEdges()

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::numEdges ( ) const
inline

Returns the number of edges.

Definition at line 65 of file ArrayGraph.h.

◆ numNodes()

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::numNodes ( ) const
inline

Returns the number of nodes.

Definition at line 62 of file ArrayGraph.h.

◆ pushBackEdge()

void ogdf::fast_multipole_embedder::ArrayGraph::pushBackEdge ( uint32_t  a,
uint32_t  b,
float  desiredEdgeLength 
)
private

Internal function used by readFrom.

◆ readFrom() [1/2]

template<typename CoordinateType , typename LengthType , typename SizeType >
void ogdf::fast_multipole_embedder::ArrayGraph::readFrom ( const Graph G,
NodeArray< CoordinateType > &  xPos,
NodeArray< CoordinateType > &  yPos,
const EdgeArray< LengthType > &  edgeLength,
const NodeArray< SizeType > &  nodeSize 
)
inline

Updates an ArrayGraph with the given positions, edge lengths and node sizes and creates the edges.

The nodes and edges are ordered in the same way like in the Graph instance.

Parameters
Gthe Graph to traverse
xPosthe x coordinate for each node
yPosthe y coordinate for each node
nodeSizethe x coordinate for each node in G
edgeLengththe desired edge length for each edge
Template Parameters
CoordinateTypetype of the x and y positions
LengthTypetype of the edge lengths
SizeTypetype of the node sizes

Definition at line 90 of file ArrayGraph.h.

◆ readFrom() [2/2]

void ogdf::fast_multipole_embedder::ArrayGraph::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 edges.

The nodes and edges are ordered in the same way like in the Graph instance.

Parameters
GAthe GraphAttributes to read from
edgeLengththe desired edge length
nodeSizethe size of the nodes

◆ transform()

void ogdf::fast_multipole_embedder::ArrayGraph::transform ( float  translate,
float  scale 
)

Transforms all positions via shifting them by translate and afterwards scaling by scale.

◆ twinNodeIndex()

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::twinNodeIndex ( uint32_t  currEdgeAdjIndex,
uint32_t  nodeIndex 
) const
inline

Returns the other node (not nodeIndex) of the pair with index currEdgeAdjIndex.

Definition at line 205 of file ArrayGraph.h.

◆ writeTo() [1/2]

template<typename CoordinateType >
void ogdf::fast_multipole_embedder::ArrayGraph::writeTo ( const Graph G,
NodeArray< CoordinateType > &  xPos,
NodeArray< CoordinateType > &  yPos 
)
inline

Store the data back to NodeArray arrays with the given coordinate type.

The function does not require to be the same Graph, only the order of nodes and edges is important

Parameters
Gthe graph containing all nodes
xPosthe x coordinate array to update
yPosthe y coordinate array to update
Template Parameters
CoordinateTypetype of the x and y positions

Definition at line 134 of file ArrayGraph.h.

◆ writeTo() [2/2]

void ogdf::fast_multipole_embedder::ArrayGraph::writeTo ( GraphAttributes GA)

Store the data back in GraphAttributes.

The function does not require to be the same Graph, only the order of nodes and edges is important

Parameters
GAthe GraphAttributes to update

Member Data Documentation

◆ m_avgNodeSize

double ogdf::fast_multipole_embedder::ArrayGraph::m_avgNodeSize
private

Avg.

node size.

Definition at line 255 of file ArrayGraph.h.

◆ m_desiredAvgEdgeLength

double ogdf::fast_multipole_embedder::ArrayGraph::m_desiredAvgEdgeLength
private

Avg.

edge length.

Definition at line 260 of file ArrayGraph.h.

◆ m_desiredEdgeLength

float* ogdf::fast_multipole_embedder::ArrayGraph::m_desiredEdgeLength
private

Edge lengths.

Definition at line 259 of file ArrayGraph.h.

◆ m_edgeAdj

EdgeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::m_edgeAdj
private

Information about adjacent nodes.

Definition at line 263 of file ArrayGraph.h.

◆ m_nodeAdj

NodeAdjInfo* ogdf::fast_multipole_embedder::ArrayGraph::m_nodeAdj
private

Information about adjacent edges.

Definition at line 262 of file ArrayGraph.h.

◆ m_nodeMoveRadius

float* ogdf::fast_multipole_embedder::ArrayGraph::m_nodeMoveRadius
private

Maximum node movement lengths.

Definition at line 257 of file ArrayGraph.h.

◆ m_nodeSize

float* ogdf::fast_multipole_embedder::ArrayGraph::m_nodeSize
private

Sizes of the nodes.

Definition at line 254 of file ArrayGraph.h.

◆ m_nodeXPos

float* ogdf::fast_multipole_embedder::ArrayGraph::m_nodeXPos
private

The x coordinates.

Definition at line 251 of file ArrayGraph.h.

◆ m_nodeYPos

float* ogdf::fast_multipole_embedder::ArrayGraph::m_nodeYPos
private

The y coordinates.

Definition at line 252 of file ArrayGraph.h.

◆ m_numEdges

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::m_numEdges
private

Number of edges in the graph.

Definition at line 249 of file ArrayGraph.h.

◆ m_numNodes

uint32_t ogdf::fast_multipole_embedder::ArrayGraph::m_numNodes
private

Number of nodes in the graph.

Definition at line 248 of file ArrayGraph.h.


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