61template<
typename TWeight>
73 std::string& error)
override {
75 error =
"The graph must be undirected";
80 error =
"The stretch is required to be an integer, not " + to_string(
m_stretch);
85 error =
"The stretch must be >= 1.0";
89 error =
"The stretch must be odd";
141 int k = (
static_cast<int>(
m_stretch) + 1) / 2;
175 edge e = a->theEdge();
208 if (
A[center] !=
nullptr
225 v->allAdjEntries(
adjs);
268 edge e = a->theEdge();
277 if (
A[center] !=
nullptr) {
285 while ((a = v->firstAdj()) !=
nullptr) {
311template<
typename TWeight>
Declaration and implementation of ogdf::NodeSet.
A wrapper class for iterating calls to spanner algorithms.
Basic module for spanner algorithms.
Class for adjacency list elements.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Dynamic arrays indexed with edges.
Class for the representation of edges.
node target() const
Returns the target node of the edge.
node source() const
Returns the source node of the edge.
std::enable_if< std::is_integral< T >::value, bool >::type less(const T &x, const T &y) const
Compare if x is LESS than y for integral types.
Stores additional attributes of a graph (like layout information).
const Graph & constGraph() const
Returns a reference to the associated graph.
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.
virtual void delEdge(edge e) override
Removes edge e.
node copy(node v) const
Returns the node in the graph copy corresponding to v.
void init(const Graph &G)
Re-initializes the copy using G.
const Graph & original() const
Returns a reference to the original graph.
int numberOfNodes() const
Returns the number of nodes in the graph.
virtual void clear()
Removes all nodes and all edges from the graph.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
ReturnType
The return type of a module.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
Randomized multiplicative spanner calculation by forming clusters.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
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.
NodeArray< node > m_cluster
the current cluster for each iteration in phase 1 and the final cluster from phase 1 which is used in...
GraphCopySimple m_G
The copy of GA.constGraph() to work on. Edges will be removed in each iteration.
void phase2()
Phase 2: Vertex-Cluster Joining.
void phase1()
Phase 1: Forming clusters.
void addToSpanner(edge e)
Adds e from m_G to the spanner and sets inSpanner.
Use the ogdf::SpannerIteratedWrapper to execute the ogdf::SpannerBaswanaSen algorithm up to 1000 time...
SpannerBaswanaSenIterated()
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
static TWeight getWeight(const GraphAttributes &GA, edge e)
GraphCopySimple * m_spanner
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
double randomDouble(double low, double high)
Returns a random double value from the interval [low, high).
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.