Adaptagrams
connected_components.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libcola - A library providing force-directed network layout using the
5  * stress-majorization method subject to separation constraints.
6  *
7  * Copyright (C) 2006-2008 Monash University
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  * See the file LICENSE.LGPL distributed with the library.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19 */
20 
21 #ifndef CONNECTED_COMPONENTS_H
22 #define CONNECTED_COMPONENTS_H
23 #include "libcola/cola.h"
24 #include <vector>
25 
26 namespace cola {
27 // a graph component with a list of node_ids giving indices for some larger list of nodes
28 // for the nodes in this component,
29 // and a list of edges - node indices relative to this component
30 class Component {
31 public:
32  std::vector<unsigned> node_ids;
33  std::vector<vpsc::Rectangle*> rects;
34  std::vector<cola::Edge> edges;
35  //CompoundConstraints cx, cy;
36  ~Component();
37  void moveRectangles(double x, double y);
38  vpsc::Rectangle* getBoundingBox();
39 };
40 // for a graph of n nodes, return connected components
41 void connectedComponents(
42  const std::vector<vpsc::Rectangle*> &rs,
43  const std::vector<cola::Edge> &es,
44  //const CompoundConstraints &cx,
45  //const CompoundConstraints &cy,
46  std::vector<Component*> &components);
47 
48 // move the contents of each component so that the components do not
49 // overlap.
50 void separateComponents(const std::vector<Component*> &components);
51 
52 } // namespace cola
53 
54 #endif // CONNECTED_COMPONENTS_H
A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and sa...
Definition: rectangle.h:78
libcola: Force-directed network layout subject to separation constraints library. ...
Definition: box.cpp:25