71 int costGen = 1,
int costAssoc = 1,
bool align =
false);
110 int costGen = 1,
int costAssoc = 1,
bool align =
false)
217 ATYPE d = (*m_pPos)[x] - (*m_pPos)[y];
223 return (*
m_pSec)[x] - (*m_pSec)[y];
317 if ((m_pOR->direction(adj) == m_arcDir || m_pOR->direction(adj) == m_oppArcDir)
320 m_length[m_edgeToBasicArc[adj]] = 0;
331 && (m_pOR->direction(
adjFirst) == m_arcDir || m_pOR->direction(
adjFirst) == m_oppArcDir)) {
342 if (m_pOR->direction(
adjFirst) == m_arcDir) {
349 for (
int i = 0; i <
median; i++) {
368 m_cost[
e1] = m_MedianArcCost;
373 m_cost[
e2] = m_MedianArcCost;
384 m_cost[m_edgeToBasicArc[adj]] = 0;
386 m_cost[m_edgeToBasicArc[adj]] = 0;
391 m_cost[m_edgeToBasicArc[adj]] = 0;
400 m_cost[m_edgeToBasicArc[adj]] = 0;
425 if (
PG.expandAdj(v) ==
nullptr) {
430 resetGenMergerLengths(
PG,
PG.expandAdj(v));
454 if (
sDir.totalAttached() > 0) {
459 m_length[m_edgeToBasicArc[
cornerDir]] = 0;
463 if (
sOppDir.totalAttached() > 0) {
478 if (
sDir.m_adjGen ==
nullptr &&
sOppDir.m_adjGen ==
nullptr) {
481 m_length[e] =
rcMin + size +
rcMax - 2 * overhang;
482 m_cost[e] = 2 * m_vertexArcCost;
492 if (
sDir.m_adjGen !=
nullptr) {
496 m_cost[
e1] = m_vertexArcCost;
500 m_cost[
e2] = m_vertexArcCost;
504 if (
sOppDir.m_adjGen !=
nullptr) {
508 m_cost[
e1] = m_vertexArcCost;
512 m_cost[
e2] = m_vertexArcCost;
523 edge arc = m_edgeToBasicArc[e];
524 if (
arc ==
nullptr) {
528 node v = e->source();
529 node w = e->target();
532 && (m_pOR->angle(e->adjSource()) == m_pOR->angle(e->adjTarget())) &&
537 m_cost[
arc] = m_doubleBendCost;
551 setBasicArcsZeroLength(
PG);
560 if (
PG.expandAdj(v) ==
nullptr) {
565 resetGenMergerLengths(
PG,
PG.expandAdj(v));
579 m_length[m_edgeToBasicArc[adj]] =
minDist.epsilon(v, m_arcDir, 0);
580 m_length[m_edgeToBasicArc[last]] =
minDist.epsilon(v, m_arcDir, 1);
586 m_length[m_edgeToBasicArc[adj]] =
minDist.delta(v, m_arcDir, i);
592 m_length[m_edgeToBasicArc[adj]] =
minDist.epsilon(v, m_oppArcDir, 0);
593 m_length[m_edgeToBasicArc[last]] =
minDist.epsilon(v, m_oppArcDir, 1);
599 m_length[m_edgeToBasicArc[adj]] =
minDist.delta(v, m_oppArcDir, i);
612 if (
sDir.m_adjGen ==
nullptr &&
sOppDir.m_adjGen ==
nullptr) {
616 if (
sDir.totalAttached() == 1 ||
sOppDir.totalAttached() == 1) {
625 m_cost[
e1] = m_vertexArcCost;
629 m_cost[
e2] = m_vertexArcCost;
632 if (
sDir.totalAttached() == 1) {
702 m_cost[e] = 2 * m_vertexArcCost;
714 if (
sDir.m_adjGen !=
nullptr) {
718 m_cost[
e1] = m_vertexArcCost;
722 m_cost[
e2] = m_vertexArcCost;
725 if (
sDir.totalAttached() == 1) {
732 m_cost[
e1] = m_vertexArcCost;
736 m_cost[
e2] = m_vertexArcCost;
765 if (
sOppDir.m_adjGen !=
nullptr) {
769 m_cost[
e1] = m_vertexArcCost;
773 m_cost[
e2] = m_vertexArcCost;
784 m_cost[
e1] = m_vertexArcCost;
788 m_cost[
e2] = m_vertexArcCost;
824 writeGML(
"eastvertexsizeinserted.gml");
826 writeGML(
"northvertexsizeinserted.gml");
836 for (
edge e : edges) {
837 c += cost(e) * (pos[e->target()] - pos[e->source()]);
855 if ((*it).m_high < (*it).m_low) {
859 ATYPE x = (*it).m_low;
861 for (++it; it.
valid(); ++it) {
862 if ((*it).m_high < (*it).m_low) {
865 if ((*it).m_high > x) {
880 if (
PG.expandAdj(v) ==
nullptr) {
884 for (
int d = 0;
d < 4; ++
d) {
924 for (
node v : nodes) {
926 if (m_path[v].empty()) {
935 for (++it; it.
valid(); ++it) {
953 if(m_pOR->direction(adj) == m_arcDir || m_pOR->direction(adj) == m_oppArcDir) {
961 adj2 =
adj2->twin()->faceCycleSucc()) ;
982 if (
PG.expandAdj(v) ==
nullptr) {
990 for (adj =
isCaseA ?
vi.m_corner[
static_cast<int>(
dirMin)]->faceCycleSucc()->faceCycleSucc()
991 :
vi.m_corner[
static_cast<int>(
dirMin)]->faceCycleSucc();
1009 && m_pOR->angle(
adjTwin) == 2) {
1011 node s2 = m_pathNode[
adjTwin->cyclicSucc()->twinNode()];
1012 low[s1] =
lowReal[s1] - delta;
1013 low[s2] =
lowReal[s2] - delta;
1019 && m_pOR->angle(
adjTwin->cyclicPred()) == 2) {
1021 node s2 = m_pathNode[
adjTwin->cyclicPred()->twinNode()];
1022 low[s1] =
lowReal[s1] - delta;
1023 low[s2] =
lowReal[s2] - delta;
1043 low[s] += m_sep - delta;
1059 if (
adjCross->theNode()->degree() != 2) {
1083 for (adj =
isCaseA ?
vi.m_corner[
static_cast<int>(
dirMax)]->faceCycleSucc()
1084 :
vi.m_corner[
static_cast<int>(
dirMax)]->faceCycleSucc()->faceCycleSucc();
1107 && m_pOR->angle(
adjTwin->cyclicPred()) == 2) {
1109 node s2 = m_pathNode[
adjTwin->cyclicPred()->twinNode()];
1110 low[s1] =
lowReal[s1] - delta;
1111 low[s2] =
lowReal[s2] - delta;
1115 && m_pOR->angle(
adjTwin) == 2) {
1117 node s2 = m_pathNode[
adjTwin->cyclicSucc()->twinNode()];
1118 low[s1] =
lowReal[s1] - delta;
1119 low[s2] =
lowReal[s2] - delta;
1139 low[s] += m_sep - delta;
1156 if (
adjCross->theNode()->degree() != 2) {
1184 computeTopologicalSegmentNum(
topNum);
1199 if (m_path[*
itV].empty()) {
1207 if ((*it).m_low < high[v]) {
1217 if ((*it).m_high <= low[v]) {
1225 bool isItUpDel = (((*itUp).m_low >= low[v]) && ((*itUp).m_high <= high[v]));
1227 for (; it.
valid() && (*it).m_low >= low[v]; it =
itSucc) {
1229 if ((*it).m_high <= high[v]) {
1235 if (it ==
itUp && (*it).m_high > high[v]) {
1236 node w = (*it).m_pathNode;
1238 (*it).m_low = high[v];
1243 if ((!
isItUpDel) &&
itUp != it && (*itUp).m_low < high[v]) {
1244 (*itUp).m_low = high[v];
1248 if ((*it).m_high > low[v]) {
1249 (*it).m_high = low[v];
1270 for (
node v :
PG.nodes) {
1272 for (
adjEntry adj : v->adjEntries) {
1273 if (m_pOR->direction(adj) !=
segDir) {
1278 if (
eOrig ==
nullptr) {
1281 if (adj ==
eAdj->adjSource()) {
1293 node v = (*itT).x1(), w = (*itT).x2();
1312 node v = (*itT).x1(), w = (*itT).x2();
1313 if (!(m_extraNode[v] || m_extraNode[w])) {
1321 edge e = newEdge(v, w);
1325 m_length[e] = max(m_sep,
minDist.separation());
1329 writeGML(
"visibilityinserted.gml");
1341template<
class ATYPE>
1343 for (
edge e : getGraph().edges) {
1344 node v = m_path[e->source()].front();
1345 node w = m_path[e->target()].front();
1346 if (pos[w] - pos[v] < length(e)) {
1347 std::cout <<
"feasibility check failed for edge " << e << std::endl;
1348 std::cout <<
" representatives: " << v <<
", " << w << std::endl;
1349 std::cout <<
" length: " << length(e) << std::endl;
1350 std::cout <<
" actual distance: " << pos[w] - pos[v] << std::endl;
1351 std::cout <<
" type of " << e <<
": ";
1352 switch (m_type[e]) {
1354 std::cout <<
"basic arc" << std::endl;
1357 std::cout <<
"vertex-size arc" << std::endl;
1360 std::cout <<
"visibility arc" << std::endl;
1363 std::cout <<
"median arc" << std::endl;
1366 std::cout <<
"reducible arc" << std::endl;
1369 std::cout <<
"fixtozero arc" << std::endl;
Declares ogdf::CommonCompactionConstraintGraphBase.
Declaration of class MinimumEdgeDistances which maintains minimum distances between attached edges at...
Declaration of a base class for planar representations of graphs and cluster graphs.
Declaration of class RoutingChannel which maintains required size of routing channels and separation,...
Class for adjacency list elements.
adjEntry faceCyclePred() const
Returns the cyclic predecessor in face.
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
edge theEdge() const
Returns the edge associated with this adjacency entry.
adjEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
node theNode() const
Returns the node whose adjacency list contains this element.
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Base class for ogdf::CompactionConstraintGraphBase.
NodeArray< bool > m_extraNode
Node does not represent drawing node as we dont have positions we save a drawing representant and an ...
NodeArray< node > m_extraRep
existing representant of extranodes position anchor
Comparer class used for sorting segments by increasing position (given by segPos) such that two overl...
const NodeArray< int > * m_pSec
SegmentComparer(const NodeArray< ATYPE > &segPos, const NodeArray< int > &secSort)
const NodeArray< ATYPE > * m_pPos
int compare(const node &x, const node &y) const
Class implementing template-parameter-independent behaviour of ogdf::CompactionConstraintGraph.
void align(bool b)
Triggers alignment (=>some special edge handling to support al.)
bool verticalArc(edge e) const
Returns true if e is basic arc of vertical edge in PlanRepUML hierarchy.
EdgeArray< bool > m_alignmentArc
Basic arcs that have to be short for alignment (node to gen expander)
void dfsInsertPathVertex(node v, node pathVertex, NodeArray< bool > &visited, const NodeArray< node > &genOpposite)
bool verticalGen(edge e) const
Returns true if e is vertical edge in PlanRepUML hierarchy.
EdgeArray< bool > m_verticalGen
generalization that runs vertical relative to hierarchy
bool alignmentArc(edge e) const
Returns if arc is important for alignment. These are the arcs representing node to gen....
void insertPathVertices(const PlanRep &PG)
edge pathToOriginal(node v)
CompactionConstraintGraphBase(const OrthoRep &OR, const PlanRep &PG, OrthoDir arcDir, int costGen=1, int costAssoc=1, bool align=false)
Construction.
void insertBasicArcs(const PlanRep &PG)
EdgeArray< bool > m_verticalArc
arc corresponding to such an edge
NodeArray< edge > m_pathToEdge
save the (single!) edge (segment) for a pathNode
Represents a constraint graph used for compaction.
ATYPE separation() const
Returns the separation value.
NodeArray< ATYPE > m_extraOfs
offset of extra node to its rep, should change this
bool m_genToMedian
draw outgoing generalization from merger above ingoing gen.
ATYPE extraOfs(node v) const
Returns extraNode position, change to save mem, only need some entries.
static const int c_bungeeFactor
EdgeArray< ATYPE > m_length
length of an edge
void insertVertexSizeArcs(const PlanRep &PG, const NodeArray< ATYPE > &sizeOrig, const RoutingChannel< ATYPE > &rc)
Inserts arcs for respecting sizes of vertices and achieving desired placement of generalizations if v...
CompactionConstraintGraph(const OrthoRep &OR, const PlanRep &PG, OrthoDir arcDir, ATYPE sep, int costGen=1, int costAssoc=1, bool align=false)
Construction.
static const int c_vertexArcFactor
void setMinimumSeparation(const PlanRep &PG, const NodeArray< int > &coord, const MinimumEdgeDistances< ATYPE > &minDist)
Sets min separation for multi edge original.
void resetGenMergerLengths(const PlanRep &PG, adjEntry adjFirst)
void insertVisibilityArcs(const PlanRep &PG, const NodeArray< ATYPE > &posDir, const NodeArray< ATYPE > &posOppDir)
Inserts arcs connecting segments which can see each other in a drawing of the associated planarized r...
int m_doubleBendCost
try to minimize double bends
int m_bungeeCost
middle position distance penalty
bool centerPriority()
Gets centerPriority (center single edges?)
static const int c_MedianFactor
median arcs cost factor*vertexArcCost
bool isFeasible(const NodeArray< ATYPE > &pos)
Performs feasibility test for position assignment pos, i.e., checks if the segment positions given by...
void setBasicArcsZeroLength(const PlanRep &PG)
virtual string getLengthString(edge e) const override
int m_MedianArcCost
draw merger gen at median of incoming generalizations
bool m_centerPriority
should centering be more expensive than generalizations
bool checkSweepLine(const List< Interval > &sweepLine) const
static const int c_doubleBendFactor
double bends cost factor*vertexArcCost
ATYPE length(edge e) const
Returns length of edge e.
void setBoundaryCosts(adjEntry cornerDir, adjEntry cornerOppDir)
void setExtra(node v, node rep, ATYPE ofs)
Node v has no representation in drawing, only internal representation.
void centerPriority(bool b)
Sets centerPriority (center single edges?)
bool areMulti(edge e1, edge e2) const
Return PG result for flowcompaction.
ATYPE computeTotalCosts(const NodeArray< ATYPE > &pos) const
Computes the total costs for coordintes given by pos, i.e., the sum of the weighted lengths of edges ...
int m_vertexArcCost
get small cages
Dynamic arrays indexed with edges.
void init()
Reinitializes the array. Associates the array with no graph.
Class for the representation of edges.
Data type for general directed graphs (adjacency list representation).
NodeType
The type of nodes.
Doubly linked lists (maintaining the length of the list).
Encapsulates a pointer to a list element.
bool valid() const
Returns true iff the iterator points to an element.
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
Maintains input sizes for improvement compaction (deltas and epsilons)
Dynamic arrays indexed with nodes.
void init()
Reinitializes the array. Associates the array with no graph.
Class for the representation of nodes.
int degree() const
Returns the degree of the node (indegree + outdegree).
Orthogonal representation of an embedded graph.
static OrthoDir prevDir(OrthoDir d)
Returns the previous OrthoDir (in a clockwise manner)
static OrthoDir nextDir(OrthoDir d)
Returns the next OrthoDir (in a clockwise manner)
Planarized representations (of a connected component) of a graph.
Maintains input sizes for constructive compaction (size of routing channels, separation,...
Encapsulates a pointer to an ogdf::SList element.
bool valid() const
Returns true iff the iterator points to an element.
Tuples of two elements (2-tuples).
#define OGDF_AUGMENT_COMPARER(type)
Add this macro to your class to turn it into a full comparer.
#define OGDF_THROW(CLASS)
Replacement for throw.
#define OGDF_HEAVY_ASSERT(expr)
Assert condition expr when using heavy debugging. See OGDF_ASSERT.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
@ ReducibleArc
can be compacted to zero length
@ FixToZeroArc
can be compacted to zero length, can be fixed
@ MedianArc
inserted to replace some reducible in fixzerolength
Represents an interval on the sweep line.
ATYPE m_high
lower and upper bound
friend std::ostream & operator<<(std::ostream &os, const Interval &interval)
output operator
Interval(node v, ATYPE low, ATYPE high)
node m_pathNode
corresponding segment
Information about a side of a vertex in UML diagrams.
Further information about the cages of vertices in UML diagrams.