Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ChunkConnection.h
Go to the documentation of this file.
1 
41 #pragma once
42 
43 #include <ogdf/basic/Array.h>
44 #include <ogdf/basic/Graph.h>
45 #include <ogdf/basic/Logger.h>
48 
49 #include <ostream>
50 
51 namespace abacus {
52 class Master;
53 class Variable;
54 } // namespace abacus
55 
56 namespace ogdf {
57 template<class E, class INDEX>
58 class ArrayBuffer;
59 
60 namespace cluster_planarity {
61 
63 #ifdef OGDF_DEBUG
64  //Mainly for debugging output purposes
65  friend class MaxCPlanarMaster;
66  friend class MaxCPlanarSub;
67  friend class CPlanarMaster;
68  friend class CPlanarSub;
69 #endif
70 public:
71  ChunkConnection(abacus::Master* master, const ArrayBuffer<node>& chunk,
72  const ArrayBuffer<node>& cochunk);
73 
74  virtual ~ChunkConnection();
75 
76  // Computes and returns the coefficient for the given variable
77  virtual double coeff(const abacus::Variable* v) const override {
78  const EdgeVar* ev = static_cast<const EdgeVar*>(v);
79  //Safe for both clustered planarity testing and maximum c-planar subgraph
80  return (ev->theEdgeType() != EdgeVar::EdgeType::Connect)
81  ? 0.0
82  : (double)coeff(ev->sourceNode(), ev->targetNode());
83  }
84 
85  inline int coeff(const NodePair& n) const override { return coeff(n.source, n.target); }
86 
87  int coeff(node v1, node v2) const;
88 
89  void printMe(std::ostream& out) const {
90  out << "[ChunkCon: (";
91  for (node v : m_chunk) {
92  Logger::slout() << v << ",";
93  }
94  out << "|";
95  for (node v : m_cochunk) {
96  Logger::slout() << v << ",";
97  }
98  out << ")]";
99  }
100 
101 private:
102  // The nodePairs corresponding to the constraint
105 };
106 
107 }
108 }
ogdf::ArrayBuffer
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition: Array.h:53
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::cluster_planarity::EdgeVar::targetNode
node targetNode() const
Definition: EdgeVar.h:63
ogdf::cluster_planarity::MaxCPlanarSub
Definition: MaxCPlanarSub.h:60
ogdf::cluster_planarity::ChunkConnection
Definition: ChunkConnection.h:62
ogdf::cluster_planarity::ChunkConnection::m_chunk
Array< node > m_chunk
Definition: ChunkConnection.h:103
ogdf::NodePair
Definition: Graph_d.h:2109
ogdf::cluster_planarity::ChunkConnection::ChunkConnection
ChunkConnection(abacus::Master *master, const ArrayBuffer< node > &chunk, const ArrayBuffer< node > &cochunk)
abacus
Definition: ILPClusterPlanarity.h:50
ogdf::NodePair::source
node source
Definition: Graph_d.h:2110
Logger.h
Contains logging functionality.
ogdf::cluster_planarity::MaxCPlanarMaster
Definition: MaxCPlanarMaster.h:67
ogdf::cluster_planarity::EdgeVar::EdgeType::Connect
@ Connect
EdgeVar.h
Declaration of the variable class for the Branch&Cut algorithm for the Maximum C-Planar SubGraph prob...
ogdf::Array< node >
ogdf::NodePair::target
node target
Definition: Graph_d.h:2111
abacus::Variable
Forms the virtual base class for all possible variables given in pool format.
Definition: variable.h:59
ogdf::cluster_planarity::BaseConstraint
Basic constraint type.
Definition: basics.h:56
ogdf::cluster_planarity::EdgeVar::sourceNode
node sourceNode() const
Definition: EdgeVar.h:61
ogdf::cluster_planarity::ChunkConnection::printMe
void printMe(std::ostream &out) const
Definition: ChunkConnection.h:89
ogdf::AlgorithmFailureCode::Variable
@ Variable
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::cluster_planarity::ChunkConnection::coeff
int coeff(const NodePair &n) const override
Definition: ChunkConnection.h:85
ogdf::cluster_planarity::ChunkConnection::CPlanarMaster
friend class CPlanarMaster
Definition: ChunkConnection.h:67
ogdf::cluster_planarity::EdgeVar::theEdgeType
EdgeType theEdgeType() const
Definition: EdgeVar.h:65
basics.h
Declaration of the master class for the Branch&Cut algorithm for the Maximum C-Planar SubGraph proble...
ogdf::cluster_planarity::ChunkConnection::CPlanarSub
friend class CPlanarSub
Definition: ChunkConnection.h:68
ogdf::cluster_planarity::ChunkConnection::~ChunkConnection
virtual ~ChunkConnection()
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::cluster_planarity::EdgeVar
Definition: EdgeVar.h:45
ogdf::cluster_planarity::ChunkConnection::m_cochunk
Array< node > m_cochunk
Definition: ChunkConnection.h:104
ogdf::Logger::slout
static std::ostream & slout(Level level=Level::Default)
stream for logging-output (global)
Definition: Logger.h:193
abacus::Master
The master of the optimization.
Definition: master.h:69
ogdf::cluster_planarity::ChunkConnection::coeff
virtual double coeff(const abacus::Variable *v) const override
Returns the coefficient of the variable v in the constraint.
Definition: ChunkConnection.h:77