|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
83 template<
typename TWeight>
92 std::string& error)
override {
94 error =
"The graph must be undirected";
98 error =
"The stretch must be 2.0";
102 error =
"The graph is not simple";
106 error =
"The graph must be unweighted";
122 node maxNode =
nullptr;
123 double maxDensity = 0.0;
136 if (neighborGraph.
copy(e->
target()) !=
nullptr
137 && neighborGraph.
copy(e->
source()) !=
nullptr) {
144 int64_t timelimit = -1;
146 timelimit = max(
static_cast<int64_t
>(0),
getTimeLeft());
149 neighborGraph, denseSubset,
167 double density = denseSubset.
size() == 0
169 :
static_cast<double>(E_U.
size()) / denseSubset.
size();
171 maxDensity = density;
173 maxDenseSubset = denseSubset;
200 for (
edge e : maxE_U) {
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()
void delEdge(edge e) override
Removes edge e.
virtual bool preconditionsOk(const GraphAttributes &GA, double stretch, std::string &error) override
Compare floating point numbers with epsilons and integral numbers with normal compare operators.
Includes declaration of graph class.
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.
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)
Initializes members and create an empty spanner.
Declares maximum density subgraph algorithms.
const RS::list_type & nodes()
Returns a reference to the list of nodes contained in this set.
virtual void init(const GraphAttributes &GA, double stretch, GraphCopySimple &spanner, EdgeArray< bool > &inSpanner) override
Initializes members and create an empty spanner.
Copies of graphs with mapping between nodes and edges.
int size() const
Returns the number of elements in this set.
void setOriginalGraph(const Graph *G) override
Re-initializes the copy using G (which might be null), but does not create any nodes or edges.
bool directed() const
Returns if the graph is directed.
const Graph & constGraph() const
Returns a reference to the associated graph.
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
Basic module for spanner algorithms.
Class for adjacency list elements.
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.
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.
void init(const Graph &G)
Re-initializes the copy using G, creating copies for all nodes and edges in G.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Decralation of GraphElement and GraphList classes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
GraphCopySimple m_G
The copy of GA.constGraph() to work on. Edges will be removed in each iteration.
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.
bool isMember(element_type v) const
Returns true iff element v is contained in this set.
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.
virtual SpannerModule< TWeight >::ReturnType execute() override
Executes the core algorithm.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
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.
Basic declarations, included by all source files.
const GraphAttributes * m_GA
Class for the representation of edges.
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 ))).
Declaration of doubly linked lists and iterators.
int size() const
Returns the number of elements in the list.
static const long edgeDoubleWeight
Corresponds to edge attribute doubleWeight(edge).
Approximation multiplicative 2-spanner calculation.
node target() const
Returns the target node of the edge.
ReturnType
The return type of a module.
Class for the representation of nodes.
edge newEdge(edge eOrig)
Creates a new edge in the graph copy with original edge eOrig.
bool isSimple(const Graph &G)
Returns true iff G contains neither self-loops nor parallel edges.
Declaration of simple graph algorithms.
bool has(long attr) const
Returns true iff all attributes in attr are available.
iterator pushBack(const E &x)
Adds element x at the end of the list.
const Graph & original() const
Returns a reference to the original graph.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.