Adaptagrams
nodeconfig.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libdialect - A library for computing DiAlEcT layouts:
5  * D = Decompose/Distribute
6  * A = Arrange
7  * E = Expand/Emend
8  * T = Transform
9  *
10  * Copyright (C) 2018 Monash University
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  * See the file LICENSE.LGPL distributed with the library.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  * Author(s): Steve Kieffer <http://skieffer.info>
23 */
24 
25 #ifndef DIALECT_NODECONFIG_H
26 #define DIALECT_NODECONFIG_H
27 
28 #include "libdialect/commontypes.h"
29 #include "libdialect/graphs.h"
30 #include "libdialect/util.h"
31 #include "libdialect/aca.h"
32 #include "libdialect/quadaction.h"
33 #include "libdialect/logging.h"
34 
35 namespace dialect {
36 
48  bool avoidFlatTriangles = true;
49 
55  bool includeLinks = false;
56 };
57 
63 public:
68  OrthoHubLayout(Graph_SP G, OrthoHubLayoutOptions opts);
69 
73  void layout(Logger *logger=nullptr);
74 
75 private:
76 
77  bool makesFlatTriangle(const Assignment_SP &asgn);
78  Assignments getAssignmentsForNode(const Node_SP &node) const;
79 
80  Graph_SP m_graph;
81  OrthoHubLayoutOptions m_opts;
82  ColaGraphRep &m_cgr;
83  ColaOptions m_colaOpts;
84  ACALayout m_aca;
85  Nodes m_hubs;
86  // We can use a dense data structure, Matrix2d, for the edge lookup, because
87  // edges name rectangles by the latter's index in the rectangles vector. Therefore if the size of
88  // the matrix equals that of the rectangles vector, there is always a place for every index.
89  Matrix2d<size_t> m_edgeLookup;
90  // On the other hand, we must use a sparse data structure for the node adjacency matrix, since
91  // there can easily be a Node ID that is greater than or equal to the total number of Nodes in
92  // the Graph. For example, such a situation is especially common in cases where a Graph has been
93  // broken into separate pieces.
94  SparseIdMatrix2d<unsigned>::type m_adjMat;
95 };
96 
97 
98 } // namespace dialect
99 
100 #endif // DIALECT_NODECONFIG_H
OrthoHubLayout(Graph_SP G, OrthoHubLayoutOptions opts)
Standard constructor.
Definition: nodeconfig.cpp:46
Provides a simple way to set any or all of the various optional arguments to libcola layout methods...
Definition: graphs.h:105
Options to control OrthoHubLayout.
Definition: nodeconfig.h:38
libdialect: A library for computing human-like orthogonal network (DiAlEcT) layouts.
Definition: cola.h:44
void layout(Logger *logger=nullptr)
Try to orthogonalise hubs.
Definition: nodeconfig.cpp:126
Implements the Adaptive Constrained Alignment (ACA) algorithm.
Definition: aca.h:124
A layout object that tries to orthogonalise hubs. This means it visits nodes of degrees 3 or higher...
Definition: nodeconfig.h:62
bool avoidFlatTriangles
Definition: nodeconfig.h:48
Bundles those data structures required in order to represent a Graph in libcola, and to map infomrati...
Definition: graphs.h:157
bool includeLinks
Definition: nodeconfig.h:55