48template<
typename GraphElementPo
inter>
59 if (a->index() < b->index()) {
124 std::unique_ptr<EdgePair> m_previousCrossing =
nullptr;
143 : m_mode(m), m_graph(g), m_crossedEdges(m_graph) {
146 if (!e1->isAdjacent(e2)) {
147 m_freeEdgePairs.emplace(e1, e2);
155 : m_mode(other.m_mode)
156 , m_graph(other.m_graph)
157 , m_crossedEdges(other.m_crossedEdges)
158 , m_kiteEdges(other.m_kiteEdges)
159 , m_crossingEdgePairs(other.m_crossingEdgePairs)
160 , m_freeEdgePairs(other.m_freeEdgePairs) { }
166 const std::set<VertexPair>&
kiteEdges()
const {
return m_kiteEdges; }
185 if (m_undoInformation.empty()) {
188 return !m_undoInformation.top().m_todoCrossings.empty();
194 EdgePair ep = m_undoInformation.top().m_todoCrossings.front();
195 m_undoInformation.top().m_todoCrossings.pop_front();
196 m_undoInformation.top().m_previousCrossing = std::make_unique<EdgePair>(ep);
205 if (m_freeEdgePairs.count(pair) > 0) {
206 m_freeEdgePairs.erase(pair);
207 m_undoInformation.top().m_nonCrossingPairs.insert(pair);
217 if (m_kiteEdges.count({pair.first()->source(), pair.first()->target()}) > 0
218 || m_kiteEdges.count({pair.second()->source(), pair.second()->target()}) > 0) {
221 return m_freeEdgePairs.count(pair) > 0;
226 if (m_kiteEdges.count({e->source(), e->target()}) > 0 || m_crossedEdges.
contains(e)) {
229 for (
EdgePair ep : m_freeEdgePairs) {
230 if (ep.contains(e)) {
239 for (
EdgePair ep : m_crossingEdgePairs) {
240 if (ep.contains(e)) {
250 if (adj->twinNode() == b) {
251 return adj->theEdge();
268 if (m_kiteEdges.count(vp) == 0) {
269 m_kiteEdges.insert(vp);
270 m_undoInformation.top().m_kiteEdges.insert(vp);
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
Basic declarations, included by all source files.
Class for adjacency list elements.
Class for the representation of edges.
const Graph * graphOf() const
Returns the graph containing this node (debug only).
node target() const
Returns the target node of the edge.
node source() const
Returns the source node of the edge.
Data type for general directed graphs (adjacency list representation).
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
bool contains(element_type v) const
Returns the same as isMember()
A partial solution for a 1-Planarity instance, representing a node in the backtracking tree.
void startTransaction()
Starts a new transaction that can later be undone.
EdgePairPartition(const EdgePairPartition &other)
Creates a new EdgePairPartition as a copy of other, but does not copy its transaction stack.
const std::set< EdgePair > & crossingEdgePairs() const
Returns the set of all crossed edge pairs.
bool isFree(const EdgePair &pair) const
Returns whether pair is still allowed to cross.
std::set< VertexPair > m_kiteEdges
void computeKiteEdges(const EdgePair &crossedPair)
std::stack< UndoInformation > m_undoInformation
void startTransaction(std::vector< EdgePair > &todoCrossings)
Starts a new transaction and associates an exhaustive set of crossings that will be branched over.
void setNonCrossing(const EdgePair &pair)
Marks pair as non-crossing.
EdgePair getNextTodoCrossing()
Removes and returns the next stored crossing that should be considered.
const std::set< VertexPair > & kiteEdges() const
Returns the set of kite edges.
void undoTransaction()
Reverts the previous transaction.
bool isFree(edge e) const
Returns whether there exists an edge that e may cross.
void addKiteEdge(const VertexPair &vp)
std::set< EdgePair > m_freeEdgePairs
std::set< EdgePair > m_crossingEdgePairs
bool hasTodoCrossing()
Returns whether there are crossings that should be branched over.
bool isCrossed(edge e) const
Returns whether e is part of a crossing.
void crossEdgePair(const EdgePair &pair)
Crosses pair and computes the corresponding kite edges.
EdgePairPartition(const Graph &g, OneplanMode m=OneplanMode::Normal)
Creates a new EdgePairPartition, where all pairs of independent edges are crossable.
const Graph & graph() const
Returns the associated graph.
static edge getEdgeBetween(node a, node b)
Returns an edge between a and b, or null.
A pair of distinct graph elements, ordered by their index.
GraphElementPointer m_second
OrderedPair(GraphElementPointer a, GraphElementPointer b)
Creates a new pair that consists of a and b.
bool operator==(const OrderedPair &rhs) const
GraphElementPointer m_first
const Graph * graphOf() const
bool contains(GraphElementPointer el) const
Returns whether el is contained in the pair.
bool operator!=(const OrderedPair &rhs) const
GraphElementPointer second() const
Returns the element with larger index.
bool operator<(const OrderedPair &rhs) const
GraphElementPointer first() const
Returns the element with smaller index.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
OneplanMode
The different modes for 1-Planarity.
@ NIC
1-Planarity, where two crossed edge pairs may share at most one vertex (NIC-Planarity)
@ IC
1-Planarity, where no two crossed edges may share a vertex (IC-Planarity)