64template<
typename TCost =
int>
347template<
typename TCost>
426template<
typename TCost>
436 , m_underlyingGraphs(m_graph,
nullptr)
443template<
typename TCost>
454 , m_underlyingGraphs(m_graph,
nullptr)
460template<
typename TCost>
471 , m_underlyingGraphs(m_graph,
nullptr)
478template<
typename TCost>
480 for (
auto pointer : m_mapE) {
483 for (
auto pointer : m_mapV) {
486 for (
auto pointer : m_underlyingGraphs) {
491template<
typename TCost>
515 for (
edge e :
S.getGraph().edges) {
516 node src =
S.original(e->source());
523 if (map[src] ==
nullptr) {
524 m_orig[map[src] = m_graph.newNode()] =
S.original(e->source());
527 if (map[
tgt] ==
nullptr) {
528 m_orig[map[
tgt] = m_graph.newNode()] =
S.original(e->target());
531 if (
S.isVirtual(e)) {
532 node w =
S.twinTreeNode(e);
551 if (weight !=
nullptr) {
552 for (
edge e : m_graph.edges) {
554 for (
auto cutEdge : m_mincut[e]) {
560 for (
edge e : m_graph.edges) {
561 m_cost[e] = m_mincut[e].size();
566 m_graph.allNodes(allNodes);
592 for (
node v : allNodes) {
593 if (v->degree() != 2) {
611 :
outEdge->adjTarget()->cyclicSucc());
612 if (
inEdge->target() != v) {
613 adjSource = adjTarget;
614 adjTarget =
inEdge->adjTarget()->cyclicSucc();
617 delete m_underlyingGraphs[
outEdge];
629template<
typename TCost>
640 degree[v] = v->degree();
641 if (degree[v] <= 1) {
655 node x = adj->twinNode();
664 if (degree[w] == 1) {
679template<
typename TCost>
696 if (
Sv.isVirtual(
eS)) {
706 for (
edge e :
S.getGraph().edges) {
707 if (
S.isVirtual(e)) {
711 node src =
S.original(e->source());
714 if (
mapV[src] ==
nullptr) {
716 mapV[src] =
H.newNode();
731 node w = adj->twinNode();
740 mapV[
Sv.original(
eS->source())] =
H.newNode();
742 mapV[
Sv.original(
eS->target())] =
H.newNode();
778 if (
Sv.isVirtual(
eS)) {
782 for (
edge e :
H.edges) {
784 weight[e] = (*weight_src)[
mapE_src[e]];
791 auto it = edgeList.
begin();
792 for (; it != edgeList.
end(); it++) {
808 for (
node v :
H.nodes) {
811 for (
edge e :
H.edges) {
816 for (
node v : nodes) {
821template<
typename TCost>
831 for (it = ++it; it.
valid(); ++it,
ePrev = e) {
840template<
typename TCost>
912 for (
node v : allNodes) {
931template<
typename TCost>
943 m_endGraph->createEmpty(*m_pOriginal);
945 m_pOriginal->allNodes(allNodes);
947 m_endGraph->initByNodes(allNodes,
eCopy);
950 for (
node v : m_endGraph->nodes) {
952 v->allAdjEntries(adjEntries);
959 for (
node v : m_planarCore->nodes) {
960 if (m_planarCore->isDummy(v)) {
977 newOrder.
pushBack(m_endGraph->copy(mapE[
adjEmb->theEdge()])->adjSource());
979 newOrder.
pushBack(m_endGraph->copy(mapE[
adjEmb->theEdge()])->adjTarget());
983 m_endGraph->sort(m_endGraph->copy(original(
coreNode)), newOrder);
986 for (
edge e : m_graph.edges) {
992 for (
edge e : m_graph.edges) {
997 normalizeCutEdgeDirection(e);
1005 for (
node v : m_planarCore->nodes) {
1006 if (m_planarCore->isDummy(v)) {
1013 for (
edge e : m_graph.edges) {
1014 normalizeCutEdgeDirection(e);
1019template<
typename TCost>
1023 for (
edge e : m_endGraph->chain(
cutE.e)) {
1024 m_endGraph->reverseEdge(e);
1030template<
typename TCost>
1033 edge eIn = v->firstAdj()->theEdge();
1034 edge eOut = v->lastAdj()->theEdge();
1035 if (
eIn->target() == v) {
1036 m_endGraph->unsplit(
eIn,
eOut);
1038 m_endGraph->unsplit(
eOut,
eIn);
1043template<
typename TCost>
1055 if (chain.
size() < 3) {
1065template<
typename TCost>
1067 const Graph&
embG = *m_underlyingGraphs[e];
1080 mapA_toFinal[it.key()->adjSource()] = m_endGraph->chain(*it).front()->adjSource();
1081 mapA_toFinal[it.key()->adjTarget()] = m_endGraph->chain(*it).back()->adjTarget();
1083 node s(m_sNode[e]),
t(m_tNode[e]);
1089 if (v == s || v ==
t) {
1093 for (
adjEntry adj = v->firstAdj(); adj; adj = adj->
succ()) {
1100template<
typename TCost>
1110 while (
e1->target() != v) {
1111 e1 =
e1->adjSource()->succ()->theEdge();
1113 edge e2 =
e1->adjTarget()->succ()->theEdge();
1114 while (
e2->target() != v) {
1115 e2 =
e2->adjSource()->cyclicSucc()->theEdge();
1117 if (
e1 ==
e2->adjTarget()->cyclicSucc()->theEdge()) {
1132 for (
int i = 0; i <
e1cut.size(); i++) {
1135 for (
int j = 0;
j <
e2cut.size();
j++) {
1149template<
typename TCost>
1155 List<edge> chain = m_planarCore->chain(m_planarCore->original(e));
1160 for (
CutEdge eCut : mincut(m_planarCore->original(e))) {
1164 auto it = m_endGraph->chain(
eCut.e).begin();
1165 for (
int i = 0; i < chain.
pos(chain.
search(e)); i++) {
1167 while ((*it)->source()->degree() == 4) {
1177template<
typename TCost>
1180 if (
eWinner->adjSource()->theNode() ==
eLoser->adjSource()->theNode()) {
1205template<
typename TCost>
1240template<
typename TCost>
1242 edge newEdge = m_gWinner->newEdge(m_mapV_l2w[
loser->source()], m_mapV_l2w[
loser->target()]);
1243 m_mapE_l2w[
loser] = newEdge;
1244 (*m_mapEwinner)[newEdge] = (*m_mapEloser)[
loser];
1247template<
typename TCost>
1253template<
typename TCost>
1255 node newNode = m_gWinner->newNode();
1256 m_mapV_l2w[
loser] = newNode;
1257 (*m_mapVwinner)[newNode] = (*m_mapVloser)[
loser];
1260template<
typename TCost>
1272 OGDF_ASSERT(m_mapE_l2w[adj->theEdge()] !=
nullptr);
1281 if (!sameDirection) {
Declaration of min-st-cut algorithm which calculates the min-st-cut of an st-planar graph by doing a ...
MinSTCutDijkstra class template.
Declaration of class StaticSPQRTree.
Declaration and implementation of list-based queues (classes QueuePure<E> and Queue<E>).
Class for adjacency list elements.
adjEntry succ() const
Returns the successor in the adjacency list.
edge theEdge() const
Returns the edge associated with this adjacency entry.
Dynamic arrays indexed with adjacency entries.
Combinatorial embeddings of planar graphs with modification functionality.
Dynamic arrays indexed with edges.
Class for the representation of edges.
This is a helper class to make the glueing of two edges simpler.
void mapLoserToNewWinnerEdge(edge eInLoser)
A mapping from the eInLoser graph to a new edge in the winner graph is created.
node getWinnerNodeOfLoserNode(node v) const
Getter for m_mapV_l2w.
const edge m_eWinner
The core edge that will survive.
GlueMap(edge eWinner, edge eLoser, NonPlanarCore< TCost > &npc)
A GlueMap is created from an NonPlanarCore and two core edges that ought to be glued together.
void mapLoserToWinnerNode(node vInLoser, node vInWinner)
A mapping from the vInLoser to the vInWinner is created.
NodeArray< node > m_mapV_l2w
A map from the nodes of the loser graph to their new home in the winner graph.
EdgeArray< edge > m_mapE_l2w
A map from the edges of the loser graph to their new home in the winner graph.
const Graph * m_gLoser
The graph that eLoser represents.
void reorder(node vLoser, bool sameDirection, bool isTNodeOfPNode)
This method reorders the adjacency order of vLoser's counterpart in the winner graph according to the...
const edge m_eLoser
The core edge that will be deleted.
const NodeArray< node > * m_mapVloser
A map from the nodes of the loser graph to the original graph, to denote the original of each node.
Graph * m_gWinner
The graph that eWinner represents.
NodeArray< node > * m_mapVwinner
A map from the nodes of the winner graph to the original graph, to denote the original of each edge.
EdgeArray< edge > * m_mapEwinner
A map from the edges of the winner graph to the original graph, to denote the original of each edge.
void mapLoserToNewWinnerNode(node vInLoser)
A mapping from the vInLoser to a new node in the winner graph is created.
NonPlanarCore< TCost > & m_npc
The NonPlanarCore on which this instance operates.
const EdgeArray< edge > * m_mapEloser
A map from the edges of the loser graph to the original graph, to denote the original of each node.
const Graph & getLoserGraph() const
Getter for m_gLoser.
Copies of graphs supporting edge splitting.
Data type for general directed graphs (adjacency list representation).
void allNodes(CONTAINER &nodeContainer) const
Returns a container with all nodes of the graph.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
int size() const
Returns the number of elements in the list.
void clear()
Removes all elements from the list.
iterator pushBack(const E &x)
Adds element x at the end of the list.
iterator begin()
Returns an iterator to the first element of the list.
int pos(const_iterator it) const
Returns the position (starting with 0) of iterator it in the list.
ListConstIterator< E > search(const E &e) const
Scans the list for the specified element and returns an iterator to the first occurrence in the list,...
iterator end()
Returns an iterator to one-past-last element of the list.
Min-st-cut algorithm, that calculates the cut by doing a depth first search over the dual graph of of...
Min-st-cut algorithm, that calculates the cut by calculating the shortest path between the faces adja...
Dynamic arrays indexed with nodes.
void init()
Reinitializes the array. Associates the array with no graph.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
Non-planar core reduction.
EdgeArray< List< CutEdge > > m_mincut
Traversing path for an edge in the core.
const Graph & originalGraph() const
Returns the original graph.
void glue(edge eWinner, edge eLoser)
Glues together the skeletons of eWinner and eLoser for pruned P- and S-nodes.
List< edge > original(edge e) const
Returns the edges of the original graph, which are represented by e in the core.
NodeArray< node > m_orig
Corresp. original node.
const EdgeArray< TCost > & cost() const
Returns the costs of the edges in the core, which is the number of original edges crossed,...
void traversingPath(const Skeleton &Sv, edge eS, List< CutEdge > &path, NodeArray< node > &mapV, edge coreEdge, const EdgeArray< TCost > *weight_src, MinSTCutModule< TCost > *minSTCutModule)
Computes the traversing path for a given edge and the unmarked tree rooted in the node of eS and save...
node tNode(edge e) const
Returns the t node of the skeleton of the st-component represented by the core edge e = (s,...
void inflateCrossing(node v)
The crossing denoted by dummy node v from the planarized copy of the core get inserted into the end g...
bool isVirtual(edge e) const
True iff the edge e in the core represents more than one orginal edge and therefore is virtual.
const GraphCopy * m_planarCore
A pointer to a copy of the core, in which crossings are replaced by dummy nodes.
const List< CutEdge > & mincut(edge e) const
Returns the mincut of the st-component represented by e.
void getAllMultiedges(List< edge > &winningEdges, List< edge > &losingEdges)
Checks for multiedges in the core.
void retransform(const GraphCopy &planarCore, GraphCopy &planarGraph, bool pCisPlanar=true)
Inserts the crossings from a copy of the core into a copy of the original graph.
const Graph * m_pOriginal
The original graph.
void markCore(NodeArray< bool > &mark)
Marks all nodes of the underlying SPQRTree and prunes planar leaves until the marked nodes span a tre...
node original(node v) const
Returns the node of the original graph, which is represented by v in the core.
EdgeArray< edge > * mapE(edge e) const
Returns a map from the edges of the st-component represented by the core edge e to the original graph...
void importEmbedding(edge e)
This method asserts that all parts of the end graph that are represented by edge e internally have th...
EdgeArray< node > m_tNode
The t node of the st-component of a core edge.
StaticSPQRTree m_T
The SPQRTree that represents the original graph.
NonPlanarCore(const Graph &G, const EdgeArray< TCost > &weight, MinSTCutModule< TCost > *minSTCutModule, bool nonPlanarityGuaranteed=false)
Algorithm call and constructor.
EdgeArray< node > m_sNode
The s node of the st-component of a core edge.
void call(const Graph &G, const EdgeArray< TCost > *weight, MinSTCutModule< TCost > *minSTCutModule, bool nonPlanarityGuaranteed)
The private method behind the constructors.
node sNode(edge e) const
Returns the s node of the skeleton of the st-component represented by the core edge e = (s,...
void normalizeCutEdgeDirection(edge coreEdge)
Every edge of coreEdge's cut that doesn't go the same direction as coreEdge gets reversed.
void glueMincuts(edge eWinner, edge eLoser)
Glues together the mincuts of the winner and the loser edge.
GraphCopy * m_endGraph
A pointer to a copy of the original graph, in which crossings are replaced by dummy nodes.
void splitEdgeIntoSections(edge e, List< node > &splitdummies)
To be able to insert crossings correctly, an end graph edge ought to be split into n-1 sections if n ...
NonPlanarCore(const Graph &G, bool nonPlanarityGuaranteed=false)
The unweighted version of the Algorithm call and constructor.
EdgeArray< NodeArray< node > * > m_mapV
The mapping between the nodes of each embedding and their original.
EdgeArray< TCost > m_cost
TCosts to cross each edge of the core.
const Graph & core() const
Returns the non-planar core.
void getMincut(edge e, List< edge > &cut)
Get the mincut of e with respect to its position in the chain of its original edge.
TCost cost(edge e) const
Returns the cost of e, which is the number of original edges crossed, if e is crossed,...
NonPlanarCore(const Graph &G, const EdgeArray< TCost > &weight, bool nonPlanarityGuaranteed=false)
An slimmed version of the Algorithm call and constructor.
EdgeArray< EdgeArray< edge > * > m_mapE
The mapping between the edges of each embedding and their original.
EdgeArray< Graph * > m_underlyingGraphs
The graph for the underlying skeleton of a virtual edge in the core.
edge realEdge(edge e) const
Returns the edge of the orginal graph, which is represented by e or nullptr iff e is virtual.
void removeSplitdummies(List< node > &splitdummies)
After inserting the crossings, the end graph edges don't need to be partitioned anymore so the splitd...
EdgeArray< edge > m_real
Corresp. original edge (0 if virtual)
The parameterized class Queue<E> implements list-based queues.
Encapsulates a pointer to an ogdf::SList element.
bool valid() const
Returns true iff the iterator points to an element.
iterator begin()
Returns an iterator to the first element of the list.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Skeleton graphs of nodes in an SPQR-tree.
Linear-time implementation of static SPQR-trees.
bool isBiconnected(const Graph &G, node &cutVertex)
Returns true iff G is biconnected.
void parallelFreeSortUndirected(const Graph &G, SListPure< edge > &edges, EdgeArray< int > &minIndex, EdgeArray< int > &maxIndex)
Sorts the edges of G such that undirected parallel edges come after each other in the list.
bool planarEmbed(Graph &G)
Returns true, if G is planar, false otherwise. If true is returned, G will be planarly embedded.
bool isPlanar(const Graph &G)
Returns true, if G is planar, false otherwise.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
@ tree
for every hyperedge e a minimal subcubic tree connecting all hypernodes incident with e together is a...
Declaration of simple graph algorithms.
Struct to represent an edge that needs to be crossed in order to cross an st-component.
const bool dir
true, iff the edge is directed from the s partition to the t partion
CutEdge(edge paramEdge, bool directed)
QueueEntry(node p, node v)