topologicpy 0.6.3__py3-none-any.whl → 0.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
topologicpy/Graph.py CHANGED
@@ -15,9 +15,6 @@
15
15
  # this program. If not, see <https://www.gnu.org/licenses/>.
16
16
 
17
17
  import topologic_core as topologic
18
- from topologicpy.Dictionary import Dictionary
19
- from topologicpy.Topology import Topology
20
- from topologicpy.Vertex import Vertex
21
18
  import random
22
19
  import time
23
20
  import os
@@ -152,7 +149,7 @@ class Graph:
152
149
 
153
150
  Parameters
154
151
  ----------
155
- graph : topologic.Graph
152
+ graph : topologic_core.Graph
156
153
  The input graph.
157
154
  vertexKey : str , optional
158
155
  If set, the returned list of vertices is sorted according to the dicitonary values stored under this key. The default is None.
@@ -185,7 +182,7 @@ class Graph:
185
182
  from topologicpy.Dictionary import Dictionary
186
183
  from topologicpy.Helper import Helper
187
184
 
188
- if not isinstance(graph, topologic.Graph):
185
+ if not Topology.IsInstance(graph, "Graph"):
189
186
  print("Graph.AdjacencyMatrix - Error: The input graph is not a valid graph. Returning None.")
190
187
  return None
191
188
 
@@ -251,7 +248,7 @@ class Graph:
251
248
 
252
249
  Parameters
253
250
  ----------
254
- graph : topologic.Graph
251
+ graph : topologic_core.Graph
255
252
  The input graph.
256
253
  vertexKey : str , optional
257
254
  If set, the returned list of vertices is sorted according to the dicitonary values stored under this key. The default is None.
@@ -266,10 +263,11 @@ class Graph:
266
263
  The adjacency list.
267
264
  """
268
265
  from topologicpy.Vertex import Vertex
266
+ from topologicpy.Dictionary import Dictionary
269
267
  from topologicpy.Topology import Topology
270
268
  from topologicpy.Helper import Helper
271
269
 
272
- if not isinstance(graph, topologic.Graph):
270
+ if not Topology.IsInstance(graph, "Graph"):
273
271
  print("Graph.AdjacencyList - Error: The input graph is not a valid graph. Returning None.")
274
272
  return None
275
273
  vertices = Graph.Vertices(graph)
@@ -303,9 +301,9 @@ class Graph:
303
301
 
304
302
  Parameters
305
303
  ----------
306
- graph : topologic.Graph
304
+ graph : topologic_core.Graph
307
305
  The input graph.
308
- edges : topologic.Edge
306
+ edge : topologic_core.Edge
309
307
  The input edge.
310
308
  transferDictionaries : bool, optional
311
309
  If set to True, the dictionaries of the edge and its vertices are transfered to the graph.
@@ -314,7 +312,7 @@ class Graph:
314
312
 
315
313
  Returns
316
314
  -------
317
- topologic.Graph
315
+ topologic_core.Graph
318
316
  The input graph with the input edge added to it.
319
317
 
320
318
  """
@@ -349,10 +347,10 @@ class Graph:
349
347
  graph_vertices.append(vertex)
350
348
  return [graph_vertices, returnVertex]
351
349
 
352
- if not isinstance(graph, topologic.Graph):
350
+ if not Topology.IsInstance(graph, "Graph"):
353
351
  print("Graph.AddEdge - Error: The input graph is not a valid graph. Returning None.")
354
352
  return None
355
- if not isinstance(edge, topologic.Edge):
353
+ if not Topology.IsInstance(edge, "Edge"):
356
354
  print("Graph.AddEdge - Error: The input edge is not a valid edge. Returning None.")
357
355
  return None
358
356
  graph_vertices = Graph.Vertices(graph)
@@ -380,23 +378,25 @@ class Graph:
380
378
 
381
379
  Parameters
382
380
  ----------
383
- graph : topologic.Graph
381
+ graph : topologic_core.Graph
384
382
  The input graph.
385
- vertex : topologic.Vertex
383
+ vertex : topologic_core.Vertex
386
384
  The input vertex.
387
385
  tolerance : float , optional
388
386
  The desired tolerance. The default is 0.0001.
389
387
 
390
388
  Returns
391
389
  -------
392
- topologic.Graph
390
+ topologic_core.Graph
393
391
  The input graph with the input vertex added to it.
394
392
 
395
393
  """
396
- if not isinstance(graph, topologic.Graph):
394
+ from topologicpy.Topology import Topology
395
+
396
+ if not Topology.IsInstance(graph, "Graph"):
397
397
  print("Graph.AddVertex - Error: The input graph is not a valid graph. Returning None.")
398
398
  return None
399
- if not isinstance(vertex, topologic.Vertex):
399
+ if not Topology.IsInstance(vertex, "Vertex"):
400
400
  print("Graph.AddVertex - Error: The input vertex is not a valid vertex. Returning None.")
401
401
  return None
402
402
  _ = graph.AddVertices([vertex], tolerance)
@@ -409,7 +409,7 @@ class Graph:
409
409
 
410
410
  Parameters
411
411
  ----------
412
- graph : topologic.Graph
412
+ graph : topologic_core.Graph
413
413
  The input graph.
414
414
  vertices : list
415
415
  The input list of vertices.
@@ -418,17 +418,19 @@ class Graph:
418
418
 
419
419
  Returns
420
420
  -------
421
- topologic.Graph
421
+ topologic_core.Graph
422
422
  The input graph with the input vertex added to it.
423
423
 
424
424
  """
425
- if not isinstance(graph, topologic.Graph):
425
+ from topologicpy.Topology import Topology
426
+
427
+ if not Topology.IsInstance(graph, "Graph"):
426
428
  print("Graph.AddVertices - Error: The input graph is not a valid graph. Returning None.")
427
429
  return None
428
430
  if not isinstance(vertices, list):
429
431
  print("Graph.AddVertices - Error: The input list of vertices is not a valid list. Returning None.")
430
432
  return None
431
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
433
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
432
434
  if len(vertices) < 1:
433
435
  print("Graph.AddVertices - Error: Could not find any valid vertices in the input list of vertices. Returning None.")
434
436
  return None
@@ -442,9 +444,9 @@ class Graph:
442
444
 
443
445
  Parameters
444
446
  ----------
445
- graph : topologic.Graph
447
+ graph : topologic_core.Graph
446
448
  The input graph.
447
- vertex : topologic.Vertex
449
+ vertex : topologic_core.Vertex
448
450
  the input vertex.
449
451
 
450
452
  Returns
@@ -453,10 +455,12 @@ class Graph:
453
455
  The list of adjacent vertices.
454
456
 
455
457
  """
456
- if not isinstance(graph, topologic.Graph):
458
+ from topologicpy.Topology import Topology
459
+
460
+ if not Topology.IsInstance(graph, "Graph"):
457
461
  print("Graph.AdjacentVertices - Error: The input graph is not a valid graph. Returning None.")
458
462
  return None
459
- if not isinstance(vertex, topologic.Vertex):
463
+ if not Topology.IsInstance(vertex, "Vertex"):
460
464
  print("Graph.AdjacentVertices - Error: The input vertex is not a valid vertex. Returning None.")
461
465
  return None
462
466
  vertices = []
@@ -470,11 +474,11 @@ class Graph:
470
474
 
471
475
  Parameters
472
476
  ----------
473
- graph : topologic.Graph
477
+ graph : topologic_core.Graph
474
478
  The input graph.
475
- vertexA : topologic.Vertex
479
+ vertexA : topologic_core.Vertex
476
480
  The first input vertex.
477
- vertexB : topologic.Vertex
481
+ vertexB : topologic_core.Vertex
478
482
  The second input vertex.
479
483
  timeLimit : int , optional
480
484
  The time limit in second. The default is 10 seconds.
@@ -485,13 +489,15 @@ class Graph:
485
489
  The list of all paths (wires) found within the time limit.
486
490
 
487
491
  """
488
- if not isinstance(graph, topologic.Graph):
492
+ from topologicpy.Topology import Topology
493
+
494
+ if not Topology.IsInstance(graph, "Graph"):
489
495
  print("Graph.AllPaths - Error: The input graph is not a valid graph. Returning None.")
490
496
  return None
491
- if not isinstance(vertexA, topologic.Vertex):
497
+ if not Topology.IsInstance(vertexA, "Vertex"):
492
498
  print("Graph.AllPaths - Error: The input vertexA is not a valid vertex. Returning None.")
493
499
  return None
494
- if not isinstance(vertexB, topologic.Vertex):
500
+ if not Topology.IsInstance(vertexB, "Vertex"):
495
501
  print("Graph.AllPaths - Error: The input vertexB is not a valid vertex. Returning None.")
496
502
  return None
497
503
  paths = []
@@ -505,7 +511,7 @@ class Graph:
505
511
 
506
512
  Parameters
507
513
  ----------
508
- graph : topologic.Graph
514
+ graph : topologic_core.Graph
509
515
  The input graph.
510
516
  mantissa : int , optional
511
517
  The desired length of the mantissa. The default is 6.
@@ -516,10 +522,9 @@ class Graph:
516
522
  The average clustering coefficient of the input graph.
517
523
 
518
524
  """
519
- from topologicpy.Vertex import Vertex
520
- import topologic_core as topologic
525
+ from topologicpy.Topology import Topology
521
526
 
522
- if not isinstance(graph, topologic.Graph):
527
+ if not Topology.IsInstance(graph, "Graph"):
523
528
  print("Graph.LocalClusteringCoefficient - Error: The input graph parameter is not a valid graph. Returning None.")
524
529
  return None
525
530
  vertices = Graph.Vertices(graph)
@@ -559,7 +564,7 @@ class Graph:
559
564
 
560
565
  Parameters
561
566
  ----------
562
- graph : topologic.Graph
567
+ graph : topologic_core.Graph
563
568
  The input graph.
564
569
  bidirectional : bool , optional
565
570
  If set to True, reverse relationships are created wherever possible. Otherwise, they are not. The default is False.
@@ -608,6 +613,8 @@ class Graph:
608
613
  """
609
614
 
610
615
  from topologicpy.Helper import Helper
616
+ from topologicpy.Dictionary import Dictionary
617
+ from topologicpy.Topology import Topology
611
618
  import os
612
619
  import warnings
613
620
 
@@ -648,7 +655,7 @@ class Graph:
648
655
  bot_graph.add((site_uri, rdf.type, bot.Site))
649
656
  if includeLabel:
650
657
  bot_graph.add((site_uri, RDFS.label, Literal(siteLabel)))
651
- if isinstance(siteDictionary, topologic.Dictionary):
658
+ if Topology.IsInstance(siteDictionary, "Dictionary"):
652
659
  keys = Dictionary.Keys(siteDictionary)
653
660
  for key in keys:
654
661
  value = Dictionary.ValueAtKey(siteDictionary, key)
@@ -659,7 +666,7 @@ class Graph:
659
666
  bot_graph.add((building_uri, rdf.type, bot.Building))
660
667
  if includeLabel:
661
668
  bot_graph.add((building_uri, RDFS.label, Literal(buildingLabel)))
662
- if isinstance(buildingDictionary, topologic.Dictionary):
669
+ if Topology.IsInstance(buildingDictionary, "Dictionary"):
663
670
  keys = Dictionary.Keys(buildingDictionary)
664
671
  for key in keys:
665
672
  value = Dictionary.ValueAtKey(buildingDictionary, key)
@@ -789,7 +796,7 @@ class Graph:
789
796
 
790
797
  Parameters
791
798
  ----------
792
- graph : topologic.Graph
799
+ graph : topologic_core.Graph
793
800
  The input graph.
794
801
  format : str , optional
795
802
  The desired output format, the options are listed below. Thde default is "turtle".
@@ -876,7 +883,7 @@ class Graph:
876
883
 
877
884
  Parameters
878
885
  ----------
879
- graph : topologic.Graph
886
+ graph : topologic_core.Graph
880
887
  The input graph.
881
888
  vertices : list , optional
882
889
  The input list of vertices. The default is None which means all vertices in the input graph are considered.
@@ -894,8 +901,7 @@ class Graph:
894
901
 
895
902
  """
896
903
  from topologicpy.Vertex import Vertex
897
- import sys
898
- import subprocess
904
+ from topologicpy.Topology import Topology
899
905
 
900
906
  def betweeness(vertices, topologies, tolerance=0.001):
901
907
  returnList = [0] * len(vertices)
@@ -907,28 +913,28 @@ class Graph:
907
913
  returnList[index] = returnList[index]+1
908
914
  return returnList
909
915
 
910
- if not isinstance(graph, topologic.Graph):
916
+ if not Topology.IsInstance(graph, "Graph"):
911
917
  print("Graph.BetweenessCentrality - Error: The input graph is not a valid graph. Returning None.")
912
918
  return None
913
919
  graphVertices = Graph.Vertices(graph)
914
920
  if not isinstance(vertices, list):
915
921
  vertices = graphVertices
916
922
  else:
917
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
923
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
918
924
  if len(vertices) < 1:
919
925
  print("Graph.BetweenessCentrality - Error: The input list of vertices does not contain valid vertices. Returning None.")
920
926
  return None
921
927
  if not isinstance(sources, list):
922
928
  sources = graphVertices
923
929
  else:
924
- sources = [v for v in sources if isinstance(v, topologic.Vertex)]
930
+ sources = [v for v in sources if Topology.IsInstance(v, "Vertex")]
925
931
  if len(sources) < 1:
926
932
  print("Graph.BetweenessCentrality - Error: The input list of sources does not contain valid vertices. Returning None.")
927
933
  return None
928
934
  if not isinstance(destinations, list):
929
935
  destinations = graphVertices
930
936
  else:
931
- destinations = [v for v in destinations if isinstance(v, topologic.Vertex)]
937
+ destinations = [v for v in destinations if Topology.IsInstance(v, "Vertex")]
932
938
  if len(destinations) < 1:
933
939
  print("Graph.BetweenessCentrality - Error: The input list of destinations does not contain valid vertices. Returning None.")
934
940
  return None
@@ -972,7 +978,7 @@ class Graph:
972
978
 
973
979
  Returns
974
980
  -------
975
- topologic.Graph
981
+ topologic_core.Graph
976
982
  The created graph.
977
983
 
978
984
  """
@@ -1008,7 +1014,7 @@ class Graph:
1008
1014
 
1009
1015
  Returns
1010
1016
  -------
1011
- topologic.Graph
1017
+ topologic_core.Graph
1012
1018
  The created graph.
1013
1019
 
1014
1020
  """
@@ -1429,7 +1435,7 @@ class Graph:
1429
1435
  z = z + random.randrange(70000,90000, 1000)
1430
1436
  verts.append([x, y, z])
1431
1437
  v = Vertex.ByCoordinates(x, y, z)
1432
- if isinstance(v, topologic.Vertex):
1438
+ if Topology.IsInstance(v, "Vertex"):
1433
1439
  if len(nodeFeaturesKeys) == 0:
1434
1440
  values = [node_id, label, mask, features]
1435
1441
  else:
@@ -1438,7 +1444,7 @@ class Graph:
1438
1444
  featureList = [float(s) for s in featureList]
1439
1445
  values = [node_id, label, mask]+featureList
1440
1446
  d = Dictionary.ByKeysValues(node_keys, values)
1441
- if isinstance(d, topologic.Dictionary):
1447
+ if Topology.IsInstance(d, "Dictionary"):
1442
1448
  v = Topology.SetDictionary(v, d)
1443
1449
  else:
1444
1450
  print("Graph.ByCSVPath - Warning: Failed to create and add a dictionary to the created vertex.")
@@ -1479,9 +1485,9 @@ class Graph:
1479
1485
  if not (src_id == dst_id) and not [src_id, dst_id] in es and not [dst_id, src_id] in es:
1480
1486
  es.append([src_id, dst_id])
1481
1487
  edge = Edge.ByVertices([vertices[src_id], vertices[dst_id]], tolerance=tolerance)
1482
- if isinstance(edge, topologic.Edge):
1488
+ if Topology.IsInstance(edge, "Edge"):
1483
1489
  d = Dictionary.ByKeysValues(edge_keys, values)
1484
- if isinstance(d, topologic.Dictionary):
1490
+ if Topology.IsInstance(d, "Dictionary"):
1485
1491
  edge = Topology.SetDictionary(edge, d)
1486
1492
  else:
1487
1493
  print("Graph.ByCSVPath - Warning: Failed to create and add a dictionary to the created edge.")
@@ -1501,7 +1507,7 @@ class Graph:
1501
1507
  g = Graph.ByVerticesEdges(vertices, edges)
1502
1508
  temp_v = Graph.Vertices(g)
1503
1509
  temp_e = Graph.Edges(g)
1504
- if isinstance(g, topologic.Graph):
1510
+ if Topology.IsInstance(g, "Graph"):
1505
1511
  if len(graphFeaturesKeys) == 0:
1506
1512
  values = [graph_ids[i], graph_labels[i], graph_features[i]]
1507
1513
  else:
@@ -1515,7 +1521,7 @@ class Graph:
1515
1521
  print("Graph.ByCSVPath - Error: The length of the keys and values lists do not match. Returning None.")
1516
1522
  return None
1517
1523
  d = Dictionary.ByKeysValues(graph_keys, values)
1518
- if isinstance(d, topologic.Dictionary):
1524
+ if Topology.IsInstance(d, "Dictionary"):
1519
1525
  g = Graph.SetDictionary(g, d)
1520
1526
  else:
1521
1527
  print("Graph.ByCSVPath - Warning: Failed to create and add a dictionary to the created graph.")
@@ -1643,7 +1649,7 @@ class Graph:
1643
1649
  e = Edge.ByStartVertexEndVertex(sv, ev, tolerance=tolerance)
1644
1650
  edges.append(e)
1645
1651
  index+=n_nodes
1646
- graphs.append(topologic.Graph.ByVerticesEdges(vertices, edges))
1652
+ graphs.append(Graph.ByVerticesEdges(vertices, edges))
1647
1653
  return {'graphs':graphs, 'labels':labels}
1648
1654
 
1649
1655
 
@@ -1679,7 +1685,7 @@ class Graph:
1679
1685
 
1680
1686
  Returns
1681
1687
  -------
1682
- topologic.Graph
1688
+ topologic_core.Graph
1683
1689
  The created graph.
1684
1690
 
1685
1691
  """
@@ -1906,7 +1912,7 @@ class Graph:
1906
1912
 
1907
1913
  Returns
1908
1914
  -------
1909
- topologic.Graph
1915
+ topologic_core.Graph
1910
1916
  The created graph.
1911
1917
 
1912
1918
  """
@@ -1962,13 +1968,15 @@ class Graph:
1962
1968
 
1963
1969
  Returns
1964
1970
  -------
1965
- topologic.Graph
1971
+ topologic_core.Graph
1966
1972
  The created graph
1967
1973
 
1968
1974
  """
1969
1975
  from topologicpy.Vertex import Vertex
1970
1976
  from topologicpy.Edge import Edge
1971
1977
  from topologicpy.Dictionary import Dictionary
1978
+ from topologicpy.Topology import Topology
1979
+
1972
1980
  g_vertices = []
1973
1981
  for i, v in enumerate(vertices):
1974
1982
  g_v = Vertex.ByCoordinates(v[0], v[1], v[2])
@@ -2005,7 +2013,7 @@ class Graph:
2005
2013
 
2006
2014
  Parameters
2007
2015
  ----------
2008
- topology : topologic.Topology
2016
+ topology : topologic_core.Topology
2009
2017
  The input topology.
2010
2018
  direct : bool , optional
2011
2019
  If set to True, connect the subtopologies directly with a single edge. The default is True.
@@ -2036,11 +2044,12 @@ class Graph:
2036
2044
 
2037
2045
  Returns
2038
2046
  -------
2039
- topologic.Graph
2047
+ topologic_core.Graph
2040
2048
  The created graph.
2041
2049
 
2042
2050
  """
2043
2051
  from topologicpy.Dictionary import Dictionary
2052
+ from topologicpy.Vertex import Vertex
2044
2053
  from topologicpy.Edge import Edge
2045
2054
  from topologicpy.Cluster import Cluster
2046
2055
  from topologicpy.Topology import Topology
@@ -2323,14 +2332,14 @@ class Graph:
2323
2332
  contents = []
2324
2333
  _ = sharedTopology.Contents(contents)
2325
2334
  for content in contents:
2326
- if isinstance(content, topologic.Aperture):
2335
+ if Topology.IsInstance(content, "Aperture"):
2327
2336
  content = Aperture.Topology(content)
2328
2337
  if useInternalVertex == True:
2329
2338
  vst2 = Topology.InternalVertex(content, tolerance)
2330
2339
  else:
2331
2340
  vst2 = content.CenterOfMass()
2332
2341
  d1 = content.GetDictionary()
2333
- vst2 = topologic.Vertex.ByCoordinates(vst2.X(), vst2.Y(), vst2.Z())
2342
+ vst2 = Vertex.ByCoordinates(vst2.X(), vst2.Y(), vst2.Z())
2334
2343
  if storeBREP:
2335
2344
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
2336
2345
  d3 = mergeDictionaries2([d1, d2])
@@ -2350,7 +2359,7 @@ class Graph:
2350
2359
  else:
2351
2360
  vsa = sharedAp.CenterOfMass()
2352
2361
  d1 = sharedAp.GetDictionary()
2353
- vsa = topologic.Vertex.ByCoordinates(vsa.X()+(tolerance*100), vsa.Y()+(tolerance*100), vsa.Z()+(tolerance*100))
2362
+ vsa = Vertex.ByCoordinates(vsa.X()+(tolerance*100), vsa.Y()+(tolerance*100), vsa.Z()+(tolerance*100))
2354
2363
  if storeBREP:
2355
2364
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
2356
2365
  d3 = mergeDictionaries2([d1, d2])
@@ -2385,14 +2394,14 @@ class Graph:
2385
2394
  contents = []
2386
2395
  _ = exteriorTopology.Contents(contents)
2387
2396
  for content in contents:
2388
- if isinstance(content, topologic.Aperture):
2397
+ if Topology.IsInstance(content, "Aperture"):
2389
2398
  content = Aperture.Topology(content)
2390
2399
  if useInternalVertex == True:
2391
2400
  vst2 = Topology.InternalVertex(content, tolerance)
2392
2401
  else:
2393
2402
  vst2 = content.CenterOfMass()
2394
2403
  d1 = content.GetDictionary()
2395
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2404
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2396
2405
  if storeBREP:
2397
2406
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
2398
2407
  d3 = mergeDictionaries2([d1, d2])
@@ -2412,7 +2421,7 @@ class Graph:
2412
2421
  else:
2413
2422
  vea = exTop.CenterOfMass()
2414
2423
  d1 = exTop.GetDictionary()
2415
- vea = topologic.Vertex.ByCoordinates(vea.X()+(tolerance*100), vea.Y()+(tolerance*100), vea.Z()+(tolerance*100))
2424
+ vea = Vertex.ByCoordinates(vea.X()+(tolerance*100), vea.Y()+(tolerance*100), vea.Z()+(tolerance*100))
2416
2425
  if storeBREP:
2417
2426
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
2418
2427
  d3 = mergeDictionaries2([d1, d2])
@@ -2428,13 +2437,13 @@ class Graph:
2428
2437
  contents = []
2429
2438
  _ = aCell.Contents(contents)
2430
2439
  for content in contents:
2431
- if isinstance(content, topologic.Aperture):
2440
+ if Topology.IsInstance(content, "Aperture"):
2432
2441
  content = Aperture.Topology(content)
2433
2442
  if useInternalVertex == True:
2434
2443
  vcn = Topology.InternalVertex(content, tolerance)
2435
2444
  else:
2436
2445
  vcn = content.CenterOfMass()
2437
- vcn = topologic.Vertex.ByCoordinates(vcn.X()+(tolerance*100), vcn.Y()+(tolerance*100), vcn.Z()+(tolerance*100))
2446
+ vcn = Vertex.ByCoordinates(vcn.X()+(tolerance*100), vcn.Y()+(tolerance*100), vcn.Z()+(tolerance*100))
2438
2447
  d1 = content.GetDictionary()
2439
2448
  if storeBREP:
2440
2449
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2534,13 +2543,13 @@ class Graph:
2534
2543
  contents = []
2535
2544
  _ = exteriorTopology.Contents(contents)
2536
2545
  for content in contents:
2537
- if isinstance(content, topologic.Aperture):
2546
+ if Topology.IsInstance(content, "Aperture"):
2538
2547
  content = Aperture.Topology(content)
2539
2548
  if useInternalVertex == True:
2540
2549
  vst2 = Topology.InternalVertex(content, tolerance)
2541
2550
  else:
2542
2551
  vst2 = content.CenterOfMass()
2543
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2552
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2544
2553
  d1 = content.GetDictionary()
2545
2554
  if storeBREP:
2546
2555
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2561,7 +2570,7 @@ class Graph:
2561
2570
  else:
2562
2571
  vst = exTop.CenterOfMass()
2563
2572
  d1 = exTop.GetDictionary()
2564
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2573
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2565
2574
  if storeBREP:
2566
2575
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
2567
2576
  d3 = mergeDictionaries2([d1, d2])
@@ -2577,13 +2586,13 @@ class Graph:
2577
2586
  contents = []
2578
2587
  _ = topology.Contents(contents)
2579
2588
  for content in contents:
2580
- if isinstance(content, topologic.Aperture):
2589
+ if Topology.IsInstance(content, "Aperture"):
2581
2590
  content = Aperture.Topology(content)
2582
2591
  if useInternalVertex == True:
2583
2592
  vst = Topology.InternalVertex(content, tolerance)
2584
2593
  else:
2585
2594
  vst = content.CenterOfMass()
2586
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2595
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2587
2596
  d1 = content.GetDictionary()
2588
2597
  if storeBREP:
2589
2598
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2732,13 +2741,13 @@ class Graph:
2732
2741
  contents = []
2733
2742
  _ = sharedTopology.Contents(contents)
2734
2743
  for content in contents:
2735
- if isinstance(content, topologic.Aperture):
2744
+ if Topology.IsInstance(content, "Aperture"):
2736
2745
  content = Aperture.Topology(content)
2737
2746
  if useInternalVertex == True:
2738
2747
  vst2 = Topology.InternalVertex(content, tolerance)
2739
2748
  else:
2740
2749
  vst2 = content.CenterOfMass()
2741
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2750
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2742
2751
  d1 = content.GetDictionary()
2743
2752
  if storeBREP:
2744
2753
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2759,7 +2768,7 @@ class Graph:
2759
2768
  else:
2760
2769
  vst = sharedAp.CenterOfMass()
2761
2770
  d1 = sharedAp.GetDictionary()
2762
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2771
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2763
2772
  if storeBREP:
2764
2773
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
2765
2774
  d3 = mergeDictionaries2([d1, d2])
@@ -2793,13 +2802,13 @@ class Graph:
2793
2802
  contents = []
2794
2803
  _ = exteriorTopology.Contents(contents)
2795
2804
  for content in contents:
2796
- if isinstance(content, topologic.Aperture):
2805
+ if Topology.IsInstance(content, "Aperture"):
2797
2806
  content = Aperture.Topology(content)
2798
2807
  if useInternalVertex == True:
2799
2808
  vst2 = Topology.InternalVertex(content, tolerance)
2800
2809
  else:
2801
2810
  vst2 = content.CenterOfMass()
2802
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2811
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2803
2812
  d1 = content.GetDictionary()
2804
2813
  if storeBREP:
2805
2814
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2820,7 +2829,7 @@ class Graph:
2820
2829
  else:
2821
2830
  vst = exTop.CenterOfMass()
2822
2831
  d1 = exTop.GetDictionary()
2823
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2832
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2824
2833
  if storeBREP:
2825
2834
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
2826
2835
  d3 = mergeDictionaries2([d1, d2])
@@ -2836,13 +2845,13 @@ class Graph:
2836
2845
  contents = []
2837
2846
  _ = aFace.Contents(contents)
2838
2847
  for content in contents:
2839
- if isinstance(content, topologic.Aperture):
2848
+ if Topology.IsInstance(content, "Aperture"):
2840
2849
  content = Aperture.Topology(content)
2841
2850
  if useInternalVertex == True:
2842
2851
  vst = Topology.InternalVertex(content, tolerance)
2843
2852
  else:
2844
2853
  vst = content.CenterOfMass()
2845
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2854
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
2846
2855
  d1 = content.GetDictionary()
2847
2856
  if storeBREP:
2848
2857
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -2982,13 +2991,13 @@ class Graph:
2982
2991
  contents = []
2983
2992
  _ = exteriorTopology.Contents(contents)
2984
2993
  for content in contents:
2985
- if isinstance(content, topologic.Aperture):
2994
+ if Topology.IsInstance(content, "Aperture"):
2986
2995
  content = Aperture.Topology(content)
2987
2996
  if useInternalVertex == True:
2988
2997
  vst2 = Topology.InternalVertex(content, tolerance)
2989
2998
  else:
2990
2999
  vst2 = content.CenterOfMass()
2991
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3000
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
2992
3001
  d1 = content.GetDictionary()
2993
3002
  if storeBREP:
2994
3003
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3009,7 +3018,7 @@ class Graph:
3009
3018
  else:
3010
3019
  vst = exTop.CenterOfMass()
3011
3020
  d1 = exTop.GetDictionary()
3012
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3021
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3013
3022
  if storeBREP:
3014
3023
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
3015
3024
  d3 = mergeDictionaries2([d1, d2])
@@ -3025,13 +3034,13 @@ class Graph:
3025
3034
  contents = []
3026
3035
  _ = topology.Contents(contents)
3027
3036
  for content in contents:
3028
- if isinstance(content, topologic.Aperture):
3037
+ if Topology.IsInstance(content, "Aperture"):
3029
3038
  content = Aperture.Topology(content)
3030
3039
  if useInternalVertex == True:
3031
3040
  vst = Topology.InternalVertex(content, tolerance)
3032
3041
  else:
3033
3042
  vst = content.CenterOfMass()
3034
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3043
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3035
3044
  d1 = content.GetDictionary()
3036
3045
  if storeBREP:
3037
3046
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3069,11 +3078,11 @@ class Graph:
3069
3078
  sharedt = Topology.SharedVertices(topEdges[i], topEdges[j])
3070
3079
  if len(sharedt) > 0:
3071
3080
  try:
3072
- v1 = topologic.EdgeUtility.PointAtParameter(topEdges[i], 0.5)
3081
+ v1 = Edge.VertexByParameter(topEdges[i], 0.5)
3073
3082
  except:
3074
3083
  v1 = topEdges[j].CenterOfMass()
3075
3084
  try:
3076
- v2 = topologic.EdgeUtility.PointAtParameter(topEdges[j], 0.5)
3085
+ v2 = Edge.VertexByParameter(topEdges[j], 0.5)
3077
3086
  except:
3078
3087
  v2 = topEdges[j].CenterOfMass()
3079
3088
  e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
@@ -3114,11 +3123,11 @@ class Graph:
3114
3123
  break
3115
3124
  if apertureExists:
3116
3125
  try:
3117
- v1 = topologic.EdgeUtility.PointAtParameter(topEdges[i], 0.5)
3126
+ v1 = Edge.VertexByParameter(topEdges[i], 0.5)
3118
3127
  except:
3119
3128
  v1 = topEdges[j].CenterOfMass()
3120
3129
  try:
3121
- v2 = topologic.EdgeUtility.PointAtParameter(topEdges[j], 0.5)
3130
+ v2 = Edge.VertexByParameter(topEdges[j], 0.5)
3122
3131
  except:
3123
3132
  v2 = topEdges[j].CenterOfMass()
3124
3133
  e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
@@ -3135,7 +3144,7 @@ class Graph:
3135
3144
  if (viaSharedTopologies == True) or (viaSharedApertures == True) or (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
3136
3145
  for anEdge in topEdges:
3137
3146
  try:
3138
- vEdge = topologic.EdgeUtility.PointAtParameter(anEdge, 0.5)
3147
+ vEdge = Edge.VertexByParameter(anEdge, 0.5)
3139
3148
  except:
3140
3149
  vEdge = anEdge.CenterOfMass()
3141
3150
  d1 = anEdge.GetDictionary()
@@ -3188,13 +3197,13 @@ class Graph:
3188
3197
  contents = []
3189
3198
  _ = sharedTopology.Contents(contents)
3190
3199
  for content in contents:
3191
- if isinstance(content, topologic.Aperture):
3200
+ if Topology.IsInstance(content, "Aperture"):
3192
3201
  content = Aperture.Topology(content)
3193
3202
  if useInternalVertex == True:
3194
3203
  vst2 = Topology.InternalVertex(content, tolerance)
3195
3204
  else:
3196
3205
  vst2 = content.CenterOfMass()
3197
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3206
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3198
3207
  d1 = content.GetDictionary()
3199
3208
  if storeBREP:
3200
3209
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3215,7 +3224,7 @@ class Graph:
3215
3224
  else:
3216
3225
  vst = sharedAp.CenterOfMass()
3217
3226
  d1 = sharedAp.GetDictionary()
3218
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3227
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3219
3228
  if storeBREP:
3220
3229
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(sharedAp), Topology.Type(sharedAp), Topology.TypeAsString(sharedAp)])
3221
3230
  d3 = mergeDictionaries2([d1, d2])
@@ -3239,13 +3248,13 @@ class Graph:
3239
3248
  contents = []
3240
3249
  _ = vst.Contents(contents)
3241
3250
  for content in contents:
3242
- if isinstance(content, topologic.Aperture):
3251
+ if Topology.IsInstance(content, "Aperture"):
3243
3252
  content = Aperture.Topology(content)
3244
3253
  if useInternalVertex == True:
3245
3254
  vst2 = Topology.InternalVertex(content, tolerance)
3246
3255
  else:
3247
3256
  vst2 = content.CenterOfMass()
3248
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3257
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3249
3258
  d1 = content.GetDictionary()
3250
3259
  if storeBREP:
3251
3260
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3266,7 +3275,7 @@ class Graph:
3266
3275
  else:
3267
3276
  vst = exTop.CenterOfMass()
3268
3277
  d1 = exTop.GetDictionary()
3269
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3278
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3270
3279
  if storeBREP:
3271
3280
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
3272
3281
  d3 = mergeDictionaries2([d1, d2])
@@ -3282,13 +3291,13 @@ class Graph:
3282
3291
  contents = []
3283
3292
  _ = anEdge.Contents(contents)
3284
3293
  for content in contents:
3285
- if isinstance(content, topologic.Aperture):
3294
+ if Topology.IsInstance(content, "Aperture"):
3286
3295
  content = Aperture.Topology(content)
3287
3296
  if useInternalVertex == True:
3288
3297
  vst = Topology.InternalVertex(content, tolerance)
3289
3298
  else:
3290
3299
  vst = content.CenterOfMass()
3291
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3300
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3292
3301
  d1 = content.GetDictionary()
3293
3302
  if storeBREP:
3294
3303
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3303,7 +3312,7 @@ class Graph:
3303
3312
  edges.append(tempe)
3304
3313
  for anEdge in topEdges:
3305
3314
  try:
3306
- vEdge = topologic.EdgeUtility.PointAtParameter(anEdge, 0.5)
3315
+ vEdge = Edge.VertexByParameter(anEdge, 0.5)
3307
3316
  except:
3308
3317
  vEdge = anEdge.CenterOfMass()
3309
3318
  d1 = anEdge.GetDictionary()
@@ -3360,7 +3369,7 @@ class Graph:
3360
3369
 
3361
3370
  if useInternalVertex == True:
3362
3371
  try:
3363
- vEdge = topologic.EdgeUtility.PointAtParameter(topology, 0.5)
3372
+ vEdge = Edge.VertexByParameter(topology, 0.5)
3364
3373
  except:
3365
3374
  vEdge = topology.CenterOfMass()
3366
3375
  else:
@@ -3434,13 +3443,13 @@ class Graph:
3434
3443
  contents = []
3435
3444
  _ = vst.Contents(contents)
3436
3445
  for content in contents:
3437
- if isinstance(content, topologic.Aperture):
3446
+ if Topology.IsInstance(content, "Aperture"):
3438
3447
  content = Aperture.Topology(content)
3439
3448
  if useInternalVertex == True:
3440
3449
  vst2 = Topology.InternalVertex(content, tolerance)
3441
3450
  else:
3442
3451
  vst2 = content.CenterOfMass()
3443
- vst2 = topologic.Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3452
+ vst2 = Vertex.ByCoordinates(vst2.X()+(tolerance*100), vst2.Y()+(tolerance*100), vst2.Z()+(tolerance*100))
3444
3453
  d1 = content.GetDictionary()
3445
3454
  if storeBREP:
3446
3455
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
@@ -3461,7 +3470,7 @@ class Graph:
3461
3470
  else:
3462
3471
  vst = exTop.CenterOfMass()
3463
3472
  d1 = exTop.GetDictionary()
3464
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3473
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3465
3474
  if storeBREP:
3466
3475
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(exTop), Topology.Type(exTop), Topology.TypeAsString(exTop)])
3467
3476
  d3 = mergeDictionaries2([d1, d2])
@@ -3486,14 +3495,14 @@ class Graph:
3486
3495
  contents = []
3487
3496
  _ = topology.Contents(contents)
3488
3497
  for content in contents:
3489
- if isinstance(content, topologic.Aperture):
3498
+ if Topology.IsInstance(content, "Aperture"):
3490
3499
  content = Aperture.Topology(content)
3491
3500
  if useInternalVertex == True:
3492
3501
  vst = Topology.InternalVertex(content, tolerance)
3493
3502
  else:
3494
3503
  vst = content.CenterOfMass()
3495
3504
  d1 = content.GetDictionary()
3496
- vst = topologic.Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3505
+ vst = Vertex.ByCoordinates(vst.X()+(tolerance*100), vst.Y()+(tolerance*100), vst.Z()+(tolerance*100))
3497
3506
  if storeBREP:
3498
3507
  d2 = Dictionary.ByKeysValues(["brep", "brepType", "brepTypeString"], [Topology.BREPString(content), Topology.Type(content), Topology.TypeAsString(content)])
3499
3508
  d3 = mergeDictionaries2([d1, d2])
@@ -3534,28 +3543,28 @@ class Graph:
3534
3543
  return [vertices, edges]
3535
3544
 
3536
3545
 
3537
- if not isinstance(topology, topologic.Topology):
3546
+ if not Topology.IsInstance(topology, "Topology"):
3538
3547
  print("Graph.ByTopology - Error: The input topology is not a valid topology. Returning None.")
3539
3548
  return None
3540
3549
  graph = None
3541
3550
  item = [topology, None, None, None, direct, directApertures, viaSharedTopologies, viaSharedApertures, toExteriorTopologies, toExteriorApertures, toContents, None, useInternalVertex, storeBREP, tolerance]
3542
3551
  vertices = []
3543
3552
  edges = []
3544
- if isinstance(topology, topologic.CellComplex):
3553
+ if Topology.IsInstance(topology, "CellComplex"):
3545
3554
  vertices, edges = processCellComplex(item)
3546
- elif isinstance(topology, topologic.Cell):
3555
+ elif Topology.IsInstance(topology, "Cell"):
3547
3556
  vertices, edges = processCell(item)
3548
- elif isinstance(topology, topologic.Shell):
3557
+ elif Topology.IsInstance(topology, "Shell"):
3549
3558
  vertices, edges = processShell(item)
3550
- elif isinstance(topology, topologic.Face):
3559
+ elif Topology.IsInstance(topology, "Face"):
3551
3560
  vertices, edges = processFace(item)
3552
- elif isinstance(topology, topologic.Wire):
3561
+ elif Topology.IsInstance(topology, "Wire"):
3553
3562
  vertices, edges = processWire(item)
3554
- elif isinstance(topology, topologic.Edge):
3563
+ elif Topology.IsInstance(topology, "Edge"):
3555
3564
  vertices, edges = processEdge(item)
3556
- elif isinstance(topology, topologic.Vertex):
3565
+ elif Topology.IsInstance(topology, "Vertex"):
3557
3566
  vertices, edges = processVertex(item)
3558
- elif isinstance(topology, topologic.Cluster):
3567
+ elif Topology.IsInstance(topology, "Cluster"):
3559
3568
  c_cellComplexes = Topology.CellComplexes(topology)
3560
3569
  c_cells = Cluster.FreeCells(topology, tolerance=tolerance)
3561
3570
  c_shells = Cluster.FreeShells(topology, tolerance=tolerance)
@@ -3596,7 +3605,7 @@ class Graph:
3596
3605
  edges += e
3597
3606
  else:
3598
3607
  return None
3599
- return topologic.Graph.ByVerticesEdges(vertices, edges)
3608
+ return Graph.ByVerticesEdges(vertices, edges)
3600
3609
 
3601
3610
  @staticmethod
3602
3611
  def ByVerticesEdges(vertices, edges):
@@ -3612,28 +3621,30 @@ class Graph:
3612
3621
 
3613
3622
  Returns
3614
3623
  -------
3615
- topologic.Graph
3624
+ topologic_core.Graph
3616
3625
  The created graph.
3617
3626
 
3618
3627
  """
3628
+ from topologicpy.Topology import Topology
3629
+
3619
3630
  if not isinstance(vertices, list):
3620
3631
  print("Graph.ByVerticesEdges - Error: The input list of vertices is not a valid list. Returning None.")
3621
3632
  return None
3622
3633
  if not isinstance(edges, list):
3623
3634
  print("Graph.ByVerticesEdges - Error: The input list of edges is not a valid list. Returning None.")
3624
3635
  return None
3625
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
3626
- edges = [e for e in edges if isinstance(e, topologic.Edge)]
3627
- return topologic.Graph.ByVerticesEdges(vertices, edges)
3636
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
3637
+ edges = [e for e in edges if Topology.IsInstance(e, "Edge")]
3638
+ return topologic.Graph.ByVerticesEdges(vertices, edges) # Hook to Core
3628
3639
 
3629
3640
  @staticmethod
3630
- def ChromaticNumber(graph: topologic.Graph, maxColors: int = 3, silent: bool = False):
3641
+ def ChromaticNumber(graph, maxColors: int = 3, silent: bool = False):
3631
3642
  """
3632
3643
  Returns the chromatic number of the input graph. See https://en.wikipedia.org/wiki/Graph_coloring.
3633
3644
 
3634
3645
  Parameters
3635
3646
  ----------
3636
- graph : topologic.Graph
3647
+ graph : topologic_core.Graph
3637
3648
  The input graph.
3638
3649
  maxColors : int , optional
3639
3650
  The desired maximum number of colors to test against. The default is 3.
@@ -3648,6 +3659,8 @@ class Graph:
3648
3659
  """
3649
3660
  # This is based on code from https://www.geeksforgeeks.org/graph-coloring-applications/
3650
3661
 
3662
+ from topologicpy.Topology import Topology
3663
+
3651
3664
  def is_safe(graph, v, color, c):
3652
3665
  for i in range(len(graph)):
3653
3666
  if graph[v][i] == 1 and color[i] == c:
@@ -3678,7 +3691,7 @@ class Graph:
3678
3691
  return m
3679
3692
  m += 1
3680
3693
 
3681
- if not isinstance(graph, topologic.Graph):
3694
+ if not Topology.IsInstance(graph, "Graph"):
3682
3695
  if not silent:
3683
3696
  print("Graph.ChromaticNumber - Error: The input graph parameter is not a valid graph. Returning None.")
3684
3697
  return None
@@ -3697,7 +3710,7 @@ class Graph:
3697
3710
 
3698
3711
  Parameters
3699
3712
  ----------
3700
- graph : topologic.Graph
3713
+ graph : topologic_core.Graph
3701
3714
  The input graph.
3702
3715
  oldKey : str , optional
3703
3716
  The existing dictionary key to use to read any pre-existing color information. The default is "color".
@@ -3710,7 +3723,7 @@ class Graph:
3710
3723
 
3711
3724
  Returns
3712
3725
  -------
3713
- topologic.Graph
3726
+ topologic_core.Graph
3714
3727
  The input graph, but with its vertices colored.
3715
3728
 
3716
3729
  """
@@ -3755,7 +3768,7 @@ class Graph:
3755
3768
  return None
3756
3769
  return [x-1 for x in colors]
3757
3770
 
3758
- if not isinstance(graph, topologic.Graph):
3771
+ if not Topology.IsInstance(graph, "Graph"):
3759
3772
  print("Graph.Color - Error: The input graph is not a valid graph. Returning None.")
3760
3773
  return None
3761
3774
 
@@ -3790,9 +3803,9 @@ class Graph:
3790
3803
 
3791
3804
  Parameters
3792
3805
  ----------
3793
- graph : topologic.Graph
3806
+ graph : topologic_core.Graph
3794
3807
  The input graph.
3795
- edge : topologic.Edge
3808
+ edge : topologic_core.Edge
3796
3809
  The input graph edge that needs to be contracted.
3797
3810
  vertex : topollogic.Vertex , optional
3798
3811
  The vertex to replace the contracted edge. If set to None, the centroid of the edge is chosen. The default is None.
@@ -3801,10 +3814,11 @@ class Graph:
3801
3814
 
3802
3815
  Returns
3803
3816
  -------
3804
- topologic.Graph
3817
+ topologic_core.Graph
3805
3818
  The input graph, but with input edge contracted into a single vertex.
3806
3819
 
3807
3820
  """
3821
+ from topologicpy.Vertex import Vertex
3808
3822
  from topologicpy.Edge import Edge
3809
3823
  from topologicpy.Topology import Topology
3810
3824
  from topologicpy.Dictionary import Dictionary
@@ -3817,10 +3831,10 @@ class Graph:
3817
3831
  if d1 < d2:
3818
3832
  return [ev, 1]
3819
3833
  return [sv, 0]
3820
- if not isinstance(graph, topologic.Graph):
3834
+ if not Topology.IsInstance(graph, "Graph"):
3821
3835
  print("Graph.ContractEdge - Error: The input graph parameter is not a valid graph. Returning None.")
3822
3836
  return None
3823
- if not isinstance(edge, topologic.Edge):
3837
+ if not Topology.IsInstance(edge, "Edge"):
3824
3838
  print("Graph.ContractEdge - Error: The input edge parameter is not a valid edge. Returning None.")
3825
3839
  return None
3826
3840
  if vertex == None:
@@ -3890,7 +3904,7 @@ class Graph:
3890
3904
 
3891
3905
  Parameters
3892
3906
  ----------
3893
- graph : topologic.Graph
3907
+ graph : topologic_core.Graph
3894
3908
  The input graph.
3895
3909
  vertices : list , optional
3896
3910
  The input list of vertices. The default is None.
@@ -3903,15 +3917,16 @@ class Graph:
3903
3917
  The closeness centrality of the input list of vertices within the input graph. The values are in the range 0 to 1.
3904
3918
 
3905
3919
  """
3920
+ from topologicpy.Topology import Topology
3906
3921
 
3907
- if not isinstance(graph, topologic.Graph):
3922
+ if not Topology.IsInstance(graph, "Graph"):
3908
3923
  print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
3909
3924
  return None
3910
3925
  graphVertices = Graph.Vertices(graph)
3911
3926
  if not isinstance(vertices, list):
3912
3927
  vertices = graphVertices
3913
3928
  else:
3914
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
3929
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
3915
3930
  if len(vertices) < 1:
3916
3931
  print("Graph.ClosenessCentrality - Error: The input list of vertices does not contain any valid vertices. Returning None.")
3917
3932
  return None
@@ -3922,7 +3937,7 @@ class Graph:
3922
3937
  for va in tqdm(vertices, desc="Computing Closeness Centrality", leave=False):
3923
3938
  top_dist = 0
3924
3939
  for vb in graphVertices:
3925
- if topologic.Topology.IsSame(va, vb):
3940
+ if Topology.IsSame(va, vb):
3926
3941
  d = 0
3927
3942
  else:
3928
3943
  d = Graph.TopologicalDistance(graph, va, vb, tolerance)
@@ -3936,7 +3951,7 @@ class Graph:
3936
3951
  for va in vertices:
3937
3952
  top_dist = 0
3938
3953
  for vb in graphVertices:
3939
- if topologic.Topology.IsSame(va, vb):
3954
+ if Topology.IsSame(va, vb):
3940
3955
  d = 0
3941
3956
  else:
3942
3957
  d = Graph.TopologicalDistance(graph, va, vb, tolerance)
@@ -3954,22 +3969,24 @@ class Graph:
3954
3969
 
3955
3970
  Parameters
3956
3971
  ----------
3957
- graph : topologic.Graph
3972
+ graph : topologic_core.Graph
3958
3973
  The input graph.
3959
3974
  verticesA : list
3960
3975
  The first list of input vertices.
3961
- verticesB : topologic.Vertex
3976
+ verticesB : topologic_core.Vertex
3962
3977
  The second list of input vertices.
3963
3978
  tolerance : float , optional
3964
3979
  The desired tolerance. The default is 0.0001.
3965
3980
 
3966
3981
  Returns
3967
3982
  -------
3968
- topologic.Graph
3983
+ topologic_core.Graph
3969
3984
  The input graph with the connected input vertices.
3970
3985
 
3971
3986
  """
3972
- if not isinstance(graph, topologic.Graph):
3987
+ from topologicpy.Topology import Topology
3988
+
3989
+ if not Topology.IsInstance(graph, "Graph"):
3973
3990
  print("Graph.Connect - Error: The input graph is not a valid graph. Returning None.")
3974
3991
  return None
3975
3992
  if not isinstance(verticesA, list):
@@ -3978,8 +3995,8 @@ class Graph:
3978
3995
  if not isinstance(verticesB, list):
3979
3996
  print("Graph.Connect - Error: The input list of verticesB is not a valid list. Returning None.")
3980
3997
  return None
3981
- verticesA = [v for v in verticesA if isinstance(v, topologic.Vertex)]
3982
- verticesB = [v for v in verticesB if isinstance(v, topologic.Vertex)]
3998
+ verticesA = [v for v in verticesA if Topology.IsInstance(v, "Vertex")]
3999
+ verticesB = [v for v in verticesB if Topology.IsInstance(v, "Vertex")]
3983
4000
  if len(verticesA) < 1:
3984
4001
  print("Graph.Connect - Error: The input list of verticesA does not contain any valid vertices. Returning None.")
3985
4002
  return None
@@ -3999,9 +4016,9 @@ class Graph:
3999
4016
 
4000
4017
  Parameters
4001
4018
  ----------
4002
- graph : topologic.Graph
4019
+ graph : topologic_core.Graph
4003
4020
  The input graph.
4004
- edge : topologic.Edge
4021
+ edge : topologic_core.Edge
4005
4022
  The input edge.
4006
4023
  tolerance : float , optional
4007
4024
  The desired tolerance. The default is 0.0001.
@@ -4012,10 +4029,12 @@ class Graph:
4012
4029
  True if the input graph contains the input edge. False otherwise.
4013
4030
 
4014
4031
  """
4015
- if not isinstance(graph, topologic.Graph):
4032
+ from topologicpy.Topology import Topology
4033
+
4034
+ if not Topology.IsInstance(graph, "Graph"):
4016
4035
  print("Graph.ContainsEdge - Error: The input graph is not a valid graph. Returning None.")
4017
4036
  return None
4018
- if not isinstance(edge, topologic.Edge):
4037
+ if not Topology.IsInstance(edge, "Edge"):
4019
4038
  print("Graph.ContainsEdge - Error: The input edge is not a valid edge. Returning None.")
4020
4039
  return None
4021
4040
  return graph.ContainsEdge(edge, tolerance)
@@ -4027,9 +4046,9 @@ class Graph:
4027
4046
 
4028
4047
  Parameters
4029
4048
  ----------
4030
- graph : topologic.Graph
4049
+ graph : topologic_core.Graph
4031
4050
  The input graph.
4032
- vertex : topologic.Vertex
4051
+ vertex : topologic_core.Vertex
4033
4052
  The input Vertex.
4034
4053
  tolerance : float , optional
4035
4054
  Ther desired tolerance. The default is 0.0001.
@@ -4040,10 +4059,12 @@ class Graph:
4040
4059
  True if the input graph contains the input vertex. False otherwise.
4041
4060
 
4042
4061
  """
4043
- if not isinstance(graph, topologic.Graph):
4062
+ from topologicpy.Topology import Topology
4063
+
4064
+ if not Topology.IsInstance(graph, "Graph"):
4044
4065
  print("Graph.ContainsVertex - Error: The input graph is not a valid graph. Returning None.")
4045
4066
  return None
4046
- if not isinstance(vertex, topologic.Vertex):
4067
+ if not Topology.IsInstance(vertex, "Vertex"):
4047
4068
  print("Graph.ContainsVertex - Error: The input vertex is not a valid vertex. Returning None.")
4048
4069
  return None
4049
4070
  return graph.ContainsVertex(vertex, tolerance)
@@ -4055,7 +4076,7 @@ class Graph:
4055
4076
 
4056
4077
  Parameters
4057
4078
  ----------
4058
- graph : topologic.Graph
4079
+ graph : topologic_core.Graph
4059
4080
  The input graph.
4060
4081
 
4061
4082
  Returns
@@ -4064,7 +4085,9 @@ class Graph:
4064
4085
  The degree sequence of the input graph.
4065
4086
 
4066
4087
  """
4067
- if not isinstance(graph, topologic.Graph):
4088
+ from topologicpy.Topology import Topology
4089
+
4090
+ if not Topology.IsInstance(graph, "Graph"):
4068
4091
  print("Graph.DegreeSequence - Error: The input graph is not a valid graph. Returning None.")
4069
4092
  return None
4070
4093
  sequence = []
@@ -4078,7 +4101,7 @@ class Graph:
4078
4101
 
4079
4102
  Parameters
4080
4103
  ----------
4081
- graph : topologic.Graph
4104
+ graph : topologic_core.Graph
4082
4105
  The input graph.
4083
4106
 
4084
4107
  Returns
@@ -4087,7 +4110,9 @@ class Graph:
4087
4110
  The density of the input graph.
4088
4111
 
4089
4112
  """
4090
- if not isinstance(graph, topologic.Graph):
4113
+ from topologicpy.Topology import Topology
4114
+
4115
+ if not Topology.IsInstance(graph, "Graph"):
4091
4116
  print("Graph.Density - Error: The input graph is not a valid graph. Returning None.")
4092
4117
  return None
4093
4118
  return graph.Density()
@@ -4099,7 +4124,7 @@ class Graph:
4099
4124
 
4100
4125
  Parameters
4101
4126
  ----------
4102
- graph : topologic.Graph
4127
+ graph : topologic_core.Graph
4103
4128
  The input graph.
4104
4129
  vertices : list , optional
4105
4130
  The input list of vertices. The default is None.
@@ -4112,14 +4137,16 @@ class Graph:
4112
4137
  The depth map of the input list of vertices within the input graph.
4113
4138
 
4114
4139
  """
4115
- if not isinstance(graph, topologic.Graph):
4140
+ from topologicpy.Topology import Topology
4141
+
4142
+ if not Topology.IsInstance(graph, "Graph"):
4116
4143
  print("Graph.DepthMap - Error: The input graph is not a valid graph. Returning None.")
4117
4144
  return None
4118
4145
  graphVertices = Graph.Vertices(graph)
4119
4146
  if not isinstance(vertices, list):
4120
4147
  vertices = graphVertices
4121
4148
  else:
4122
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
4149
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
4123
4150
  if len(vertices) < 1:
4124
4151
  print("Graph.DepthMap - Error: The input list of vertices does not contain any valid vertices. Returning None.")
4125
4152
  return None
@@ -4127,7 +4154,7 @@ class Graph:
4127
4154
  for va in vertices:
4128
4155
  depth = 0
4129
4156
  for vb in graphVertices:
4130
- if topologic.Topology.IsSame(va, vb):
4157
+ if Topology.IsSame(va, vb):
4131
4158
  dist = 0
4132
4159
  else:
4133
4160
  dist = Graph.TopologicalDistance(graph, va, vb, tolerance)
@@ -4142,7 +4169,7 @@ class Graph:
4142
4169
 
4143
4170
  Parameters
4144
4171
  ----------
4145
- graph : topologic.Graph
4172
+ graph : topologic_core.Graph
4146
4173
  The input graph.
4147
4174
 
4148
4175
  Returns
@@ -4151,7 +4178,9 @@ class Graph:
4151
4178
  The diameter of the input graph.
4152
4179
 
4153
4180
  """
4154
- if not isinstance(graph, topologic.Graph):
4181
+ from topologicpy.Topology import Topology
4182
+
4183
+ if not Topology.IsInstance(graph, "Graph"):
4155
4184
  print("Graph.Diameter - Error: The input graph is not a valid graph. Returning None.")
4156
4185
  return None
4157
4186
  return graph.Diameter()
@@ -4163,16 +4192,18 @@ class Graph:
4163
4192
 
4164
4193
  Parameters
4165
4194
  ----------
4166
- graph : topologic.Graph
4195
+ graph : topologic_core.Graph
4167
4196
  The input graph.
4168
4197
 
4169
4198
  Returns
4170
4199
  -------
4171
- topologic.Dictionary
4200
+ topologic_core.Dictionary
4172
4201
  The dictionary of the input graph.
4173
4202
 
4174
4203
  """
4175
- if not isinstance(graph, topologic.Graph):
4204
+ from topologicpy.Topology import Topology
4205
+
4206
+ if not Topology.IsInstance(graph, "Graph"):
4176
4207
  print("Graph.Dictionary - Error: the input graph parameter is not a valid graph. Returning None.")
4177
4208
  return None
4178
4209
  return graph.GetDictionary()
@@ -4184,11 +4215,11 @@ class Graph:
4184
4215
 
4185
4216
  Parameters
4186
4217
  ----------
4187
- graph : topologic.Graph
4218
+ graph : topologic_core.Graph
4188
4219
  The input graph.
4189
- vertexA : topologic.Vertex
4220
+ vertexA : topologic_core.Vertex
4190
4221
  The first input vertex.
4191
- vertexB : topologic.Vertex
4222
+ vertexB : topologic_core.Vertex
4192
4223
  The second input vertex.
4193
4224
  tolerance : float , optional
4194
4225
  The desired tolerance. The default is 0.0001.
@@ -4199,13 +4230,15 @@ class Graph:
4199
4230
  The shortest-path distance between the input vertices.
4200
4231
 
4201
4232
  """
4202
- if not isinstance(graph, topologic.Graph):
4233
+ from topologicpy.Topology import Topology
4234
+
4235
+ if not Topology.IsInstance(graph, "Graph"):
4203
4236
  print("Graph.Distance - Error: The input graph is not a valid graph. Returning None.")
4204
4237
  return None
4205
- if not isinstance(vertexA, topologic.Vertex):
4238
+ if not Topology.IsInstance(vertexA, "Vertex"):
4206
4239
  print("Graph.Distance - Error: The input vertexA is not a valid vertex. Returning None.")
4207
4240
  return None
4208
- if not isinstance(vertexB, topologic.Vertex):
4241
+ if not Topology.IsInstance(vertexB, "Vertex"):
4209
4242
  print("Graph.Distance - Error: The input vertexB is not a valid vertex. Returning None.")
4210
4243
  return None
4211
4244
  return graph.TopologicalDistance(vertexA, vertexB, tolerance)
@@ -4217,28 +4250,30 @@ class Graph:
4217
4250
 
4218
4251
  Parameters
4219
4252
  ----------
4220
- graph : topologic.Graph
4253
+ graph : topologic_core.Graph
4221
4254
  The input graph.
4222
- vertexA : topologic.Vertex
4255
+ vertexA : topologic_core.Vertex
4223
4256
  The first input vertex.
4224
- vertexB : topologic.Vertex
4257
+ vertexB : topologic_core.Vertex
4225
4258
  The second input Vertex.
4226
4259
  tolerance : float , optional
4227
4260
  The desired tolerance. The default is 0.0001.
4228
4261
 
4229
4262
  Returns
4230
4263
  -------
4231
- topologic.Edge
4264
+ topologic_core.Edge
4232
4265
  The edge in the input graph that connects the input vertices.
4233
4266
 
4234
4267
  """
4235
- if not isinstance(graph, topologic.Graph):
4268
+ from topologicpy.Topology import Topology
4269
+
4270
+ if not Topology.IsInstance(graph, "Graph"):
4236
4271
  print("Graph.Edge - Error: The input graph is not a valid graph. Returning None.")
4237
4272
  return None
4238
- if not isinstance(vertexA, topologic.Vertex):
4273
+ if not Topology.IsInstance(vertexA, "Vertex"):
4239
4274
  print("Graph.Edge - Error: The input vertexA is not a valid vertex. Returning None.")
4240
4275
  return None
4241
- if not isinstance(vertexB, topologic.Vertex):
4276
+ if not Topology.IsInstance(vertexB, "Vertex"):
4242
4277
  print("Graph.Edge - Error: The input vertexB is not a valid vertex. Returning None.")
4243
4278
  return None
4244
4279
  return graph.Edge(vertexA, vertexB, tolerance)
@@ -4250,7 +4285,7 @@ class Graph:
4250
4285
 
4251
4286
  Parameters
4252
4287
  ----------
4253
- graph : topologic.Graph
4288
+ graph : topologic_core.Graph
4254
4289
  The input graph.
4255
4290
  vertices : list , optional
4256
4291
  An optional list of vertices to restrict the returned list of edges only to those connected to this list.
@@ -4263,7 +4298,9 @@ class Graph:
4263
4298
  The list of edges in the graph.
4264
4299
 
4265
4300
  """
4266
- if not isinstance(graph, topologic.Graph):
4301
+ from topologicpy.Topology import Topology
4302
+
4303
+ if not Topology.IsInstance(graph, "Graph"):
4267
4304
  print("Graph.Edges - Error: The input graph is not a valid graph. Returning None.")
4268
4305
  return None
4269
4306
  if not vertices:
@@ -4271,7 +4308,7 @@ class Graph:
4271
4308
  _ = graph.Edges(edges, tolerance)
4272
4309
  return edges
4273
4310
  else:
4274
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
4311
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
4275
4312
  if len(vertices) < 1:
4276
4313
  print("Graph.Edges - Error: The input list of vertices does not contain any valid vertices. Returning None.")
4277
4314
  return None
@@ -4337,7 +4374,7 @@ class Graph:
4337
4374
 
4338
4375
  Parameters
4339
4376
  ----------
4340
- graph : topologic.Graph
4377
+ graph : topologic_core.Graph
4341
4378
  The input graph.
4342
4379
  format : str , optional
4343
4380
  The desired output format, the options are listed below. Thde default is "turtle".
@@ -4488,7 +4525,7 @@ class Graph:
4488
4525
 
4489
4526
  Parameters
4490
4527
  ----------
4491
- graph : topologic.Graph
4528
+ graph : topologic_core.Graph
4492
4529
  The input graph
4493
4530
  path : str
4494
4531
  The desired path to the output folder where the graphs, edges, and nodes CSV files will be saved.
@@ -4587,7 +4624,7 @@ class Graph:
4587
4624
  from os.path import exists
4588
4625
 
4589
4626
 
4590
- if not isinstance(graph, topologic.Graph):
4627
+ if not Topology.IsInstance(graph, "Graph"):
4591
4628
  print("Graph.ExportToCSV - Error: The input graph parameter is not a valid topologic graph. Returning None.")
4592
4629
  return None
4593
4630
 
@@ -4844,7 +4881,7 @@ class Graph:
4844
4881
 
4845
4882
  Parameters
4846
4883
  ----------
4847
- graph : topologic.Graph
4884
+ graph : topologic_core.Graph
4848
4885
  The input graph
4849
4886
  path : str
4850
4887
  The desired path to the output folder where the graphs, edges, and nodes CSV files will be saved.
@@ -4983,7 +5020,7 @@ class Graph:
4983
5020
  else:
4984
5021
  return 'string'
4985
5022
 
4986
- if not isinstance(graph, topologic.Graph):
5023
+ if not Topology.IsInstance(graph, "Graph"):
4987
5024
  print("Graph.ExportToGEXF - Error: the input graph parameter is not a valid graph. Returning None.")
4988
5025
  return None
4989
5026
  if not isinstance(path, str):
@@ -5181,7 +5218,7 @@ class Graph:
5181
5218
 
5182
5219
  Parameters
5183
5220
  ----------
5184
- graph : topologic.Graph
5221
+ graph : topologic_core.Graph
5185
5222
  The input graph.
5186
5223
  path : str
5187
5224
  The path to the JSON file.
@@ -5251,7 +5288,7 @@ class Graph:
5251
5288
 
5252
5289
  Parameters
5253
5290
  ----------
5254
- graph : topologic.Graph
5291
+ graph : topologic_core.Graph
5255
5292
  The input graph.
5256
5293
  layout : str , optional
5257
5294
  The desired mode for flattening. If set to 'spring', the algorithm uses a simplified version of the Fruchterman-Reingold force-directed algorithm to flatten and distribute the vertices.
@@ -5263,16 +5300,17 @@ class Graph:
5263
5300
  The desired random seed to use. The default is None.
5264
5301
  iterations : int , optional
5265
5302
  The desired maximum number of iterations to solve the forces in the 'spring' mode. The default is 50.
5266
- rootVertex : topologic.Vertex , optional
5303
+ rootVertex : topologic_core.Vertex , optional
5267
5304
  The desired vertex to use as the root of the tree and radial layouts.
5268
5305
 
5269
5306
  Returns
5270
5307
  -------
5271
- topologic.Graph
5308
+ topologic_core.Graph
5272
5309
  The flattened graph.
5273
5310
 
5274
5311
  """
5275
- import math
5312
+ from topologicpy.Vertex import Vertex
5313
+ from topologicpy.Topology import Topology
5276
5314
  import numpy as np
5277
5315
 
5278
5316
  def buchheim(tree):
@@ -5569,7 +5607,7 @@ class Graph:
5569
5607
  i = degrees.index(max(degrees))
5570
5608
  return vertices[i], i
5571
5609
 
5572
- if not isinstance(graph, topologic.Graph):
5610
+ if not Topology.IsInstance(graph, "Graph"):
5573
5611
  print("Graph.Flatten - Error: The input graph is not a valid topologic graph. Returning None.")
5574
5612
  return None
5575
5613
  d = Graph.MeshData(graph)
@@ -5604,7 +5642,7 @@ class Graph:
5604
5642
 
5605
5643
  Parameters
5606
5644
  ----------
5607
- graph : topologic.Graph
5645
+ graph : topologic_core.Graph
5608
5646
  The input graph.
5609
5647
  Returns
5610
5648
  -------
@@ -5612,7 +5650,7 @@ class Graph:
5612
5650
  The computed global clustering coefficient.
5613
5651
 
5614
5652
  """
5615
- import topologic_core as topologic
5653
+ from topologicpy.Topology import Topology
5616
5654
 
5617
5655
  def global_clustering_coefficient(adjacency_matrix):
5618
5656
  total_triangles = 0
@@ -5641,7 +5679,7 @@ class Graph:
5641
5679
 
5642
5680
  return global_clustering_coeff
5643
5681
 
5644
- if not isinstance(graph, topologic.Graph):
5682
+ if not Topology.IsInstance(graph, "Graph"):
5645
5683
  print("Graph.LocalClusteringCoefficient - Error: The input graph parameter is not a valid graph. Returning None.")
5646
5684
  return None
5647
5685
  adjacency_matrix = Graph.AdjacencyMatrix(graph)
@@ -5654,25 +5692,27 @@ class Graph:
5654
5692
 
5655
5693
  Parameters
5656
5694
  ----------
5657
- graph : topologic.Graph
5695
+ graph : topologic_core.Graph
5658
5696
  The input graph.
5659
5697
  """
5660
- if not isinstance(graph, topologic.Graph):
5698
+ from topologicpy.Topology import Topology
5699
+
5700
+ if not Topology.IsInstance(graph, "Graph"):
5661
5701
  print("Graph.Guid - Error: the input graph parameter is not a valid graph. Returning None.")
5662
5702
  return None
5663
5703
  return graph.GetGUID()
5664
5704
 
5665
5705
  @staticmethod
5666
- def IncomingEdges(graph: topologic.Graph, vertex: topologic.Vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
5706
+ def IncomingEdges(graph, vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
5667
5707
  """
5668
5708
  Returns the incoming edges connected to a vertex. An edge is considered incoming if its end vertex is
5669
5709
  coincident with the input vertex.
5670
5710
 
5671
5711
  Parameters
5672
5712
  ----------
5673
- graph : topologic.Graph
5713
+ graph : topologic_core.Graph
5674
5714
  The input graph.
5675
- vertex : topologic.Vertex
5715
+ vertex : topologic_core.Vertex
5676
5716
  The input vertex.
5677
5717
  directed : bool , optional
5678
5718
  If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. The default is False.
@@ -5685,11 +5725,14 @@ class Graph:
5685
5725
  The list of incoming edges
5686
5726
 
5687
5727
  """
5728
+ from topologicpy.Vertex import Vertex
5688
5729
  from topologicpy.Edge import Edge
5689
- if not isinstance(graph, topologic.Graph):
5730
+ from topologicpy.Topology import Topology
5731
+
5732
+ if not Topology.IsInstance(graph, "Graph"):
5690
5733
  print("Graph.IncomingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
5691
5734
  return None
5692
- if not isinstance(vertex, topologic.Vertex):
5735
+ if not Topology.IsInstance(vertex, "Vertex"):
5693
5736
  print("Graph.IncomingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
5694
5737
  return None
5695
5738
 
@@ -5704,16 +5747,16 @@ class Graph:
5704
5747
  return incoming_edges
5705
5748
 
5706
5749
  @staticmethod
5707
- def IncomingVertices(graph: topologic.Graph, vertex: topologic.Vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
5750
+ def IncomingVertices(graph, vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
5708
5751
  """
5709
5752
  Returns the incoming vertices connected to a vertex. A vertex is considered incoming if it is an adjacent vertex to the input vertex
5710
5753
  and the the edge connecting it to the input vertex is an incoming edge.
5711
5754
 
5712
5755
  Parameters
5713
5756
  ----------
5714
- graph : topologic.Graph
5757
+ graph : topologic_core.Graph
5715
5758
  The input graph.
5716
- vertex : topologic.Vertex
5759
+ vertex : topologic_core.Vertex
5717
5760
  The input vertex.
5718
5761
  directed : bool , optional
5719
5762
  If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. The default is False.
@@ -5727,10 +5770,12 @@ class Graph:
5727
5770
 
5728
5771
  """
5729
5772
  from topologicpy.Edge import Edge
5730
- if not isinstance(graph, topologic.Graph):
5773
+ from topologicpy.Topology import Topology
5774
+
5775
+ if not Topology.IsInstance(graph, "Graph"):
5731
5776
  print("Graph.IncomingVertices - Error: The input graph parameter is not a valid graph. Returning None.")
5732
5777
  return None
5733
- if not isinstance(vertex, topologic.Vertex):
5778
+ if not Topology.IsInstance(vertex, "Vertex"):
5734
5779
  print("Graph.IncomingVertices - Error: The input vertex parameter is not a valid vertex. Returning None.")
5735
5780
  return None
5736
5781
 
@@ -5750,7 +5795,7 @@ class Graph:
5750
5795
 
5751
5796
  Parameters
5752
5797
  ----------
5753
- graph : topologic.Graph
5798
+ graph : topologic_core.Graph
5754
5799
  The input graph.
5755
5800
  tolerance : float , optional
5756
5801
  The desired tolerance. The default is 0.0001.
@@ -5763,6 +5808,9 @@ class Graph:
5763
5808
  """
5764
5809
  # From https://www.geeksforgeeks.org/bipartite-graph/
5765
5810
  # This code is contributed by divyesh072019.
5811
+
5812
+ from topologicpy.Topology import Topology
5813
+
5766
5814
  def isBipartite(V, adj):
5767
5815
  # vector to store colour of vertex
5768
5816
  # assigning all to -1 i.e. uncoloured
@@ -5814,7 +5862,7 @@ class Graph:
5814
5862
  # if all vertexes are coloured such that
5815
5863
  # no two connected vertex have same colours
5816
5864
  return True
5817
- if not isinstance(graph, topologic.Graph):
5865
+ if not Topology.IsInstance(graph, "Graph"):
5818
5866
  print("Graph.IsBipartite - Error: The input graph is not a valid graph. Returning None.")
5819
5867
  return None
5820
5868
  order = Graph.Order(graph)
@@ -5828,7 +5876,7 @@ class Graph:
5828
5876
 
5829
5877
  Parameters
5830
5878
  ----------
5831
- graph : topologic.Graph
5879
+ graph : topologic_core.Graph
5832
5880
  The input graph.
5833
5881
 
5834
5882
  Returns
@@ -5837,7 +5885,9 @@ class Graph:
5837
5885
  True if the input graph is complete. False otherwise
5838
5886
 
5839
5887
  """
5840
- if not isinstance(graph, topologic.Graph):
5888
+ from topologicpy.Topology import Topology
5889
+
5890
+ if not Topology.IsInstance(graph, "Graph"):
5841
5891
  print("Graph.IsComplete - Error: The input graph is not a valid graph. Returning None.")
5842
5892
  return None
5843
5893
  return graph.IsComplete()
@@ -5849,7 +5899,7 @@ class Graph:
5849
5899
 
5850
5900
  Parameters
5851
5901
  ----------
5852
- graph : topologic.Graph
5902
+ graph : topologic_core.Graph
5853
5903
  The input graph.
5854
5904
  sequence : list
5855
5905
  The input sequence.
@@ -5860,7 +5910,9 @@ class Graph:
5860
5910
  True if the input sequence satisfies the Erdős–Gallai theorem. False otherwise.
5861
5911
 
5862
5912
  """
5863
- if not isinstance(graph, topologic.Graph):
5913
+ from topologicpy.Topology import Topology
5914
+
5915
+ if not Topology.IsInstance(graph, "Graph"):
5864
5916
  print("Graph.IsErdoesGallai - Error: The input graph is not a valid graph. Returning None.")
5865
5917
  return None
5866
5918
  return graph.IsErdoesGallai(sequence)
@@ -5872,7 +5924,7 @@ class Graph:
5872
5924
 
5873
5925
  Parameters
5874
5926
  ----------
5875
- graph : topologic.Graph
5927
+ graph : topologic_core.Graph
5876
5928
  The input graph.
5877
5929
 
5878
5930
  Returns
@@ -5881,7 +5933,9 @@ class Graph:
5881
5933
  The list of isolated vertices.
5882
5934
 
5883
5935
  """
5884
- if not isinstance(graph, topologic.Graph):
5936
+ from topologicpy.Topology import Topology
5937
+
5938
+ if not Topology.IsInstance(graph, "Graph"):
5885
5939
  print("Graph.IsolatedVertices - Error: The input graph is not a valid graph. Returning None.")
5886
5940
  return None
5887
5941
  vertices = []
@@ -5906,7 +5960,7 @@ class Graph:
5906
5960
 
5907
5961
  Parameters
5908
5962
  ----------
5909
- graph : topologic.Graph
5963
+ graph : topologic_core.Graph
5910
5964
  The input graph.
5911
5965
  verticesKey : str , optional
5912
5966
  The desired key name to call vertices. The default is "vertices".
@@ -6020,7 +6074,7 @@ class Graph:
6020
6074
 
6021
6075
  Parameters
6022
6076
  ----------
6023
- graph : topologic.Graph
6077
+ graph : topologic_core.Graph
6024
6078
  The input graph.
6025
6079
  verticesKey : str , optional
6026
6080
  The desired key name to call vertices. The default is "vertices".
@@ -6063,7 +6117,7 @@ class Graph:
6063
6117
 
6064
6118
  Parameters
6065
6119
  ----------
6066
- graph : topologic.Graph
6120
+ graph : topologic_core.Graph
6067
6121
  The input graph.
6068
6122
  vertices : list , optional
6069
6123
  The input list of vertices. If set to None, the local clustering coefficient of all vertices will be computed.
@@ -6077,7 +6131,7 @@ class Graph:
6077
6131
 
6078
6132
  """
6079
6133
  from topologicpy.Vertex import Vertex
6080
- import topologic_core as topologic
6134
+ from topologicpy.Topology import Topology
6081
6135
 
6082
6136
  def local_clustering_coefficient(adjacency_matrix, node):
6083
6137
  """
@@ -6107,14 +6161,14 @@ class Graph:
6107
6161
  local_clustering_coeff = 2.0 * num_connections / (num_neighbors * (num_neighbors - 1))
6108
6162
 
6109
6163
  return local_clustering_coeff
6110
- if not isinstance(graph, topologic.Graph):
6164
+ if not Topology.IsInstance(graph, "Graph"):
6111
6165
  print("Graph.LocalClusteringCoefficient - Error: The input graph parameter is not a valid graph. Returning None.")
6112
6166
  return None
6113
6167
  if vertices == None:
6114
6168
  vertices = Graph.Vertices(graph)
6115
- if isinstance(vertices, topologic.Vertex):
6169
+ if Topology.IsInstance(vertices, "Vertex"):
6116
6170
  vertices = [vertices]
6117
- vertices = [v for v in vertices if isinstance(v, topologic.Vertex)]
6171
+ vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
6118
6172
  if len(vertices) < 1:
6119
6173
  print("Graph.LocalClusteringCoefficient - Error: The input vertices parameter does not contain valid vertices. Returning None.")
6120
6174
  return None
@@ -6136,11 +6190,11 @@ class Graph:
6136
6190
 
6137
6191
  Parameters
6138
6192
  ----------
6139
- graph : topologic.Graph
6193
+ graph : topologic_core.Graph
6140
6194
  The input graph.
6141
- vertexA : topologic.Vertex
6195
+ vertexA : topologic_core.Vertex
6142
6196
  The first input vertex.
6143
- vertexB : topologic.Vertex
6197
+ vertexB : topologic_core.Vertex
6144
6198
  The second input vertex.
6145
6199
  vertexKey : str , optional
6146
6200
  The vertex key to maximize. If set the vertices dictionaries will be searched for this key and the associated value will be used to compute the longest path that maximizes the total value. The value must be numeric. The default is None.
@@ -6155,7 +6209,7 @@ class Graph:
6155
6209
 
6156
6210
  Returns
6157
6211
  -------
6158
- topologic.Wire
6212
+ topologic_core.Wire
6159
6213
  The longest path between the input vertices.
6160
6214
 
6161
6215
  """
@@ -6167,13 +6221,13 @@ class Graph:
6167
6221
  from topologicpy.Topology import Topology
6168
6222
  from topologicpy.Helper import Helper
6169
6223
 
6170
- if not isinstance(graph, topologic.Graph):
6224
+ if not Topology.IsInstance(graph, "Graph"):
6171
6225
  print("Graph.LongestPath - Error: the input graph is not a valid graph. Returning None.")
6172
6226
  return None
6173
- if not isinstance(vertexA, topologic.Vertex):
6227
+ if not Topology.IsInstance(vertexA, "Vertex"):
6174
6228
  print("Graph.LongestPath - Error: the input vertexA is not a valid vertex. Returning None.")
6175
6229
  return None
6176
- if not isinstance(vertexB, topologic.Vertex):
6230
+ if not Topology.IsInstance(vertexB, "Vertex"):
6177
6231
  print("Graph.LongestPath - Error: the input vertexB is not a valid vertex. Returning None.")
6178
6232
  return None
6179
6233
 
@@ -6224,9 +6278,9 @@ class Graph:
6224
6278
 
6225
6279
  sv = Topology.Vertices(longest_path)[0]
6226
6280
  if Vertex.Distance(sv, vertexB) < tolerance: # Wire is reversed. Re-reverse it
6227
- if isinstance(longest_path, topologic.Edges):
6281
+ if Topology.IsInstance(longest_path, "Edge"):
6228
6282
  longest_path = Edge.Reverse(longest_path)
6229
- if isinstance(longest_path, topologic.Wire):
6283
+ elif Topology.IsInstance(longest_path, "Wire"):
6230
6284
  longest_path = Wire.Reverse(longest_path)
6231
6285
  longest_path = Wire.OrientEdges(longest_path, Wire.StartVertex(longest_path), tolerance=tolerance)
6232
6286
  if not costKey == None:
@@ -6242,7 +6296,7 @@ class Graph:
6242
6296
 
6243
6297
  Parameters
6244
6298
  ----------
6245
- graph : topologic.Graph
6299
+ graph : topologic_core.Graph
6246
6300
  the input graph.
6247
6301
 
6248
6302
  Returns
@@ -6251,7 +6305,9 @@ class Graph:
6251
6305
  The maximum delta.
6252
6306
 
6253
6307
  """
6254
- if not isinstance(graph, topologic.Graph):
6308
+ from topologicpy.Topology import Topology
6309
+
6310
+ if not Topology.IsInstance(graph, "Graph"):
6255
6311
  print("Graph.MaximumDelta - Error: The input graph is not a valid graph. Returning None.")
6256
6312
  return None
6257
6313
  return graph.MaximumDelta()
@@ -6263,11 +6319,11 @@ class Graph:
6263
6319
 
6264
6320
  Parameters
6265
6321
  ----------
6266
- graph : topologic.Graph
6322
+ graph : topologic_core.Graph
6267
6323
  The input graph. This is assumed to be a directed graph
6268
- source : topologic.Vertex
6324
+ source : topologic_core.Vertex
6269
6325
  The input source vertex.
6270
- sink : topologic.Vertex
6326
+ sink : topologic_core.Vertex
6271
6327
  The input sink/target vertex.
6272
6328
  edgeKeyFwd : str , optional
6273
6329
  The edge dictionary key to use to find the value of the forward capacity of the edge. If not set, the length of the edge is used as its capacity. The default is None.
@@ -6289,6 +6345,9 @@ class Graph:
6289
6345
 
6290
6346
  """
6291
6347
  from topologicpy.Vertex import Vertex
6348
+ from topologicpy.Dictionary import Dictionary
6349
+ from topologicpy.Topology import Topology
6350
+
6292
6351
  # Using BFS as a searching algorithm
6293
6352
  def searching_algo_BFS(adjMatrix, s, t, parent):
6294
6353
 
@@ -6372,7 +6431,7 @@ class Graph:
6372
6431
 
6373
6432
  Parameters
6374
6433
  ----------
6375
- graph : topologic.Graph
6434
+ graph : topologic_core.Graph
6376
6435
  The input graph.
6377
6436
 
6378
6437
  Returns
@@ -6386,8 +6445,9 @@ class Graph:
6386
6445
 
6387
6446
  """
6388
6447
  from topologicpy.Vertex import Vertex
6389
- from topologicpy.Edge import Edge
6390
6448
  from topologicpy.Dictionary import Dictionary
6449
+ from topologicpy.Topology import Topology
6450
+
6391
6451
  g_vertices = Graph.Vertices(g)
6392
6452
  m_vertices = []
6393
6453
  v_dicts = []
@@ -6419,7 +6479,7 @@ class Graph:
6419
6479
 
6420
6480
  Parameters
6421
6481
  ----------
6422
- graph : topologic.Graph
6482
+ graph : topologic_core.Graph
6423
6483
  The input graph.
6424
6484
 
6425
6485
  Returns
@@ -6428,7 +6488,9 @@ class Graph:
6428
6488
  The minimum delta.
6429
6489
 
6430
6490
  """
6431
- if not isinstance(graph, topologic.Graph):
6491
+ from topologicpy.Topology import Topology
6492
+
6493
+ if not Topology.IsInstance(graph, "Graph"):
6432
6494
  print("Graph.MinimumDelta - Error: The input graph is not a valid graph. Returning None.")
6433
6495
  return None
6434
6496
  return graph.MinimumDelta()
@@ -6440,7 +6502,7 @@ class Graph:
6440
6502
 
6441
6503
  Parameters
6442
6504
  ----------
6443
- graph : topologic.Graph
6505
+ graph : topologic_core.Graph
6444
6506
  The input graph.
6445
6507
  edgeKey : string , optional
6446
6508
  If set, the value of the edgeKey will be used as the weight and the tree will minimize the weight. The value associated with the edgeKey must be numerical. If the key is not set, the edges will be sorted by their length. The default is None
@@ -6449,20 +6511,22 @@ class Graph:
6449
6511
 
6450
6512
  Returns
6451
6513
  -------
6452
- topologic.Graph
6514
+ topologic_core.Graph
6453
6515
  The minimum spanning tree.
6454
6516
 
6455
6517
  """
6456
6518
  from topologicpy.Vertex import Vertex
6457
6519
  from topologicpy.Edge import Edge
6458
6520
  from topologicpy.Dictionary import Dictionary
6521
+ from topologicpy.Topology import Topology
6522
+
6459
6523
  def vertexInList(vertex, vertexList, tolerance=0.0001):
6460
6524
  for v in vertexList:
6461
6525
  if Vertex.Distance(v, vertex) < tolerance:
6462
6526
  return True
6463
6527
  return False
6464
6528
 
6465
- if not isinstance(graph, topologic.Graph):
6529
+ if not Topology.IsInstance(graph, "Graph"):
6466
6530
  print("Graph.MinimumSpanningTree - Error: The input graph is not a valid graph. Returning None.")
6467
6531
  return None
6468
6532
  edges = Graph.Edges(graph)
@@ -6502,7 +6566,7 @@ class Graph:
6502
6566
 
6503
6567
  Parameters
6504
6568
  ----------
6505
- face : topologic.Face
6569
+ face : topologic_core.Face
6506
6570
  The input boundary. View edges will be clipped to this face. The holes in the face are used as the obstacles
6507
6571
  sources : list
6508
6572
  The first input list of sources (vertices). Navigation edges will connect these veritces to destinations.
@@ -6515,7 +6579,7 @@ class Graph:
6515
6579
 
6516
6580
  Returns
6517
6581
  -------
6518
- topologic.Graph
6582
+ topologic_core.Graph
6519
6583
  The navigation graph.
6520
6584
 
6521
6585
  """
@@ -6529,7 +6593,7 @@ class Graph:
6529
6593
  import topologic_core as topologic
6530
6594
  from tqdm.auto import tqdm
6531
6595
 
6532
- if not isinstance(face, topologic.Face):
6596
+ if not Topology.IsInstance(face, "Face"):
6533
6597
  print("Graph.NavigationGraph - Error: The input face parameter is not a valid face. Returning None")
6534
6598
  return None
6535
6599
  if sources == None:
@@ -6543,17 +6607,17 @@ class Graph:
6543
6607
  if not isinstance(destinations, list):
6544
6608
  print("Graph.NavigationGraph - Error: The input destinations parameter is not a valid list. Returning None")
6545
6609
  return None
6546
- sources = [v for v in sources if isinstance(v, topologic.Vertex)]
6610
+ sources = [v for v in sources if Topology.IsInstance(v, "Vertex")]
6547
6611
  if len(sources) < 1:
6548
6612
  print("Graph.NavigationGraph - Error: The input sources parameter does not contain any vertices. Returning None")
6549
6613
  return None
6550
- destinations = [v for v in destinations if isinstance(v, topologic.Vertex)]
6614
+ destinations = [v for v in destinations if Topology.IsInstance(v, "Vertex")]
6551
6615
  #if len(destinations) < 1: #Nothing to navigate to, so return a graph made of sources
6552
6616
  #return Graph.ByVerticesEdges(sources, [])
6553
6617
 
6554
6618
  # Add obstuse angles of external boundary to viewpoints
6555
6619
  e_boundary = Face.ExternalBoundary(face)
6556
- if isinstance(e_boundary, topologic.Wire):
6620
+ if Topology.IsInstance(e_boundary, "Wire"):
6557
6621
  vertices = Topology.Vertices(e_boundary)
6558
6622
  interior_angles = Wire.InteriorAngles(e_boundary)
6559
6623
  for i, ang in enumerate(interior_angles):
@@ -6562,7 +6626,7 @@ class Graph:
6562
6626
  destinations.append(vertices[i])
6563
6627
  i_boundaries = Face.InternalBoundaries(face)
6564
6628
  for i_boundary in i_boundaries:
6565
- if isinstance(i_boundary, topologic.Wire):
6629
+ if Topology.IsInstance(i_boundary, "Wire"):
6566
6630
  vertices = Topology.Vertices(i_boundary)
6567
6631
  interior_angles = Wire.InteriorAngles(i_boundary)
6568
6632
  for i, ang in enumerate(interior_angles):
@@ -6592,7 +6656,7 @@ class Graph:
6592
6656
  if Vertex.Distance(source, destination) > tolerance:
6593
6657
  edge = Edge.ByVertices([source,destination])
6594
6658
  e = Topology.Boolean(edge, face, operation="intersect")
6595
- if isinstance(e, topologic.Edge):
6659
+ if Topology.IsInstance(e, "Edge"):
6596
6660
  final_edges.append(edge)
6597
6661
  used[i][j] = 1
6598
6662
  if not index_a == None and not index_b == None:
@@ -6613,22 +6677,24 @@ class Graph:
6613
6677
 
6614
6678
  Parameters
6615
6679
  ----------
6616
- graph : topologic.Graph
6680
+ graph : topologic_core.Graph
6617
6681
  The input graph.
6618
- vertex : topologic.Vertex
6682
+ vertex : topologic_core.Vertex
6619
6683
  The input vertex.
6620
6684
 
6621
6685
  Returns
6622
6686
  -------
6623
- topologic.Vertex
6687
+ topologic_core.Vertex
6624
6688
  The vertex in the input graph that is the nearest to the input vertex.
6625
6689
 
6626
6690
  """
6627
6691
  from topologicpy.Vertex import Vertex
6628
- if not isinstance(graph, topologic.Graph):
6692
+ from topologicpy.Topology import Topology
6693
+
6694
+ if not Topology.IsInstance(graph, "Graph"):
6629
6695
  print("Graph.NearestVertex - Error: The input graph is not a valid graph. Returning None.")
6630
6696
  return None
6631
- if not isinstance(vertex, topologic.Vertex):
6697
+ if not Topology.IsInstance(vertex, "Vertex"):
6632
6698
  print("Graph.NearestVertex - Error: The input vertex is not a valid vertex. Returning None.")
6633
6699
  return None
6634
6700
  vertices = Graph.Vertices(graph)
@@ -6649,7 +6715,7 @@ class Graph:
6649
6715
 
6650
6716
  Parameters
6651
6717
  ----------
6652
- graph : topologic.Graph
6718
+ graph : topologic_core.Graph
6653
6719
  The input graph.
6654
6720
 
6655
6721
  Returns
@@ -6677,7 +6743,7 @@ class Graph:
6677
6743
  warnings.warn("Graph - Error: Could not import networkx. Please try to install networkx manually. Returning None.")
6678
6744
  return None
6679
6745
 
6680
- if not isinstance(graph, topologic.Graph):
6746
+ if not Topology.IsInstance(graph, "Graph"):
6681
6747
  print("Graph.NetworkXGraph - Error: The input graph is not a valid graph. Returning None.")
6682
6748
  return None
6683
6749
 
@@ -6723,7 +6789,7 @@ class Graph:
6723
6789
 
6724
6790
  Parameters
6725
6791
  ----------
6726
- graph : topologic.Graph
6792
+ graph : topologic_core.Graph
6727
6793
  The input graph.
6728
6794
 
6729
6795
  Returns
@@ -6732,22 +6798,24 @@ class Graph:
6732
6798
  The number of vertices in the input graph
6733
6799
 
6734
6800
  """
6735
- if not isinstance(graph, topologic.Graph):
6801
+ from topologicpy.Topology import Topology
6802
+
6803
+ if not Topology.IsInstance(graph, "Graph"):
6736
6804
  print("Graph.Order - Error: The input graph is not a valid graph. Returning None.")
6737
6805
  return None
6738
6806
  return len(Graph.Vertices(graph))
6739
6807
 
6740
6808
  @staticmethod
6741
- def OutgoingEdges(graph: topologic.Graph, vertex: topologic.Vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
6809
+ def OutgoingEdges(graph, vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
6742
6810
  """
6743
6811
  Returns the outgoing edges connected to a vertex. An edge is considered outgoing if its start vertex is
6744
6812
  coincident with the input vertex.
6745
6813
 
6746
6814
  Parameters
6747
6815
  ----------
6748
- graph : topologic.Graph
6816
+ graph : topologic_core.Graph
6749
6817
  The input graph.
6750
- vertex : topologic.Vertex
6818
+ vertex : topologic_core.Vertex
6751
6819
  The input vertex.
6752
6820
  directed : bool , optional
6753
6821
  If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. The default is False.
@@ -6760,11 +6828,14 @@ class Graph:
6760
6828
  The list of outgoing edges
6761
6829
 
6762
6830
  """
6831
+ from topologicpy.Vertex import Vertex
6763
6832
  from topologicpy.Edge import Edge
6764
- if not isinstance(graph, topologic.Graph):
6833
+ from topologicpy.Topology import Topology
6834
+
6835
+ if not Topology.IsInstance(graph, "Graph"):
6765
6836
  print("Graph.IncomingEdges - Error: The input graph parameter is not a valid graph. Returning None.")
6766
6837
  return None
6767
- if not isinstance(vertex, topologic.Vertex):
6838
+ if not Topology.IsInstance(vertex, "Vertex"):
6768
6839
  print("Graph.IncomingEdges - Error: The input vertex parameter is not a valid vertex. Returning None.")
6769
6840
  return None
6770
6841
 
@@ -6779,16 +6850,16 @@ class Graph:
6779
6850
  return outgoing_edges
6780
6851
 
6781
6852
  @staticmethod
6782
- def OutgoingVertices(graph: topologic.Graph, vertex: topologic.Vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
6853
+ def OutgoingVertices(graph, vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
6783
6854
  """
6784
6855
  Returns the list of outgoing vertices connected to a vertex. A vertex is considered outgoing if it is an adjacent vertex to the input vertex
6785
6856
  and the the edge connecting it to the input vertex is an outgoing edge.
6786
6857
 
6787
6858
  Parameters
6788
6859
  ----------
6789
- graph : topologic.Graph
6860
+ graph : topologic_core.Graph
6790
6861
  The input graph.
6791
- vertex : topologic.Vertex
6862
+ vertex : topologic_core.Vertex
6792
6863
  The input vertex.
6793
6864
  directed : bool , optional
6794
6865
  If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. The default is False.
@@ -6802,10 +6873,12 @@ class Graph:
6802
6873
 
6803
6874
  """
6804
6875
  from topologicpy.Edge import Edge
6805
- if not isinstance(graph, topologic.Graph):
6876
+ from topologicpy.Topology import Topology
6877
+
6878
+ if not Topology.IsInstance(graph, "Graph"):
6806
6879
  print("Graph.OutgoingVertices - Error: The input graph parameter is not a valid graph. Returning None.")
6807
6880
  return None
6808
- if not isinstance(vertex, topologic.Vertex):
6881
+ if not Topology.IsInstance(vertex, "Vertex"):
6809
6882
  print("Graph.OutgoingVertices - Error: The input vertex parameter is not a valid vertex. Returning None.")
6810
6883
  return None
6811
6884
 
@@ -6825,7 +6898,7 @@ class Graph:
6825
6898
 
6826
6899
  Parameters
6827
6900
  ----------
6828
- graph : topologic.Graph
6901
+ graph : topologic_core.Graph
6829
6902
  The input graph.
6830
6903
  alpha : float , optional
6831
6904
  The damping (dampening) factor. The default is 0.85. See https://en.wikipedia.org/wiki/PageRank.
@@ -6845,6 +6918,7 @@ class Graph:
6845
6918
  list
6846
6919
  The list of page ranks for the vertices in the graph.
6847
6920
  """
6921
+ from topologicpy.Vertex import Vertex
6848
6922
  from topologicpy.Helper import Helper
6849
6923
 
6850
6924
  vertices = Graph.Vertices(graph)
@@ -6881,34 +6955,35 @@ class Graph:
6881
6955
 
6882
6956
  Parameters
6883
6957
  ----------
6884
- graph : topologic.Graph
6958
+ graph : topologic_core.Graph
6885
6959
  The input graph.
6886
- vertexA : topologic.Vertex
6960
+ vertexA : topologic_core.Vertex
6887
6961
  The first input vertex.
6888
- vertexB : topologic.Vertex
6962
+ vertexB : topologic_core.Vertex
6889
6963
  The second input vertex.
6890
6964
  tolerance : float, optional
6891
6965
  The desired tolerance. The default is 0.0001.
6892
6966
 
6893
6967
  Returns
6894
6968
  -------
6895
- topologic.Wire
6969
+ topologic_core.Wire
6896
6970
  The path (wire) in the input graph that connects the input vertices.
6897
6971
 
6898
6972
  """
6899
6973
  from topologicpy.Wire import Wire
6974
+ from topologicpy.Topology import Topology
6900
6975
 
6901
- if not isinstance(graph, topologic.Graph):
6976
+ if not Topology.IsInstance(graph, "Graph"):
6902
6977
  print("Graph.Path - Error: The input graph is not a valid graph. Returning None.")
6903
6978
  return None
6904
- if not isinstance(vertexA, topologic.Vertex):
6979
+ if not Topology.IsInstance(vertexA, "Vertex"):
6905
6980
  print("Graph.Path - Error: The input vertexA is not a valid vertex. Returning None.")
6906
6981
  return None
6907
- if not isinstance(vertexB, topologic.Vertex):
6982
+ if not Topology.IsInstance(vertexB, "Vertex"):
6908
6983
  print("Graph.Path - Error: The input vertexB is not a valid vertex. Returning None.")
6909
6984
  return None
6910
6985
  path = graph.Path(vertexA, vertexB)
6911
- if isinstance(path, topologic.Wire):
6986
+ if Topology.IsInstance(path, "Wire"):
6912
6987
  path = Wire.OrientEdges(path, Wire.StartVertex(path), tolerance=tolerance)
6913
6988
  return path
6914
6989
 
@@ -6922,7 +6997,7 @@ class Graph:
6922
6997
 
6923
6998
  Parameters
6924
6999
  ----------
6925
- graph : topologic.Graph
7000
+ graph : topologic_core.Graph
6926
7001
  The input graph.
6927
7002
  path : str
6928
7003
  The desired file path to the HTML file into which to save the pyvis graph.
@@ -7115,23 +7190,25 @@ class Graph:
7115
7190
 
7116
7191
  Parameters
7117
7192
  ----------
7118
- graph : topologic.Graph
7193
+ graph : topologic_core.Graph
7119
7194
  The input graph.
7120
- edge : topologic.Edge
7195
+ edge : topologic_core.Edge
7121
7196
  The input edge.
7122
7197
  tolerance : float , optional
7123
7198
  The desired tolerance. The default is 0.0001.
7124
7199
 
7125
7200
  Returns
7126
7201
  -------
7127
- topologic.Graph
7202
+ topologic_core.Graph
7128
7203
  The input graph with the input edge removed.
7129
7204
 
7130
7205
  """
7131
- if not isinstance(graph, topologic.Graph):
7206
+ from topologicpy.Topology import Topology
7207
+
7208
+ if not Topology.IsInstance(graph, "Graph"):
7132
7209
  print("Graph.RemoveEdge - Error: The input graph is not a valid graph. Returning None.")
7133
7210
  return None
7134
- if not isinstance(edge, topologic.Edge):
7211
+ if not Topology.IsInstance(edge, "Edge"):
7135
7212
  print("Graph.RemoveEdge - Error: The input edge is not a valid edge. Returning None.")
7136
7213
  return None
7137
7214
  _ = graph.RemoveEdges([edge], tolerance)
@@ -7144,23 +7221,25 @@ class Graph:
7144
7221
 
7145
7222
  Parameters
7146
7223
  ----------
7147
- graph : topologic.Graph
7224
+ graph : topologic_core.Graph
7148
7225
  The input graph.
7149
- vertex : topologic.Vertex
7226
+ vertex : topologic_core.Vertex
7150
7227
  The input vertex.
7151
7228
  tolerance : float , optional
7152
7229
  The desired tolerance. The default is 0.0001.
7153
7230
 
7154
7231
  Returns
7155
7232
  -------
7156
- topologic.Graph
7233
+ topologic_core.Graph
7157
7234
  The input graph with the input vertex removed.
7158
7235
 
7159
7236
  """
7160
- if not isinstance(graph, topologic.Graph):
7237
+ from topologicpy.Topology import Topology
7238
+
7239
+ if not Topology.IsInstance(graph, "Graph"):
7161
7240
  print("Graph.RemoveVertex - Error: The input graph is not a valid graph. Returning None.")
7162
7241
  return None
7163
- if not isinstance(vertex, topologic.Vertex):
7242
+ if not Topology.IsInstance(vertex, "Vertex"):
7164
7243
  print("Graph.RemoveVertex - Error: The input vertex is not a valid vertex. Returning None.")
7165
7244
  return None
7166
7245
  graphVertex = Graph.NearestVertex(graph, vertex)
@@ -7174,25 +7253,26 @@ class Graph:
7174
7253
 
7175
7254
  Parameters
7176
7255
  ----------
7177
- graph : topologic.Graph
7256
+ graph : topologic_core.Graph
7178
7257
  The input graph.
7179
- dictionary : topologic.Dictionary or dict
7258
+ dictionary : topologic_core.Dictionary or dict
7180
7259
  The input dictionary.
7181
7260
 
7182
7261
  Returns
7183
7262
  -------
7184
- topologic.Graph
7263
+ topologic_core.Graph
7185
7264
  The input graph with the input dictionary set in it.
7186
7265
 
7187
7266
  """
7188
7267
  from topologicpy.Dictionary import Dictionary
7268
+ from topologicpy.Topology import Topology
7189
7269
 
7190
- if not isinstance(graph, topologic.Graph):
7270
+ if not Topology.IsInstance(graph, "Graph"):
7191
7271
  print("Graph.SetDictionary - Error: the input graph parameter is not a valid graph. Returning None.")
7192
7272
  return None
7193
7273
  if isinstance(dictionary, dict):
7194
7274
  dictionary = Dictionary.ByPythonDictionary(dictionary)
7195
- if not isinstance(dictionary, topologic.Dictionary):
7275
+ if not Topology.IsInstance(dictionary, "Dictionary"):
7196
7276
  print("Graph.SetDictionary - Warning: the input dictionary parameter is not a valid dictionary. Returning original input.")
7197
7277
  return graph
7198
7278
  if len(dictionary.Keys()) < 1:
@@ -7208,11 +7288,11 @@ class Graph:
7208
7288
 
7209
7289
  Parameters
7210
7290
  ----------
7211
- graph : topologic.Graph
7291
+ graph : topologic_core.Graph
7212
7292
  The input graph.
7213
- vertexA : topologic.Vertex
7293
+ vertexA : topologic_core.Vertex
7214
7294
  The first input vertex.
7215
- vertexB : topologic.Vertex
7295
+ vertexB : topologic_core.Vertex
7216
7296
  The second input vertex.
7217
7297
  vertexKey : string , optional
7218
7298
  The vertex key to minimise. If set the vertices dictionaries will be searched for this key and the associated value will be used to compute the shortest path that minimized the total value. The value must be numeric. The default is None.
@@ -7223,21 +7303,21 @@ class Graph:
7223
7303
 
7224
7304
  Returns
7225
7305
  -------
7226
- topologic.Wire
7306
+ topologic_core.Wire
7227
7307
  The shortest path between the input vertices.
7228
7308
 
7229
7309
  """
7230
- from topologicpy.Edge import Edge
7310
+ from topologicpy.Vertex import Vertex
7231
7311
  from topologicpy.Wire import Wire
7232
7312
  from topologicpy.Topology import Topology
7233
7313
 
7234
- if not isinstance(graph, topologic.Graph):
7314
+ if not Topology.IsInstance(graph, "Graph"):
7235
7315
  print("Graph.ShortestPath - Error: The input graph is not a valid graph. Returning None.")
7236
7316
  return None
7237
- if not isinstance(vertexA, topologic.Vertex):
7317
+ if not Topology.IsInstance(vertexA, "Vertex"):
7238
7318
  print("Graph.ShortestPath - Error: The input vertexA is not a valid vertex. Returning None.")
7239
7319
  return None
7240
- if not isinstance(vertexB, topologic.Vertex):
7320
+ if not Topology.IsInstance(vertexB, "Vertex"):
7241
7321
  print("Graph.ShortestPath - Error: The input vertexB is not a valid vertex. Returning None.")
7242
7322
  return None
7243
7323
  if edgeKey:
@@ -7247,11 +7327,11 @@ class Graph:
7247
7327
  gsv = Graph.NearestVertex(graph, vertexA)
7248
7328
  gev = Graph.NearestVertex(graph, vertexB)
7249
7329
  shortest_path = graph.ShortestPath(gsv, gev, vertexKey, edgeKey)
7250
- if isinstance(shortest_path, topologic.Edge):
7330
+ if Topology.IsInstance(shortest_path, "Edge"):
7251
7331
  shortest_path = Wire.ByEdges([shortest_path])
7252
7332
  sv = Topology.Vertices(shortest_path)[0]
7253
7333
  if Vertex.Distance(sv, gev) < tolerance: # Path is reversed. Correct it.
7254
- if isinstance(shortest_path, topologic.Wire):
7334
+ if Topology.IsInstance(shortest_path, "Wire"):
7255
7335
  shortest_path = Wire.Reverse(shortest_path)
7256
7336
  shortest_path = Wire.OrientEdges(shortest_path, Wire.StartVertex(shortest_path), tolerance=tolerance)
7257
7337
  return shortest_path
@@ -7266,11 +7346,11 @@ class Graph:
7266
7346
 
7267
7347
  Parameters
7268
7348
  ----------
7269
- graph : topologic.Graph
7349
+ graph : topologic_core.Graph
7270
7350
  The input graph.
7271
- vertexA : topologic.Vertex
7351
+ vertexA : topologic_core.Vertex
7272
7352
  The first input vertex.
7273
- vertexB : topologic.Vertex
7353
+ vertexB : topologic_core.Vertex
7274
7354
  The second input vertex.
7275
7355
  vertexKey : string , optional
7276
7356
  The vertex key to minimise. If set the vertices dictionaries will be searched for this key and the associated value will be used to compute the shortest path that minimized the total value. The value must be numeric. The default is None.
@@ -7289,8 +7369,7 @@ class Graph:
7289
7369
  The list of shortest paths between the input vertices.
7290
7370
 
7291
7371
  """
7292
- from topologicpy.Vertex import Vertex
7293
- from topologicpy.Wire import Wire
7372
+ from topologicpy.Topology import Topology
7294
7373
 
7295
7374
  def isUnique(paths, path):
7296
7375
  if path == None:
@@ -7298,19 +7377,19 @@ class Graph:
7298
7377
  if len(paths) < 1:
7299
7378
  return True
7300
7379
  for aPath in paths:
7301
- copyPath = topologic.Topology.DeepCopy(aPath)
7380
+ copyPath = topologic.Topology.DeepCopy(aPath) # Hook to Core
7302
7381
  dif = copyPath.Difference(path, False)
7303
7382
  if dif == None:
7304
7383
  return False
7305
7384
  return True
7306
7385
 
7307
- if not isinstance(graph, topologic.Graph):
7386
+ if not Topology.IsInstance(graph, "Graph"):
7308
7387
  print("Graph.ShortestPaths - Error: The input graph parameter is not a valid graph. Returning None.")
7309
7388
  return None
7310
- if not isinstance(vertexA, topologic.Vertex):
7389
+ if not Topology.IsInstance(vertexA, "Vertex"):
7311
7390
  print("Graph.ShortestPaths - Error: The input vertexA parameter is not a valid vertex. Returning None.")
7312
7391
  return None
7313
- if not isinstance(vertexB, topologic.Vertex):
7392
+ if not Topology.IsInstance(vertexB, "Vertex"):
7314
7393
  print("Graph.ShortestPaths - Error: The input vertexB parameter is not a valid vertex. Returning None.")
7315
7394
  return None
7316
7395
  shortestPaths = []
@@ -7338,7 +7417,7 @@ class Graph:
7338
7417
 
7339
7418
  Parameters
7340
7419
  ----------
7341
- graph : topologic.Graph
7420
+ graph : topologic_core.Graph
7342
7421
  The input graph.
7343
7422
  vertexColor : str , optional
7344
7423
  The desired color of the output vertices. This can be any plotly color string and may be specified as:
@@ -7428,8 +7507,9 @@ class Graph:
7428
7507
 
7429
7508
  """
7430
7509
  from topologicpy.Plotly import Plotly
7510
+ from topologicpy.Topology import Topology
7431
7511
 
7432
- if not isinstance(graph, topologic.Graph):
7512
+ if not Topology.IsInstance(graph, "Graph"):
7433
7513
  print("Graph.Show - Error: The input graph is not a valid graph. Returning None.")
7434
7514
  return None
7435
7515
 
@@ -7445,7 +7525,7 @@ class Graph:
7445
7525
 
7446
7526
  Parameters
7447
7527
  ----------
7448
- graph : topologic.Graph
7528
+ graph : topologic_core.Graph
7449
7529
  The input graph.
7450
7530
 
7451
7531
  Returns
@@ -7454,7 +7534,9 @@ class Graph:
7454
7534
  The number of edges in the input graph.
7455
7535
 
7456
7536
  """
7457
- if not isinstance(graph, topologic.Graph):
7537
+ from topologicpy.Topology import Topology
7538
+
7539
+ if not Topology.IsInstance(graph, "Graph"):
7458
7540
  print("Graph.Size - Error: The input graph is not a valid graph. Returning None.")
7459
7541
  return None
7460
7542
  return len(Graph.Edges(graph))
@@ -7466,11 +7548,11 @@ class Graph:
7466
7548
 
7467
7549
  Parameters
7468
7550
  ----------
7469
- graph : topologic.Graph
7551
+ graph : topologic_core.Graph
7470
7552
  The input graph.
7471
- vertexA : topologic.Vertex
7553
+ vertexA : topologic_core.Vertex
7472
7554
  The first input vertex.
7473
- vertexB : topologic.Vertex
7555
+ vertexB : topologic_core.Vertex
7474
7556
  The second input vertex.
7475
7557
  tolerance : float , optional
7476
7558
  The desired tolerance. The default is 0.0001.
@@ -7481,13 +7563,15 @@ class Graph:
7481
7563
  The topological distance between the input vertices.
7482
7564
 
7483
7565
  """
7484
- if not isinstance(graph, topologic.Graph):
7566
+ from topologicpy.Topology import Topology
7567
+
7568
+ if not Topology.IsInstance(graph, "Graph"):
7485
7569
  print("Graph.TopologicalDistance - Error: The input graph is not a valid graph. Returning None.")
7486
7570
  return None
7487
- if not isinstance(vertexA, topologic.Vertex):
7571
+ if not Topology.IsInstance(vertexA, "Vertex"):
7488
7572
  print("Graph.TopologicalDistance - Error: The input vertexA is not a valid vertex. Returning None.")
7489
7573
  return None
7490
- if not isinstance(vertexB, topologic.Vertex):
7574
+ if not Topology.IsInstance(vertexB, "Vertex"):
7491
7575
  print("Graph.TopologicalDistance - Error: The input vertexB is not a valid vertex. Returning None.")
7492
7576
  return None
7493
7577
  return graph.TopologicalDistance(vertexA, vertexB, tolerance)
@@ -7499,16 +7583,18 @@ class Graph:
7499
7583
 
7500
7584
  Parameters
7501
7585
  ----------
7502
- graph : topologic.Graph
7586
+ graph : topologic_core.Graph
7503
7587
  The input graph.
7504
7588
 
7505
7589
  Returns
7506
7590
  -------
7507
- topologic.Cluster
7591
+ topologic_core.Cluster
7508
7592
  The topology of the input graph.
7509
7593
 
7510
7594
  """
7511
- if not isinstance(graph, topologic.Graph):
7595
+ from topologicpy.Topology import Topology
7596
+
7597
+ if not Topology.IsInstance(graph, "Graph"):
7512
7598
  print("Graph.Topology - Error: The input graph is not a valid graph. Returning None.")
7513
7599
  return None
7514
7600
  return graph.Topology()
@@ -7520,29 +7606,30 @@ class Graph:
7520
7606
 
7521
7607
  Parameters
7522
7608
  ----------
7523
- graph : topologic.Graph
7609
+ graph : topologic_core.Graph
7524
7610
  The input graph.
7525
- vertex : topologic.Vertex , optional
7611
+ vertex : topologic_core.Vertex , optional
7526
7612
  The input root vertex. If not set, the first vertex in the graph is set as the root vertex. The default is None.
7527
7613
  tolerance : float , optional
7528
7614
  The desired tolerance. The default is 0.0001.
7529
7615
 
7530
7616
  Returns
7531
7617
  -------
7532
- topologic.Graph
7618
+ topologic_core.Graph
7533
7619
  The tree graph version of the input graph.
7534
7620
 
7535
7621
  """
7536
7622
  from topologicpy.Vertex import Vertex
7537
7623
  from topologicpy.Edge import Edge
7624
+ from topologicpy.Topology import Topology
7538
7625
 
7539
7626
  def vertexInList(vertex, vertexList):
7540
7627
  if vertex and vertexList:
7541
- if isinstance(vertex, topologic.Vertex) and isinstance(vertexList, list):
7628
+ if Topology.IsInstance(vertex, "Vertex") and isinstance(vertexList, list):
7542
7629
  for i in range(len(vertexList)):
7543
7630
  if vertexList[i]:
7544
- if isinstance(vertexList[i], topologic.Vertex):
7545
- if topologic.Topology.IsSame(vertex, vertexList[i]):
7631
+ if Topology.IsInstance(vertexList[i], "Vertex"):
7632
+ if Topology.IsSame(vertex, vertexList[i]):
7546
7633
  return True
7547
7634
  return False
7548
7635
 
@@ -7579,10 +7666,10 @@ class Graph:
7579
7666
  dictionary = buildTree(graph, dictionary, child, vertex, tolerance)
7580
7667
  return dictionary
7581
7668
 
7582
- if not isinstance(graph, topologic.Graph):
7669
+ if not Topology.IsInstance(graph, "Graph"):
7583
7670
  print("Graph.Tree - Error: The input graph is not a valid graph. Returning None.")
7584
7671
  return None
7585
- if not isinstance(vertex, topologic.Vertex):
7672
+ if not Topology.IsInstance(vertex, "Vertex"):
7586
7673
  vertex = Graph.Vertices(graph)[0]
7587
7674
  else:
7588
7675
  vertex = Graph.NearestVertex(graph, vertex)
@@ -7591,15 +7678,15 @@ class Graph:
7591
7678
  return Graph.ByVerticesEdges(dictionary['vertices'], dictionary['edges'])
7592
7679
 
7593
7680
  @staticmethod
7594
- def VertexDegree(graph : topologic.Graph, vertex: topologic.Vertex, edgeKey: str = None, tolerance: float = 0.0001):
7681
+ def VertexDegree(graph, vertex, edgeKey: str = None, tolerance: float = 0.0001):
7595
7682
  """
7596
7683
  Returns the degree of the input vertex. See https://en.wikipedia.org/wiki/Degree_(graph_theory).
7597
7684
 
7598
7685
  Parameters
7599
7686
  ----------
7600
- graph : topologic.Graph
7687
+ graph : topologic_core.Graph
7601
7688
  The input graph.
7602
- vertex : topologic.Vertex
7689
+ vertex : topologic_core.Vertex
7603
7690
  The input vertex.
7604
7691
  edgeKey : str , optional
7605
7692
  If specified, the value in the connected edges' dictionary specified by the edgeKey string will be aggregated to calculate
@@ -7617,10 +7704,10 @@ class Graph:
7617
7704
  from topologicpy.Dictionary import Dictionary
7618
7705
  import numbers
7619
7706
 
7620
- if not isinstance(graph, topologic.Graph):
7707
+ if not Topology.IsInstance(graph, "Graph"):
7621
7708
  print("Graph.VertexDegree - Error: The input graph is not a valid graph. Returning None.")
7622
7709
  return None
7623
- if not isinstance(vertex, topologic.Vertex):
7710
+ if not Topology.IsInstance(vertex, "Vertex"):
7624
7711
  print("Graph.VertexDegree - Error: The input vertex is not a valid vertex. Returning None.")
7625
7712
  return None
7626
7713
  if not isinstance(edgeKey, str):
@@ -7643,7 +7730,7 @@ class Graph:
7643
7730
 
7644
7731
  Parameters
7645
7732
  ----------
7646
- graph : topologic.Graph
7733
+ graph : topologic_core.Graph
7647
7734
  The input graph.
7648
7735
  vertexKey : str , optional
7649
7736
  If set, the returned list of vertices is sorted according to the dicitonary values stored under this key. The default is None.
@@ -7655,10 +7742,11 @@ class Graph:
7655
7742
  The list of vertices in the input graph.
7656
7743
 
7657
7744
  """
7658
-
7659
7745
  from topologicpy.Helper import Helper
7746
+ from topologicpy.Dictionary import Dictionary
7747
+ from topologicpy.Topology import Topology
7660
7748
 
7661
- if not isinstance(graph, topologic.Graph):
7749
+ if not Topology.IsInstance(graph, "Graph"):
7662
7750
  print("Graph.Vertices - Error: The input graph is not a valid graph. Returning None.")
7663
7751
  return None
7664
7752
  vertices = []
@@ -7685,7 +7773,7 @@ class Graph:
7685
7773
 
7686
7774
  Parameters
7687
7775
  ----------
7688
- face : topologic.Face
7776
+ face : topologic_core.Face
7689
7777
  The input boundary. View edges will be clipped to this face. The holes in the face are used as the obstacles
7690
7778
  viewpointsA : list , optional
7691
7779
  The first input list of viewpoints (vertices). Visibility edges will connect these veritces to viewpointsB. If set to None, this parameters will be set to all vertices of the input face. The default is None.
@@ -7696,7 +7784,7 @@ class Graph:
7696
7784
 
7697
7785
  Returns
7698
7786
  -------
7699
- topologic.Graph
7787
+ topologic_core.Graph
7700
7788
  The visibility graph.
7701
7789
 
7702
7790
  """
@@ -7707,7 +7795,7 @@ class Graph:
7707
7795
  from topologicpy.Cluster import Cluster
7708
7796
  from topologicpy.Topology import Topology
7709
7797
 
7710
- if not isinstance(face, topologic.Face):
7798
+ if not Topology.IsInstance(face, "Face"):
7711
7799
  print("Graph.VisibilityGraph - Error: The input face parameter is not a valid face. Returning None")
7712
7800
  return None
7713
7801
  if viewpointsA == None:
@@ -7721,18 +7809,18 @@ class Graph:
7721
7809
  if not isinstance(viewpointsB, list):
7722
7810
  print("Graph.VisibilityGraph - Error: The input viewpointsB parameter is not a valid list. Returning None")
7723
7811
  return None
7724
- viewpointsA = [v for v in viewpointsA if isinstance(v, topologic.Vertex)]
7812
+ viewpointsA = [v for v in viewpointsA if Topology.IsInstance(v, "Vertex")]
7725
7813
  if len(viewpointsA) < 1:
7726
7814
  print("Graph.VisibilityGraph - Error: The input viewpointsA parameter does not contain any vertices. Returning None")
7727
7815
  return None
7728
- viewpointsB = [v for v in viewpointsB if isinstance(v, topologic.Vertex)]
7816
+ viewpointsB = [v for v in viewpointsB if Topology.IsInstance(v, "Vertex")]
7729
7817
  if len(viewpointsB) < 1: #Nothing to look at, so return a graph made of viewpointsA
7730
7818
  return Graph.ByVerticesEdges(viewpointsA, [])
7731
7819
 
7732
7820
  i_boundaries = Face.InternalBoundaries(face)
7733
7821
  obstacles = []
7734
7822
  for i_boundary in i_boundaries:
7735
- if isinstance(i_boundary, topologic.Wire):
7823
+ if Topology.IsInstance(i_boundary, "Wire"):
7736
7824
  obstacles.append(Face.ByWire(i_boundary))
7737
7825
  if len(obstacles) > 0:
7738
7826
  obstacle_cluster = Cluster.ByTopologies(obstacles)
@@ -7743,9 +7831,9 @@ class Graph:
7743
7831
  result = Topology.Difference(edge, obstacle_cluster)
7744
7832
  if result == None:
7745
7833
  return True
7746
- if isinstance(result, topologic.Cluster):
7834
+ if Topology.IsInstance(result, "Cluster"):
7747
7835
  return True
7748
- if isinstance(result, topologic.Edge):
7836
+ if Topology.IsInstance(result, "Edge"):
7749
7837
  if abs(Edge.Length(edge) - Edge.Length(result)) > tolerance:
7750
7838
  return True
7751
7839
  return False