|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
62 template<
typename TWeight>
94 init(GA, stretch, spanner, inSpanner);
152 for (
node n : G.nodes) {
214 template<
typename TWeight>
224 template<
typename TWeight>
236 for (
edge e : G.edges) {
242 apspSpanner(GA, spanner, newDistances);
245 for (
edge e : G.edges) {
248 TWeight originalDistance = originalDistances[u][v];
249 TWeight newDistance = newDistances[spanner.
copy(u)][spanner.
copy(v)];
250 if (m_eps.
greater(
static_cast<double>(newDistance), stretch * originalDistance)) {
int64_t milliSeconds() const
Returns the currently elapsed time in milliseconds.
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.
bool isTimelimitEnabled()
Compare floating point numbers with epsilons and integral numbers with normal compare operators.
Includes declaration of graph class.
void start(bool reset=false)
Starts the stopwatch.
edge copy(edge e) const override
Returns the edge in the graph copy corresponding to e.
GraphCopySimple * m_spanner
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
int64_t m_timelimit
Timelimit in milliseconds.
static bool isMultiplicativeSpanner(const GraphAttributes &GA, const GraphCopySimple &spanner, double stretch)
Validates a spanner.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner)
Initializes members and create an empty spanner.
StopwatchCPU m_watch
Used for keeping track of time.
void assertTimeLeft()
Assert, that time is left.
Copies of graphs with mapping between nodes and edges.
void setOriginalGraph(const Graph *G) override
Re-initializes the copy using G (which might be null), but does not create any nodes or edges.
Implements a stopwatch measuring CPU time.
const Graph & constGraph() const
Returns a reference to the associated graph.
TWeight getWeight(edge e, const EdgeArray< TWeight > &weights)
Helper function to get the edge weight of e from the EdgeArray weights.
@ TimeoutInfeasible
The solution is not feasible due to a timeout.
void setTimelimit(int64_t milliseconds)
Sets the timelimit for the algorithm in milliseconds.
SpannerModule()
Initializes a spanner module.
int numberOfNodes() const
Returns the number of nodes in the graph.
Decralation of GraphElement and GraphList classes.
Declaration of stopwatch classes.
node source() const
Returns the source node of the edge.
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
Declaration of graph copy classes.
double dijkstra_SPAP(const GraphAttributes &GA, NodeArray< NodeArray< TCost >> &shortestPathMatrix)
Computes all-pairs shortest paths in GA using Dijkstra's algorithm.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
Interface for spanner algorithms.
std::enable_if< std::is_integral< T >::value, bool >::type greater(const T &x, const T &y) const
Compare if x is GREATER than y for integral types.
void clear() override
Removes all nodes and edges from this copy but does not break the link with the original graph.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
void stop()
Stops the stopwatch and adds the difference between the current time and the starting time to the tot...
Basic declarations, included by all source files.
Declaration of several shortest path algorithms.
const GraphAttributes * m_GA
virtual ReturnType call(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner)
Executes the algorithm.
Class for the representation of edges.
EdgeArray< bool > * m_inSpanner
int intWeight(edge e) const
Returns the (integer) weight of edge e.
Declares base class for all module types.
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
double doubleWeight(edge e) const
Returns the (real number) weight of edge e.
node target() const
Returns the target node of the edge.
ReturnType
The return type of a module.
virtual ReturnType execute()=0
Executes the core algorithm.
Class for the representation of nodes.
static void apspSpanner(const GraphAttributes &GA, const GraphCopySimple &spanner, NodeArray< NodeArray< TWeight >> &shortestPathMatrix)
Calculates an all-pair shortest-path on spanner with the weights given by GA.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error)=0
bool has(long attr) const
Returns true iff all attributes in attr are available.
const Graph & original() const
Returns a reference to the original graph.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
static TWeight getWeight(const GraphAttributes &GA, edge e)