|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
58 template<
typename T =
double>
63 return call(G, weights);
68 m_minCut = std::numeric_limits<T>::max();
99 inPartition[v] =
true;
103 for (
adjEntry adj : v->adjEntries) {
104 if (!inPartition[adj->
twinNode()]) {
167 m_contractedNodes[t].conc(m_contractedNodes(s));
171 edge e = adj->theEdge();
172 if (e->source() == t || e->target() == t) {
174 }
else if (e->source() == s) {
175 m_GC.moveSource(e, t);
177 m_GC.moveTarget(e, t);
187 node v {adj->twinNode()};
189 edge e {adj->theEdge()};
190 edge& f {incident[v]};
215 for (
node v : m_GC.nodes) {
218 std::function<void(
node)> updatePQ {[&](
node currentNode) {
220 for (
adjEntry adj : currentNode->adjEntries) {
240 while (!pq.
empty()) {
250 updatePQ(currentNode);
255 for (
adjEntry adj : t->adjEntries) {
257 if (!e->isSelfLoop()) {
258 phaseCut += m_w[adj->
theEdge()];
264 if (phaseCut < m_minCut) {
266 for (
node v : m_contractedNodes[t]) {
The namespace for all OGDF objects.
Declaration and implementation of ArrayBuffer class.
Includes declaration of graph class.
virtual T value() const override
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void pop()
Removes the topmost element from the queue.
bool empty() const
Returns true if the buffer is empty, false otherwise.
T minimumCutPhase()
Computes and returns the value of the minimum cut of the current phase (iteration).
Priority queue interface wrapping various heaps.
void push(const E &element, const P &priority)
Adds a new element to the queue.
EdgeArray< T > m_w
An EdgeArray containing the corresponding edge weights.
Serves as an interface for various methods to compute minimum cuts with or without edge weights.
GraphCopy m_GC
The modifiable version of the input graph (used for contractions)
virtual T call(const Graph &G) override
Computes a minimum cut on graph G.
Copies of graphs supporting edge splitting.
const P & priority(const E &element) const
void mainLoop()
Computes minimum cut by invoking minimumCutPhase() O(|V|) times.
virtual T call(const Graph &G, const EdgeArray< T > &weights) override
Computes a minimum cut on graph G with non-negative weights on edges.
void safeForEach(CONTAINER &container, std::function< void(typename CONTAINER::value_type)> func)
Calls (possibly destructive) func for each element of container.
NodeArray< List< node > > m_contractedNodes
Each node has a list containing the nodes with which it has been contracted. Because the GraphCopy m_...
AdjElement * adjEntry
The type of adjacency entries.
bool contains(const E &element) const
Returns whether this queue contains that key.
Class for adjacency list elements.
EdgeElement * edge
The type of edges.
void init(const Graph &G)
Re-initializes the copy using G, creating copies for all nodes and edges in G.
edge theEdge() const
Returns the edge associated with this adjacency entry.
bool empty() const
Checks whether the queue is empty.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
int numberOfNodes() const
Returns the number of nodes in the graph.
Decralation of GraphElement and GraphList classes.
Prioritized queue interface wrapper for heaps.
virtual const ArrayBuffer< node > & nodes() override
Returns a const-reference to the list of nodes belonging to one side of the bipartition.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
void push(E e)
Puts a new element in the buffer.
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
Declaration of graph copy classes.
Declaration of ogdf::MinimumCutModule.
RegisteredArray for nodes, edges and adjEntries of a graph.
Data type for general directed graphs (adjacency list representation).
const E & topElement() const
Returns the topmost element in the queue.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
void decrease(const E &element, const P &priority)
Decreases the priority of the given element.
T m_minCut
Stores the value of the minimum cut.
Basic declarations, included by all source files.
ArrayBuffer< node > m_partition
Store one side of the computed bipartition.
Class for the representation of edges.
Declaration of doubly linked lists and iterators.
ArrayBuffer< edge > m_cutEdges
Store cut edges if computed.
void contraction(node t, node s)
Contracts the nodes s and t, i.e., s is collapsed to t. The edge (if existing) between s and t is del...
Computes a minimum cut in a graph.
void clear()
Clears the buffer.
virtual const ArrayBuffer< edge > & edges() override
Computes the edges defining the computed mincut and returns them.
Class for the representation of nodes.
const Graph & original() const
Returns a reference to the original graph.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.