|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
56 explicit operator int() {
return m_val; }
66 using twosat_var = int;
79 node pos = newNode(), neg = newNode();
82 m_assignment.push_back(
false);
84 m_node_map.push_back(pos);
86 m_node_map.push_back(neg);
92 return nodes.size() / 2;
96 auto [p1, n1] = getNodes(var1, !sign1);
97 auto [p2, n2] = getNodes(var2, !sign2);
98 edge e1 = newEdge(n1, p2);
99 edge e2 = newEdge(n2, p1);
107 return edges.size() / 2;
116 for (
auto it = nodes.begin(); it != nodes.end(); it++) {
123 if (components[pos] == components[neg]) {
126 m_assignment[pos->
index() / 2] = (components[pos] > components[neg]);
135 m_assignment.clear();
151 int idx = getNodeIndex(
var,
true);
152 node pos = m_node_map[idx];
156 node neg = m_node_map[idx + 1];
159 return std::pair(neg, pos);
161 return std::pair(pos, neg);
166 int idx = getNodeIndex(
var,
sign);
167 node n = m_node_map[idx];
173 int idx = ((int)
var) * 2 + (
sign ? 0 : 1);
The namespace for all OGDF objects.
Includes declaration of graph class.
const_iterator begin() const
int getNodeIndex(twosat_var var, bool sign) const
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
int index() const
Returns the (unique) node index.
std::pair< node, node > getNodes(twosat_var var, bool flip=false) const
void clear() override
Removes all nodes and all edges from the graph.
typename std::vector< bool >::const_reverse_iterator const_reverse_iterator
int index() const
Returns the index of the edge.
const twosat_var TwoSAT_Var_Undefined(-1)
bool operator==(const twosat_var &rhs) const
virtual void clear()
Removes all nodes and all edges from the graph.
Decralation of GraphElement and GraphList classes.
int strongComponents(const Graph &G, NodeArray< int > &component)
Computes the strongly connected components of the digraph G.
int maxNodeIndex() const
Returns the largest used node index.
bool getAssignment(twosat_var var) const
RegisteredArray for nodes, edges and adjEntries of a graph.
typename std::vector< bool >::const_iterator const_iterator
Data type for general directed graphs (adjacency list representation).
std::vector< node > m_node_map
Basic declarations, included by all source files.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
int variableCount() const
Class for the representation of edges.
int newClause(twosat_var var1, bool sign1, twosat_var var2, bool sign2)
bool operator!=(const twosat_var &rhs) const
std::vector< bool > m_assignment
const_iterator end() const
const_reverse_iterator rbegin() const
node getNode(twosat_var var, bool sign) const
Class for the representation of nodes.
const_reverse_iterator rend() const
Declaration of simple graph algorithms.
A simple solver for TwoSAT instances, representing the instance as implication graph and solving it v...
In debug mode, twosat_var is a class instead of a simple int to prevent unintened use of the default ...