25 #ifndef DIALECT_GRAPHS_H 26 #define DIALECT_GRAPHS_H 37 #include "libvpsc/rectangle.h" 38 #include "libcola/compound_constraints.h" 39 #include "libcola/cluster.h" 40 #include "libcola/cola.h" 43 #include "libdialect/commontypes.h" 44 #include "libdialect/constraints.h" 45 #include "libdialect/routing.h" 46 #include "libdialect/ortho.h" 47 #include "libdialect/logging.h" 61 x(x), X(X), y(y), Y(Y) {}
69 x(DBL_MAX), X(-DBL_MAX), y(DBL_MAX), Y(-DBL_MAX) {}
75 std::string
repr(
void)
const;
78 double w(
void)
const {
return X - x; }
81 double h(
void)
const {
return Y - y; }
125 double makeFeasible_yBorder = 0;
159 std::vector<cola::Edge> es;
170 bool operator()(id_type i,
const std::pair<id_type, Node_SP> &p)
const {
173 bool operator()(
const std::pair<id_type, Node_SP> &p, id_type i)
const {
194 swap(first.m_debugOutputPath, second.m_debugOutputPath);
195 swap(first.m_projectionDebugLevel, second.m_projectionDebugLevel);
196 swap(first.m_sepMatrix, second.m_sepMatrix);
197 swap(first.m_iel, second.m_iel);
198 swap(first.m_cgr, second.m_cgr);
199 swap(first.m_needNewRectangles, second.m_needNewRectangles);
200 swap(first.m_cfdl, second.m_cfdl);
201 swap(first.m_nodes, second.m_nodes);
202 swap(first.m_edges, second.m_edges);
203 swap(first.m_maxDeg, second.m_maxDeg);
224 void addNode(Node_SP node,
bool takeOwnership =
true);
234 Node_SP
addNode(
double w,
double h);
242 Node_SP
addNode(
double cx,
double cy,
double w,
double h);
249 void addEdge(Edge_SP edge,
bool takeOwnership =
true);
256 Edge_SP
addEdge(Node_SP src, Node_SP tgt);
263 Edge_SP
addEdge(
const id_type &srcID,
const id_type &tgtID);
268 bool hasNode(
const id_type &
id)
const;
273 bool hasEdge(
const id_type &
id)
const;
339 Node_SP
getNode(
const id_type &
id)
const;
360 bool isEmpty(
void)
const {
return m_nodes.empty(); }
401 const NodesById &ignore = NodesById(),
402 bool includeBends =
false 418 void getChainsAndCycles(std::vector<std::deque<Node_SP>> &chains, std::vector<std::deque<Node_SP>> &cycles);
425 std::string
writeTglf(
bool useExternalIds =
false)
const;
432 std::string
writeSvg(
bool useExternalIds =
false)
const;
657 std::string m_debugOutputPath =
"";
658 unsigned m_projectionDebugLevel = 0;
661 SepMatrix m_sepMatrix;
668 double m_edge_thickness = 10;
678 double autoInferIEL(
void);
682 void recomputeMaxDegree(
void);
685 double computeStress(
void);
688 void rotate90(PlaneMap nodeMap, std::function<
void(Edge_SP)> edgeMap,
SepTransform st,
ColaOptions *opts=
nullptr);
694 bool m_needNewRectangles =
true;
703 unsigned m_maxDeg = 0;
707 std::stack<std::map<id_type, Avoid::Point>> m_posStack;
722 static Node_SP
allocate(
double w,
double h);
725 static Node_SP
allocate(
double cx,
double dy,
double w,
double h);
734 virtual ~Node(
void) =
default;
739 virtual id_type
id(
void)
const {
return m_ID; }
755 void addEdge(
const Edge_SP &edge);
821 void setDims(
double w,
double h);
849 bool isRoot(
void)
const {
return m_isRoot; }
869 std::string
writeSvg(
bool useExternalId =
false)
const;
880 Node(
double w,
double h) :
m_ID(nextID++), m_w(w), m_h(h) {}
883 Node(
double cx,
double cy,
double w,
double h) :
m_ID(nextID++), m_cx(cx), m_cy(cy), m_w(w), m_h(h) {}
901 static id_type nextID;
905 Graph *m_graph =
nullptr;
908 EdgesById m_edges_by_opp_id;
911 unsigned m_degree = 0;
928 bool m_isRoot =
false;
951 virtual id_type
id(
void)
const {
952 return m_doMasquerade ? m_originalNodeId :
m_ID;
975 m_doMasquerade(false),
976 m_originalNodeId(node.
id())
999 id_type m_originalNodeId;
1015 static Edge_SP
allocate(
const Node_SP &src,
const Node_SP &tgt);
1021 ~Edge(
void) =
default;
1026 id_type
id(
void)
const {
return m_ID; }
1042 std::pair<id_type, id_type>
getEndIds(
void)
const {
return {Node_SP(m_src)->id(), Node_SP(m_tgt)->id()}; }
1061 void setRoute(std::vector<Avoid::Point> route);
1066 std::vector<Avoid::Point>
getRoute(
void)
const {
return m_route; }
1136 Edge(
const Node_SP &src,
const Node_SP &tgt);
1140 Edge(
void) =
delete;
1143 static id_type nextID;
1150 Graph *m_graph =
nullptr;
1162 std::vector<Avoid::Point> m_route;
1176 #endif // DIALECT_GRAPHS_H bool makeFeasible
When using a ConstrainedFDLayout, do makeFeasible before running?
Definition: graphs.h:121
void removeEdge(const dialect::Edge &edge)
Remove an incident Edge.
Definition: nodes.cpp:71
bool hasNode(const id_type &id) const
Say whether this Graph has a Node of the given ID.
Definition: graphs.cpp:203
void setDims(double w, double h)
Set the dimensions of the node.
Definition: nodes.cpp:98
BoundingBox(double x, double X, double y, double Y)
Standard constructor.
Definition: graphs.h:60
unsigned getDegree(void) const
Check the degree (number of incident Edges) of the Node.
Definition: graphs.h:744
std::vector< Node_SP > severNodeNotingNeighbours(const dialect::Node &node)
Like severNode but also returns a vector of all Nodes that were neighbours before severing...
Definition: graphs.cpp:228
void removeNodes(const NodesById &nodes)
Remove several Nodes from this Graph.
Definition: graphs.cpp:249
The Graph class represents graphs consisting of nodes and edges.
Definition: graphs.h:180
unsigned int ConnDirFlags
One or more Avoid::ConnDirFlag options.
Definition: connend.h:83
std::string writeSvg(bool useExternalIds=false) const
Write SVG to represent this Graph.
Definition: graphs.cpp:573
double w(void) const
Get the width of the box.
Definition: graphs.h:78
void setCorrespondingConstraints(Graph &H)
Set corresponding constraints in another Graph. This means that for each constraint between nodes of ...
Definition: graphs.cpp:1379
void severEdge(dialect::Edge &edge)
Sever an Edge in this Graph.
Definition: graphs.cpp:211
bool hasSameLayoutAs(const Graph &other, double tol=0.001, id_map *idMap=nullptr) const
Check whether this Graph has the same layout as another, up to a given tolerance. ...
Definition: graphs.cpp:777
std::map< size_t, id_type > ix2id
The inverse mapping, from indices in the rs Rectangles vector to Node IDs:
Definition: graphs.h:164
void translate(double dx, double dy)
Translate the entire layout by a given amount in each dimension.
Definition: graphs.cpp:759
The x-dimension (0).
Definition: rectangle.h:45
std::string writeIx2Id(void) const
Write the Rectangle Index –> Node ID map. Useful for debugging.
Definition: graphs.cpp:947
void padAllNodes(double dw, double dh)
Add padding to all ndoes.
Definition: graphs.cpp:1284
static GhostNode_SP allocate(const Node &node)
Factory function.
Definition: graphs.h:945
Graph(void)
Default constructor.
Definition: graphs.h:183
Node_SP getSourceEnd(void) const
Get read-only access to the Node at the source end of this Edge.
Definition: graphs.h:1036
Node(double cx, double cy, double w, double h)
Construct with position and dimensions.
Definition: graphs.h:883
void rotate180(void)
Rotate the connector route 180 degrees.
Definition: edges.cpp:279
Standard libavoid include file which includes all libavoid header files.
Nodes getBendNodes(void)
Access the Edge's bend nodes.
Definition: graphs.h:1094
size_t getNumEdges(void) const
Say how many Edges there are in this Graph.
Definition: graphs.h:357
double h(void) const
Get the height of the box.
Definition: graphs.h:81
void addRoutePoint(double x, double y)
Add a point to the route.
Definition: edges.cpp:101
void updateYCoordFromRect(vpsc::Rectangle *r)
Update the y-coordinate of this Node to equal that of the given Rectangle.
Definition: nodes.cpp:156
id_type id(void) const
Access the unique ID of this instance.
Definition: graphs.h:1026
void setIsRoot(bool isRoot)
Say whether this Node is a root. This is useful when working with trees, and can be safely ignored wh...
Definition: graphs.h:853
std::string writeRouteTglf(void) const
Write TGLF to represent the route for this Edge.
Definition: edges.cpp:105
int getExternalId(void)
Get the external ID.
Definition: graphs.h:804
void addEdge(const Edge_SP &edge)
Add an incident Edge.
Definition: nodes.cpp:60
A bounding box, given by the extreme coordinates.
Definition: graphs.h:52
double idealEdgeLength
Definition: graphs.h:108
bool xAxis
Work in the x-dimension?
Definition: graphs.h:117
LineSegment_SP buildSideSegment(CardinalDir side) const
Build a LineSegment representing a side of the box.
Definition: graphs.cpp:103
dialect::Nodes getNeighboursCwCyclic(void) const
Get the neighbours of this Node, listed in clockwise cyclic order (assuming the usual graphics conven...
Definition: nodes.cpp:169
A default functor that is called after each iteration of the layout algorithm.
Definition: cola.h:216
~Graph(void)
Destructor.
Definition: graphs.cpp:134
cola::CompoundConstraints ccs
Definition: graphs.h:141
A dynamic Polygon, to which points can be easily added and removed.
Definition: geomtypes.h:207
bool liesOppositeSegment(const LineSegment &seg, bool openInterval=false)
Check whether this Node lies opposite a LineSegment, i.e. whether the sides of the Node lying paralle...
Definition: nodes.cpp:240
void applyPlaneMap(PlaneMap map)
Apply a mapping from libavoid Points to libavoid Points, to this Node's centre.
Definition: nodes.cpp:92
Avoid::Point centre(void) const
Get the centre of the box.
Definition: graphs.h:89
Provides a simple way to set any or all of the various optional arguments to libcola layout methods...
Definition: graphs.h:105
void setPosesInCorrespNodes(Graph &H)
Update positions of Nodes in a given Graph to equal those of the corresponding Nodes (same ID) in thi...
Definition: graphs.cpp:1291
NodesById getNodeLookupWithIgnore(const Nodes &ignore) const
Build a NodesById lookup with some Nodes omitted.
Definition: graphs.cpp:321
dimensions getHalfDimensions(void) const
Get an ordered pair (half-width, half-height) for this Node.
Definition: nodes.cpp:127
libdialect: A library for computing human-like orthogonal network (DiAlEcT) layouts.
Definition: cola.h:44
Graph * getGraph(void)
Access the Graph to which the Node belongs.
Definition: graphs.h:752
EdgesById solidEdgeExemptions
Specify edges that should not be solidified.
Definition: graphs.h:115
std::string writeRoundedOrthoConnectorData(void) const
Write the data for an orthogonal SVG path for this Edge's connector route, using rounded bends...
Definition: edges.cpp:167
std::string writeSvg(void) const
Write SVG to represent this Edge.
Definition: edges.cpp:131
const EdgesById & getEdgeLookup(void) const
Read-only access to this Graph's lookup map for Edges by their ID.
Definition: graphs.h:351
id_type trueID(void) const
Simple way to get the true ID of this GhostNode, even if it is currently set to masquerade as the Nod...
Definition: graphs.h:957
std::vector< Graph_SP > getConnComps(void) const
Get the connected components of this Graph.
Definition: graphs.cpp:378
bool yAxis
Work in the y-dimension?
Definition: graphs.h:119
void translate(double dx, double dy)
Update the position of the node, by adding to its centre coordinates.
Definition: nodes.cpp:87
SepMatrix & getSepMatrix(void)
Access the separation matrix for this Graph.
Definition: graphs.h:586
bool useScaling
If using a ConstrainedMajorizationLayout, say whether you want scaling.
Definition: graphs.h:137
double nbrStressIELScalar
Definition: graphs.h:132
std::string writeSvg(bool useExternalId=false) const
Write SVG to represent this Node.
Definition: nodes.cpp:212
unsigned getMaxDegree(void) const
Reports the maximum degree of any Node in this Graph.
Definition: graphs.cpp:145
void setGraph(Graph &graph)
Tell the Edge which Graph it belongs to.
Definition: graphs.h:1047
virtual ~Node(void)=default
Destructor.
double makeFeasible_xBorder
Definition: graphs.h:124
Edge & operator=(const dialect::Edge &)=default
Copy-assignment operator.
Definition: constraints.h:492
This option, provided for convenience, specifies the point should be given visibility to all four sid...
Definition: connend.h:79
void putInBasePosition(void)
Put the Graph into a basic position useful for making unit test inputs. The Nodes are put in a row...
Definition: graphs.cpp:766
EdgesById m_edges
Lookup table for incident Edges by Edge's ID:
Definition: graphs.h:897
const EdgesById & getEdgeLookup(void) const
Read-only access to this Node's lookup map for Edges by their ID.
Definition: graphs.h:761
std::map< id_type, size_t > id2ix
A mapping from Node IDs to indices in the rs Rectangles vector:
Definition: graphs.h:162
bool popNodePositions(void)
Restore node positions from internal stack.
Definition: graphs.cpp:1268
void sever(void)
"Sever" this Edge, i.e. remove it from the Nodes to which it is attached.
Definition: edges.cpp:74
void setExternalId(unsigned id)
Set an externally-determined ID. (This is useful for TGLF and other interfacing operations.)
Definition: graphs.h:801
BoundingBox getBoundingBox(const NodesById &ignore=NodesById(), bool includeBends=false) const
Get the bounding box for this Graph.
Definition: graphs.cpp:355
SepTransform
Definition: constraints.h:83
virtual id_type id(void) const
Return an appropriate ID number.
Definition: graphs.h:951
void getChainsAndCycles(std::vector< std::deque< Node_SP >> &chains, std::vector< std::deque< Node_SP >> &cycles)
Identify all sequences of consecutive "links" (degree-2 nodes) in this graph.
Definition: graphs.cpp:442
std::vector< double > EdgeLengths
Definition: cola.h:72
void setBoundingBox(double x, double X, double y, double Y)
Set the bounding box of the node. This sets both the dimensions and the centre point.
Definition: nodes.cpp:108
bool isEmpty(void) const
Say whether the Graph is empty, meaning that it has no Nodes.
Definition: graphs.h:360
bool solidifyAlignedEdges
Definition: graphs.h:113
void rotate180(void)
Rotate the layout – and the constraints – 180 degrees.
Definition: graphs.cpp:744
double perimeter(void) const
Compute the perimeter of the box.
Definition: graphs.h:95
double getIEL(void)
Read the ideal edge length of this Graph.
Definition: graphs.cpp:608
std::pair< id_type, id_type > getEndIds(void) const
Get a pair {srcID, tgtID} giving the IDs of the source and target Nodes.
Definition: graphs.h:1042
virtual id_type id(void) const
Access the unique ID of a given instance.
Definition: graphs.h:739
void pushNodePositions(void)
Save node positions on internal stack.
Definition: graphs.cpp:1257
bool hasEdge(const id_type &id) const
Say whether this Graph has an Edge of the given ID.
Definition: graphs.cpp:207
const id_type m_ID
An instance's own unique ID:
Definition: graphs.h:889
Node(void)
Default constructor.
Definition: graphs.h:877
const NodesById & getNodeLookup(void) const
Read-only access to this Graph's lookup map for Nodes by their ID.
Definition: graphs.h:342
ColaGraphRep & updateColaGraphRep(void)
Refresh, as needed, the data structures necessary for applying the methods of libcola to this Graph...
Definition: graphs.cpp:631
void severAndRemoveNode(const dialect::Node &node)
Convenience method to completely remove a Node from the Graph.
Definition: graphs.cpp:276
std::vector< Rectangle * > Rectangles
A vector of pointers to Rectangle objects.
Definition: rectangle.h:246
static Node_SP allocate(void)
Factory function, to get a shared pointer to a Node allocated on the heap. We make the constructors p...
Definition: nodes.cpp:43
void updatePosnFromRect(vpsc::Rectangle *r)
Update the position of this Node to equal that of the given Rectangle.
Definition: nodes.cpp:147
void clearAllRoutes(void)
Clear all Edge routes.
Definition: graphs.cpp:1346
void setRoutesInCorrespEdges(Graph &H, bool directed=false)
Update routes of Edges in a given Graph to equal those of the corresponding Edges (same source and ta...
Definition: graphs.cpp:1311
GhostNode(const Node &node)
We always make a GhostNode as a copy of a plain Node.
Definition: graphs.h:973
bool preventOverlaps
Prevent overlaps between nodes?
Definition: graphs.h:110
Avoid::Polygon makeLibavoidPolygon(void) const
Build and return a Polygon to represent this Node in libavoid.
Definition: nodes.cpp:230
A default functor that is called before each iteration in the main loop of the ConstrainedFDLayout::r...
Definition: cola.h:168
Node_SP getNode(const id_type &id) const
Look up a Node by ID.
Definition: graphs.cpp:314
Holds the cluster hierarchy specification for a diagram.
Definition: cluster.h:172
void setBendNodes(Nodes bends)
Set the bend nodes. These should be Nodes representing the bend points in the Edge's route...
Definition: graphs.h:1088
bool applyProjSeq(const ColaOptions &opts, ProjSeq &ps, int accept=0)
Attempt to apply the projections given by a ProjSeq object. Give up as soon as any of them fails...
Definition: graphs.cpp:1052
Node(double w, double h)
Construct with dimensions.
Definition: graphs.h:880
std::pair< Avoid::ConnEnd, Avoid::ConnEnd > makeLibavoidConnEnds(Avoid::ConnDirFlags srcDirs=Avoid::ConnDirAll, Avoid::ConnDirFlags tgtDirs=Avoid::ConnDirAll)
Build and return a pair of libavoid ConnEnds to represent the endpoints of this Edge.
Definition: edges.cpp:113
EdgesById getCopyOfEdgeLookup(void) const
Get a copy of this Node's lookup map for Edges by their ID.
Definition: graphs.h:764
RouterFlag
Flags that can be passed to the router during initialisation to specify options.
Definition: router.h:70
The Point class defines a point in the plane.
Definition: geomtypes.h:52
interval getInterval(vpsc::Dim dim)
Get the interval in a given dimension.
Definition: graphs.h:86
void destress(void)
Convenience method to destress with default options.
Definition: graphs.cpp:849
void setMasquerade(bool doMasquerade)
Say whether the GhostNode should masquerade as the original Node.
Definition: graphs.h:968
ColaGraphRep & getColaGraphRep(void)
Access the cola graph rep for this Graph.
Definition: graphs.h:583
BoundingBox getBoundingBox(void) const
Get the bounding box for the edge, including its end points and route points.
Definition: edges.cpp:81
The Edge class represents edges in a graph.
Definition: graphs.h:1006
virtual dialect::Nodes getChildren(void) const
Get the neighbours of this Node that sit as the target end of the connecting Edge.
Definition: nodes.cpp:181
BoundingBox & operator+=(const BoundingBox &rhs)
Adding two bounding boxes returns the bounding box of their union.
Definition: graphs.cpp:91
Node_SP getTargetEnd(void) const
Get read-only access to the Node at the target end of this Edge.
Definition: graphs.h:1039
double computeAvgNodeDim(void) const
Compute the average of all heights and widths of Nodes in this Graph.
Definition: graphs.cpp:343
Avoid::Point getCentre(void) const
Get the centre coordinates of the node.
Definition: nodes.cpp:135
dialect::Node & operator=(const dialect::Node &)=default
Copy-assignment operator.
void rotate90cw(void)
Rotate the connector route 90 degrees clockwise.
Definition: edges.cpp:269
bool isRoot(void) const
Check whether this Node has been marked as being a root. This is useful when working with trees...
Definition: graphs.h:849
void updateXCoordFromRect(vpsc::Rectangle *r)
Update the x-coordinate of this Node to equal that of the given Rectangle.
Definition: nodes.cpp:152
dialect::Nodes getNeighbours(void) const
Get the neighbours of this Node.
Definition: nodes.cpp:160
A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and sa...
Definition: rectangle.h:78
std::string writeId2Ix(void) const
Write the Node ID –> Rectangle Index map. Useful for debugging.
Definition: graphs.cpp:941
void solidifyAlignedEdges(vpsc::Dim dim, const ColaOptions &opts)
Add Nodes to represent aligned Edges in one dimension, constraining them to stay aligned.
Definition: graphs.cpp:1094
void rotate90acw(ColaOptions *opts=nullptr)
Rotate the layout – and the constraints – 90 degrees anticlockwise.
Definition: graphs.cpp:703
std::string repr(void) const
Write a simple representation of the bounding box.
Definition: graphs.cpp:99
void buildRouteFromBends(void)
Build a connector route based on the bend nodes.
Definition: edges.cpp:297
SparseIdMatrix2d< Edge_SP >::type getEdgeBySrcIdTgtIdLookup(void) const
Get a lookup for the Edges of this Graph by the IDs of their source and target Nodes, in that order.
Definition: graphs.cpp:838
BoundingBox(void)
Default constructor.
Definition: graphs.h:68
BoundingBox getBoundingBox(void) const
Get the bounding box for this Node.
Definition: nodes.cpp:139
void setRoute(std::vector< Avoid::Point > route)
Set (overwriting) the entire route.
void buildRoutes(void)
Ask all Edges to build their routes based on their bend nodes.
Definition: graphs.cpp:1353
NodesById buildUniqueBendPoints(void)
Build and return Nodes representing every point at which any Edge has a bend in its connector route...
Definition: graphs.cpp:1211
void rotate90acw(void)
Rotate the connector route 90 degrees anticlockwise.
Definition: edges.cpp:274
Dim
Indicates the x- or y-dimension.
Definition: rectangle.h:41
A GhostNode represents another Node.
Definition: graphs.h:939
Implements a constrained force-directed layout algorithm.
Definition: cola.h:622
Avoid::Point getBoundaryCompassPt(CompassDir dir) const
Get the point on the boundary of this Node in a given direction from its centre.
Definition: nodes.cpp:248
void translate(double dx, double dy)
Translate the connector route by a given amount in each dimension.
Definition: edges.cpp:284
void addBendlessSubnetworkToRoutingAdapter(RoutingAdapter &ra)
Add all Nodes, and all those Edges having no bend nodes within them, to a given RoutingAdapter. This is useful when precisely those Edges are viewed as needing a route which do not already have any bend nodes.
Definition: graphs.cpp:1368
void setCentre(double cx, double cy)
Set the position of the node, by setting its centre coordinates.
Definition: nodes.cpp:82
std::string writeTglf(bool useExternalIds=false) const
Write TGLF to represent this Graph.
Definition: graphs.cpp:510
cola::RootCluster * buildRootCluster(const ColaOptions &opts)
Build a cola::RootCluster based on the node clusters specified in a ColaOptions object.
Definition: graphs.cpp:667
Nodes cloneNode(id_type id)
Clone a node completely. There will be as many copies of the original node as it had edges...
Definition: graphs.cpp:286
void copyOtherGhostProperties(const dialect::Node &other)
Besides copying geometry, there may be other properties we wish to copy; in particular, properties that are suitable to be copied by a GhostNode.
Definition: nodes.cpp:123
void addEdge(Edge_SP edge, bool takeOwnership=true)
Add an Edge to this Graph.
Definition: graphs.cpp:179
double getEdgeThickness(void)
Get the edge thickness.
Definition: graphs.h:611
int projectOntoSepCo(const ColaOptions &opts, SepCo_SP sepco, int accept=0)
Convenience method to project onto a single SepCo object. Apart from the SepCo, parameters and return...
Definition: graphs.cpp:1045
The Node class represents nodes in a graph.
Definition: graphs.h:713
std::vector< NodesById > nodeClusters
Collection of Node lookups, in which to register clusters.
Definition: graphs.h:143
void addBendNode(Node_SP bn)
Add a single bend node.
Definition: graphs.h:1091
static Edge_SP allocate(const Node_SP &src, const Node_SP &tgt)
Factory function.
Definition: edges.cpp:49
double recomputeIEL(void)
Recompute, store, and return the Graph's ideal edge length.
Definition: graphs.cpp:613
int m_externalID
Definition: graphs.h:894
void makeFeasible(const ColaOptions &opts)
Make feasible. This means that, among those constraints that offer alternatives, we look for satisfia...
Definition: graphs.cpp:953
void clearRouteAndBends(void)
Clear the connector route and drop all bend nodes.
Definition: edges.cpp:291
bool isTree(void) const
Say whether the Graph is a tree.
Definition: graphs.h:363
Adapter to easily apply libavoid::Routers to libdialect::Graphs.
Definition: routing.h:57
void copyGeometry(const dialect::Node &other)
Give this Node the same coordinates and dimensions as another.
Definition: nodes.cpp:116
std::string writePolylineConnectorData(void) const
Write the data for a polyline SVG path for this Edge's connector route.
Definition: edges.cpp:154
void severNode(const dialect::Node &node)
Sever all the Edges incident to a Node in this Graph.
Definition: graphs.cpp:221
virtual Nodes getChildren(void) const
As in the Node class, get the neighbours of this Node that sit as the target end of the connecting Ed...
Definition: nodes.cpp:195
Node_SP addNode(void)
Add a new Node to this Graph.
Definition: graphs.cpp:161
std::vector< Avoid::Point > getRoutePoints(void) const
Get route points.
Definition: edges.cpp:123
Useful for set operations on Node lookups.
Definition: graphs.h:169
std::vector< CompoundConstraint * > CompoundConstraints
A vector of pointers to CompoundConstraint objects.
Definition: compound_constraints.h:259
bool useMajorization
Definition: graphs.h:135
void rotate90cw(ColaOptions *opts=nullptr)
Rotate the layout – and the constraints – 90 degrees clockwise.
Definition: graphs.cpp:695
void addPadding(double dw, double dh)
Add padding to the node's dimensions.
Definition: nodes.cpp:103
cola::EdgeLengths eLengths
Definition: graphs.h:147
void route(Avoid::RouterFlag routingType)
Do a libavoid connector routing on all Edges in the Graph.
Definition: graphs.cpp:1360
Logger * logger
Optional logger.
Definition: graphs.h:151
Bundles those data structures required in order to represent a Graph in libcola, and to map infomrati...
Definition: graphs.h:157
dimensions getDimensions(void) const
Get an ordered pair (width, height) for this Node.
Definition: nodes.cpp:131
friend void swap(Graph &first, Graph &second)
Swap operator.
Definition: graphs.h:192
bool hasBendNodes(void)
Check whether this Edge has any bend nodes.
Definition: graphs.h:1097
Node_SP getOtherEnd(const dialect::Node &end1) const
Get the opposite endpt, from a given one.
Definition: edges.cpp:60
void setEdgeThickness(double t)
Set the edge thickness.
Definition: graphs.h:608
void clearAllConstraints(void)
Clear all constraints in this Graph's SepMatrix.
Definition: graphs.cpp:1375
void updateNodesFromRects(bool xAxis=true, bool yAxis=true)
For use with various layout actions, this method asks the Graph to update Node positions based on its...
Definition: graphs.cpp:686
void setGraph(Graph &graph)
Tell the Node which Graph it belongs to.
Definition: graphs.h:749
bool useNeighbourStress
Definition: graphs.h:128
Graph & operator=(const Graph other)
Copy-assignment operator.
Definition: graphs.cpp:139
int project(const ColaOptions &opts, vpsc::Dim dim, int accept=0)
Project onto cola constraints.
Definition: graphs.cpp:1003
~Edge(void)=default
Destructor.
void removeNode(const dialect::Node &node)
Remove a Node from this Graph.
Definition: graphs.cpp:239
GhostNode_SP makeGhost(void) const
Allocate a GhostNode of this Node.
Definition: nodes.cpp:56
std::vector< Avoid::Point > getRoute(void) const
Get a copy of the Edge's route member. May be empty.
Definition: graphs.h:1066
size_t getNumNodes(void) const
Say how many Nodes there are in this Graph.
Definition: graphs.h:354