55template<
typename TWeight>
60 std::string& error)
override {
62 error =
"The graph is not simple";
66 error =
"The stretch must be >= 1.0";
77 if (G.numberOfNodes() == 0) {
91 GC.
insert(ccsInfo, c, nodeMap, edgeMap);
111 int64_t timeLeft = max(
getTimeLeft(),
static_cast<int64_t
>(0));
123 (*m_inSpanner)[eOrig] =
true;
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of graph copy classes.
Decralation of GraphElement and GraphList classes.
Implementation of an k-spanner approximation algorithm from Berman et al.
Basic module for spanner algorithms.
Class for the representation of edges.
Info structure for maintaining connected components.
int numberOfCCs() const
Returns the number of connected components.
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).
void addAttributes(long attr)
Enables attributes specified by attr and allocates required memory.
bool has(long attr) const
Returns true iff all attributes in attr are available.
static const long edgeIntWeight
Corresponds to edge attribute intWeight(edge).
const Graph & original() const
Returns a reference to the original 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.
void setOriginalGraph(const Graph *G) override
Re-initializes the copy using G (which might be null), but does not create any nodes or edges.
Data type for general directed graphs (adjacency list representation).
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
std::pair< int, int > insert(const NI &nodesBegin, const NI &nodesEnd, const EI &edgesBegin, const EI &edgesEnd, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given subgraph into this graph.
ReturnType
The return type of a module.
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()
virtual ReturnType call(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner)
Executes the algorithm.
const GraphAttributes * m_GA
EdgeArray< bool > * m_inSpanner
void setTimelimit(int64_t milliseconds)
Sets the timelimit for the algorithm in milliseconds.
static TWeight getWeight(const GraphAttributes &GA, edge e)
GraphCopySimple * m_spanner
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
The namespace for all OGDF objects.
Declaration of simple graph algorithms.