Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MinSTCutModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
36 
37 namespace ogdf {
38 
39 template<typename TCost>
41 public:
46 
60  virtual bool call(const Graph& graph, const EdgeArray<TCost>& weight, node s, node t,
61  List<edge>& edgeList, edge e_st = nullptr) = 0;
62 
75  virtual bool call(const Graph& graph, node s, node t, List<edge>& edgeList,
76  edge e_st = nullptr) = 0;
77 
78  virtual ~MinSTCutModule() { delete m_gc; }
79 
87  virtual bool direction(edge e) {
89  OGDF_ASSERT(m_direction[e] != -1);
90  return m_direction[e];
91  }
92 
93 protected:
95  GraphCopy* m_gc = nullptr;
96 
109  node source, node target, edge e_st) {
110  node gcS(gc.copy(source));
111  node gcT(gc.copy(target));
112  adjEntry adjT, adjS;
113  bool isSTplanarEmbeded(false);
114  if (gc.representsCombEmbedding()) {
115  CE.init(gc);
116  adjS = CE.findCommonFace(gcS, gcT, adjT, false);
117  isSTplanarEmbeded = (adjS != nullptr);
118  }
119  if (isSTplanarEmbeded) {
120  if (e_st == nullptr) {
121  CE.splitFace(adjS, adjT);
122  }
123  } else {
124  if (e_st == nullptr) {
125  gc.newEdge(gcS, gcT);
126  }
127  if (!planarSTEmbed(gc, gcS, gcT)) {
128  return false;
129  }
130  CE.init(gc);
131  }
132  return true;
133  }
134 };
135 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::ConstCombinatorialEmbedding::findCommonFace
adjEntry findCommonFace(const node v, const node w, bool left=true) const
Identifies a common face of two nodes and returns the respective adjacency entry.
Definition: CombinatorialEmbedding.h:362
ogdf::MinSTCutModule::direction
virtual bool direction(edge e)
Returns the direction of e in the cut.
Definition: MinSTCutModule.h:87
ogdf::MinSTCutModule::preprocessingDual
bool preprocessingDual(const Graph &graph, GraphCopy &gc, CombinatorialEmbedding &CE, node source, node target, edge e_st)
This method preprocesses gc for minstcut calculations, by adding an st-edge if needed and embedding g...
Definition: MinSTCutModule.h:108
extended_graph_alg.h
Declaration of extended graph algorithms.
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:384
ogdf::CombinatorialEmbedding::splitFace
edge splitFace(adjEntry adjSrc, adjEntry adjTgt, bool sourceAfter=false)
Splits a face by inserting a new edge.
ogdf::planarSTEmbed
bool planarSTEmbed(Graph &graph, node s, node t)
s-t-planarly embeds a graph.
Definition: extended_graph_alg.h:321
ogdf::GraphCopy::newEdge
edge newEdge(edge eOrig)
Creates a new edge (v,w) with original edge eOrig.
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::MinSTCutModule::call
virtual bool call(const Graph &graph, const EdgeArray< TCost > &weight, node s, node t, List< edge > &edgeList, edge e_st=nullptr)=0
The actual algorithm call.
ogdf::Graph::numberOfEdges
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:977
ogdf::MinSTCutModule::m_direction
EdgeArray< int > m_direction
Definition: MinSTCutModule.h:94
ogdf::CombinatorialEmbedding::init
void init(Graph &G)
Initializes the embedding for graph G.
Definition: CombinatorialEmbedding.h:455
ogdf::MinSTCutModule::~MinSTCutModule
virtual ~MinSTCutModule()
Definition: MinSTCutModule.h:78
ogdf::MinSTCutModule
Definition: MinSTCutModule.h:40
ogdf::List< edge >
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::GraphCopy::copy
edge copy(edge e) const override
Returns the first edge in the list of edges corresponding to edge e.
Definition: GraphCopy.h:457
ogdf::Graph::representsCombEmbedding
bool representsCombEmbedding() const
Returns true iff the graph represents a combinatorial embedding.
Definition: Graph_d.h:1601
ogdf::MinSTCutModule::m_gc
GraphCopy * m_gc
Definition: MinSTCutModule.h:95
CombinatorialEmbedding.h
Declaration of CombinatorialEmbedding and face.
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:397
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::MinSTCutModule::MinSTCutModule
MinSTCutModule()
default constructor (empty)
Definition: MinSTCutModule.h:45
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709