47template<
typename TWeight>
52 std::string& error)
override {
54 error =
"The graph is not simple";
58 error =
"The stretch must be >= 1.0";
69 if (G.numberOfNodes() == 0) {
82 for (
node n : G.nodes) {
122 (*m_inSpanner)[
eOrig] =
true;
Implementation of an k-spanner approximation algorithm from Berman et al.
Basic module for spanner algorithms.
Dynamic arrays indexed with edges.
Class for the representation of edges.
Stores additional attributes of a graph (like layout information).
int intWeight(edge e) const
Returns the (integer) weight of edge e.
bool directed() const
Returns if the graph is directed.
const Graph & constGraph() const
Returns a reference to the associated graph.
double doubleWeight(edge e) const
Returns the (real number) weight of edge e.
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
bool has(long attr) const
Returns true iff all attributes in attr are available.
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.
void createEmpty(const Graph &G)
Re-initializes the copy using G, but does not create any nodes or edges.
Data type for general directed graphs (adjacency list representation).
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
iterator begin()
Returns an iterator to the first element of the list.
ReturnType
The return type of a module.
Dynamic arrays indexed with nodes.
Class for the representation of nodes.
Wrapper around SpannerBerman: For each component of the graph, the algorithm will be called.
virtual SpannerModule< TWeight >::ReturnType execute() override
Executes the core algorithm.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
Approximation algorithm for calculating spanners.
Interface for spanner algorithms.
void assertTimeLeft()
Assert, that time is left.
bool isTimelimitEnabled()
const GraphAttributes * m_GA
EdgeArray< bool > * m_inSpanner
static TWeight getWeight(const GraphAttributes &GA, edge e)
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.
void inducedSubGraph(const Graph &G, LISTITERATOR start, Graph &subGraph)
Computes the subgraph induced by a list of nodes.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Declaration of simple graph algorithms.