72template<
typename TWeight>
81 std::string& error)
override {
83 error =
"The graph must be undirected";
87 error =
"The stretch must be 2.0";
91 error =
"The graph is not simple";
95 error =
"The graph must be unweighted";
121 for (
adjEntry adj : v->adjEntries) {
Declares maximum density subgraph algorithms.
Declaration and implementation of ogdf::NodeSet.
Basic module for spanner algorithms.
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 less(const T &x, const T &y) const
Compare if x is LESS than y for integral types.
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.
Stores additional attributes of a graph (like layout information).
const Graph & constGraph() const
Returns a reference to the associated graph.
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.
virtual void delEdge(edge e) override
Removes edge e.
void init(const Graph &G)
Re-initializes the copy using G.
const Graph & original() const
Returns a reference to the original graph.
void createEmpty(const Graph &G)
Re-initializes the copy using G, but does not create any nodes or edges.
virtual void clear()
Removes all nodes and all edges from the graph.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
edge searchEdge(node v, node w, bool directed=false) const
Searches and returns an edge connecting nodes v and w in time O( min(deg(v ), deg(w ))).
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
ReturnType
The return type of a module.
Class for the representation of nodes.
Approximation multiplicative 2-spanner calculation.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
void addToSpanner(edge e)
Adds e from m_G to the spanner and sets inSpanner.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner) override
Initializes members and create an empty spanner.
GraphCopySimple m_G
The copy of GA.constGraph() to work on. Edges will be removed in each iteration.
virtual SpannerModule< TWeight >::ReturnType execute() override
Executes the core algorithm.
Interface for spanner algorithms.
void assertTimeLeft()
Assert, that time is left.
bool isTimelimitEnabled()
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
bool maximumDensitySubgraph(Graph &G, NodeSet< true > &subgraphNodes, std::function< node(node)> resultNodeMap=[](node v) { return v;}, int64_t timelimit=-1)
Calculates the maximum density subgraph of G.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Declaration of simple graph algorithms.
A simple exception used to exit from the execution, if the timelimit is reached.