94template<
typename TWeight>
133 std::string& error)
override {
135 error =
"The graph must be undirected";
140 error =
"The stretch is required to be an integer, not " + to_string(
m_stretch);
145 error =
"The stretch must be >= 1.0";
149 error =
"The stretch must be odd";
153 error =
"The graph must be unweighted";
166 m_G = &
GA.constGraph();
204 queue.emplace(x, 0,
nullptr);
206 while (!
queue.empty()) {
211 node u = adj->twinNode();
224 if (distance <
m_k) {
225 queue.emplace(u, distance, p);
235 double maxValue = std::numeric_limits<double>::lowest();
245 if (
values[u] != std::numeric_limits<double>::lowest()
247 edge e = firstEdge[u];
250 (*m_inSpanner)[e] =
true;
283template<
typename TWeight>
A wrapper class for iterating calls to spanner algorithms.
Basic module for spanner algorithms.
Declaration and implementation of list-based queues (classes QueuePure<E> and Queue<E>).
Class for adjacency list elements.
Dynamic arrays indexed with edges.
Class for the representation of edges.
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.
Stores additional attributes of a graph (like layout information).
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
static const long edgeIntWeight
Corresponds to edge attribute intWeight(edge).
Copies of graphs with mapping between nodes and edges.
edge newEdge(edge eOrig)
Creates a new edge in the graph copy with original edge eOrig.
Data type for general directed graphs (adjacency list representation).
int numberOfNodes() const
Returns the number of nodes in the graph.
int numberOfEdges() const
Returns the number of edges in the graph.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
ReturnType
The return type of a module.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
Implementation of list-based queues.
Randomized multiplicative spanner calculation by propagating random messages through the graph.
int m_intStretch
m_stretch, but as an integer
double m_c
the parameter for the exponential distribution.
double m_beta
The parameter for the exponential distribution.
virtual SpannerModule< TWeight >::ReturnType execute() override
Executes the core algorithm.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner) override
Initializes members and create an empty spanner.
int m_k
the parameter k derived from the stretch
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
void setEpsilon(double epsilon)
Sets the epsilon for this algorithm.
const Graph * m_G
The original graph.
const double DEFAULT_EPSILON
The default value for epsilon.
SpannerElkinNeiman(double epsilon)
Use the ogdf::SpannerIteratedWrapper to execute the ogdf::SpannerElkinNeiman algorithm up to 200 time...
SpannerElkinNeimanIterated()
A implementation-independed wrapper class to execute a spanner algorithm multiple times.
Interface for spanner algorithms.
void assertTimeLeft()
Assert, that time is left.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner)
Initializes members and create an empty spanner.
const GraphAttributes * m_GA
EdgeArray< bool > * m_inSpanner
GraphCopySimple * m_spanner
int connectedComponents(const Graph &G, NodeArray< int > &component, List< node > *isolated=nullptr)
Computes the connected components of G and optionally generates a list of isolated nodes.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
double randomDoubleExponential(double beta)
Returns a random double value from the exponential distribution.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
The namespace for all OGDF objects.
Declaration of simple graph algorithms.
edge p
The first edge of the path.
BfsNode(node _n, double _depth, edge _p)
node n
The current node to visit all neighbors from.
int depth
The depth of the node n.