Topologic  0.8.9
Graph.h
1 // This file is part of Topologic software library.
2 // Copyright(C) 2019, Cardiff University and University College London
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include <TopologicCore/include/Graph.h>
20 
21 #ifdef TOPOLOGIC_DYNAMO
22 using namespace Autodesk::DesignScript::Runtime;
23 #endif
24 
25 using namespace System;
26 using namespace System::Collections::Generic;
27 
28 namespace Topologic {
29  ref class Vertex;
30  ref class Edge;
31  ref class Wire;
32  ref class Topology;
33 
37  public ref class Graph
38  {
39  public:
40 
52 #ifdef TOPOLOGIC_DYNAMO
53  static Graph^ ByTopology(
54  Topology^ topology,
55  [DefaultArgument("true")] bool direct,
56  [DefaultArgument("false")] bool viaSharedTopologies,
57  [DefaultArgument("false")] bool viaSharedApertures,
58  [DefaultArgument("false")] bool toExteriorTopologies,
59  [DefaultArgument("false")] bool toExteriorApertures,
60  [DefaultArgument("false")] bool useFaceInternalVertex,
61  [DefaultArgument("0.0001")] double tolerance);
62 #else
63  static Graph^ ByTopology(
64  Topology^ topology,
65  bool direct,
66  bool viaSharedTopologies,
67  bool viaSharedApertures,
68  bool toExteriorTopologies,
69  bool toExteriorApertures,
70  bool useFaceInternalVertex,
71  double tolerance);
72 #endif
73 
78  property List<Vertex^>^ Vertices
79  {
80  List<Vertex^>^ get();
81  }
82 
87  property List<Vertex^>^ IsolatedVertices
88  {
89  List<Vertex^>^ get();
90  }
91 
96  property List<Edge^>^ Edges
97  {
98  List<Edge^>^ get();
99  }
100 
105  property Topology^ Topology
106  {
107  Topologic::Topology^ get();
108  }
109 
118  List<Vertex^>^ VerticesAtCoordinates(
119  double x, double y, double z,
120 #ifdef TOPOLOGIC_DYNAMO
121  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
122 #endif
123  double tolerance);
124 
131  Graph^ AddVertices(
132  List<Vertex^>^ vertices,
133 #ifdef TOPOLOGIC_DYNAMO
134  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
135 #endif
136  double tolerance);
137 
144  Graph^ AddEdges(
145  List<Edge^>^ edges,
146 #ifdef TOPOLOGIC_DYNAMO
147  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
148 #endif
149  double tolerance);
150 
158  Graph^ Connect(
159  Vertex^ vertex1,
160  Vertex^ vertex2,
161 #ifdef TOPOLOGIC_DYNAMO
162  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
163 #endif
164  double tolerance);
165 
171  int VertexDegree(Vertex^ vertex);
172 
178  List<Vertex^>^ AdjacentVertices(Vertex^ vertex);
179 
186  bool ContainsVertex(Vertex^ vertex,
187 #ifdef TOPOLOGIC_DYNAMO
188  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
189 #endif
190  double tolerance);
191 
198  bool ContainsEdge(Edge^ edge,
199 #ifdef TOPOLOGIC_DYNAMO
200  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
201 #endif
202  double tolerance);
203 
208  property List<int>^ DegreeSequence
209  {
210  List<int>^ get();
211  }
212 
217  property double Density
218  {
219  double get();
220  }
221 
226  property bool IsComplete
227  {
228  bool get();
229  }
230 
235  property int MinimumDelta
236  {
237  int get();
238  }
239 
244  property int MaximumDelta
245  {
246  int get();
247  }
248 
253  property int Diameter
254  {
255  int get();
256  }
257 
265  List<Wire^>^ AllPaths(
266  Vertex^ startVertex,
267  Vertex^ endVertex,
268 #ifdef TOPOLOGIC_DYNAMO
269  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
270 #endif
271  Nullable<int> timeLimitInSeconds);
272 
279  Wire^ Path(Vertex^ startVertex, Vertex^ endVertex);
280 
281 
290  Wire^ ShortestPath(Vertex^ startVertex, Vertex^ endVertex,
291 #ifdef TOPOLOGIC_DYNAMO
292  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
293 #endif
294  String^ vertexKey,
295 #ifdef TOPOLOGIC_DYNAMO
296  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
297 #endif
298  String^ edgeKey);
299 
308  List<Wire^>^ ShortestPaths(Vertex^ startVertex, Vertex^ endVertex,
309 #ifdef TOPOLOGIC_DYNAMO
310  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
311 #endif
312  String^ vertexKey,
313 #ifdef TOPOLOGIC_DYNAMO
314  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
315 #endif
316  String^ edgeKey,
317 #ifdef TOPOLOGIC_DYNAMO
318  [Autodesk::DesignScript::Runtime::DefaultArgument("null")]
319 #endif
320  Nullable<int> timeLimitInSeconds);
321 
328  int TopologicalDistance(Vertex^ startVertex, Vertex^ endVertex);
329 
335  bool IsErdoesGallai(List<int>^ sequence);
336 
342  Graph^ RemoveVertices(List<Vertex^>^ vertices);
343 
349  Graph^ RemoveEdges(List<Edge^>^ edges);
350 
358  Edge^ Edge(Vertex^ vertex1, Vertex^ vertex2,
359 #ifdef TOPOLOGIC_DYNAMO
360  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
361 #endif
362  double tolerance);
363 
370  List<Topologic::Edge^>^ IncidentEdges(Vertex^ vertex,
371 #ifdef TOPOLOGIC_DYNAMO
372  [Autodesk::DesignScript::Runtime::DefaultArgument("0.0001")]
373 #endif
374  double tolerance);
375 
376  public protected:
377  Graph();
378 
379  Graph(const std::shared_ptr<TopologicCore::Graph>& kpCoreGraph);
380 
381  protected:
382  virtual ~Graph();
383 
384  std::shared_ptr<TopologicCore::Graph>* m_pCoreGraph;
385  };
386 }
A Vertex is a zero-dimensional entity equivalent to a geometry point.
Definition: Vertex.h:31
A Topology is an abstract superclass that includes constructors, properties and methods used by other...
Definition: Topology.h:53
An Edge is a one-dimensional entity defined by two vertices. It is important to note that while a top...
Definition: Edge.h:31
Topologic is an open-source software modelling library enabling hierarchical and topological represen...
Definition: About.h:23
A Graph consists of a set of Vertices and a set of Edges that connect the Vertices. It is always a Cluster and it can be manifold or non-manifold.
Definition: Graph.h:37
A Wire is a contiguous collection of Edges, where adjacent Edges are connected by shared Vertices...
Definition: Wire.h:32