|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
51 class GraphCopySimple;
105 template<
typename TWeight>
144 std::string& error)
override {
146 error =
"The graph must be undirected";
150 if (std::modf(stretch, &integralPart) != 0.0) {
151 error =
"The stretch is required to be an integer, not " +
to_string(stretch);
154 int intStretch =
static_cast<int>(stretch);
155 if (intStretch < 1) {
156 error =
"The stretch must be >= 1.0";
159 if (intStretch % 2 == 0) {
160 error =
"The stretch must be odd";
164 error =
"The graph must be unweighted";
217 while (!queue.
empty()) {
219 int distance = bfsNode.
depth + 1;
232 values[u] =
r[u] - distance;
235 if (distance <
m_k) {
246 double maxValue = std::numeric_limits<double>::lowest();
256 if (values[u] != std::numeric_limits<double>::lowest()
258 edge e = firstEdge[u];
261 (*m_inSpanner)[e] =
true;
294 template<
typename TWeight>
static const long edgeIntWeight
Corresponds to edge attribute intWeight(edge).
The namespace for all OGDF objects.
Stores additional attributes of a graph (like layout information).
Declaration of class GraphAttributes which extends a Graph by additional attributes.
A implementation-independed wrapper class to execute a spanner algorithm multiple times.
Compare floating point numbers with epsilons and integral numbers with normal compare operators.
Includes declaration of graph class.
int connectedComponents(const Graph &G, NodeArray< int > &component, List< node > *isolated=nullptr, ArrayBuffer< node > *reprs=nullptr)
Computes the connected components of G and optionally generates a list of isolated nodes.
GraphCopySimple * m_spanner
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
SpannerElkinNeimanIterated()
double m_beta
The parameter for the exponential distribution.
int m_k
the parameter k derived from the stretch
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner)
Initializes members and create an empty spanner.
node n
The current node to visit all neighbors from.
void assertTimeLeft()
Assert, that time is left.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
Declaration and implementation of list-based queues (classes QueuePure<E> and Queue<E>).
Copies of graphs with mapping between nodes and edges.
virtual SpannerModule< TWeight >::ReturnType execute() override
Executes the core algorithm.
bool directed() const
Returns if the graph is directed.
const Graph & constGraph() const
Returns a reference to the associated graph.
bool empty() const
Returns true iff the queue is empty.
iterator emplace(Args &&... args)
Adds a new element at the end of the queue.
Basic module for spanner algorithms.
double m_c
the parameter for the exponential distribution.
Class for adjacency list elements.
int depth
The depth of the node n.
void setEpsilon(double epsilon)
Sets the epsilon for this algorithm.
edge theEdge() const
Returns the edge associated with this adjacency entry.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
int numberOfEdges() const
Returns the number of edges in the graph.
double randomDoubleExponential(double beta)
Returns a random double value from the exponential distribution.
int numberOfNodes() const
Returns the number of nodes in the graph.
Use the ogdf::SpannerIteratedWrapper to execute the ogdf::SpannerElkinNeiman algorithm up to 200 time...
Decralation of GraphElement and GraphList classes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
const Graph * m_G
The original graph.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
BfsNode(node _n, double _depth, edge _p)
Interface for spanner algorithms.
A wrapper class for iterating calls to spanner algorithms.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
SpannerElkinNeiman(double epsilon)
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
Implementation of list-based queues.
Basic declarations, included by all source files.
edge p
The first edge of the path.
int m_intStretch
m_stretch, but as an integer
Randomized multiplicative spanner calculation by propagating random messages through the graph.
const double DEFAULT_EPSILON
The default value for epsilon.
Class for the representation of edges.
EdgeArray< bool > * m_inSpanner
std::enable_if< std::is_integral< T >::value, bool >::type geq(const T &x, const T &y) const
Compare if x is GEQ to y for integral types.
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
E pop()
Removes front element and returns it.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner) override
Initializes members and create an empty spanner.
ReturnType
The return type of a module.
Container::value_type maxValue(const Container &values)
Returns the maximum of an iterable container of given values.
std::string to_string(const std::function< std::ostream &(std::ostream &)> &func)
Class for the representation of nodes.
edge newEdge(edge eOrig)
Creates a new edge in the graph copy with original edge eOrig.
Declaration of simple graph algorithms.
bool has(long attr) const
Returns true iff all attributes in attr are available.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.