topologicpy 0.7.57__py3-none-any.whl → 0.7.60__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/BVH.py +296 -0
- topologicpy/Edge.py +40 -16
- topologicpy/Graph.py +124 -79
- topologicpy/Plotly.py +33 -6
- topologicpy/Topology.py +16 -0
- topologicpy/Vector.py +0 -1
- topologicpy/Wire.py +159 -60
- topologicpy/version.py +1 -1
- {topologicpy-0.7.57.dist-info → topologicpy-0.7.60.dist-info}/METADATA +1 -1
- {topologicpy-0.7.57.dist-info → topologicpy-0.7.60.dist-info}/RECORD +13 -12
- {topologicpy-0.7.57.dist-info → topologicpy-0.7.60.dist-info}/LICENSE +0 -0
- {topologicpy-0.7.57.dist-info → topologicpy-0.7.60.dist-info}/WHEEL +0 -0
- {topologicpy-0.7.57.dist-info → topologicpy-0.7.60.dist-info}/top_level.txt +0 -0
topologicpy/Graph.py
CHANGED
@@ -500,7 +500,7 @@ class Graph:
|
|
500
500
|
return adjList
|
501
501
|
|
502
502
|
@staticmethod
|
503
|
-
def AddEdge(graph, edge, transferVertexDictionaries=False, transferEdgeDictionaries=False, tolerance=0.0001):
|
503
|
+
def AddEdge(graph, edge, transferVertexDictionaries: bool = False, transferEdgeDictionaries: bool = False, tolerance: float = 0.0001, silent: bool = False):
|
504
504
|
"""
|
505
505
|
Adds the input edge to the input Graph.
|
506
506
|
|
@@ -516,6 +516,8 @@ class Graph:
|
|
516
516
|
If set to True, the dictionaries of the edges are transferred to the graph.
|
517
517
|
tolerance : float , optional
|
518
518
|
The desired tolerance. The default is 0.0001.
|
519
|
+
silent : bool , optional
|
520
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
519
521
|
|
520
522
|
Returns
|
521
523
|
-------
|
@@ -555,11 +557,13 @@ class Graph:
|
|
555
557
|
return [graph_vertices, returnVertex]
|
556
558
|
|
557
559
|
if not Topology.IsInstance(graph, "Graph"):
|
558
|
-
|
560
|
+
if not silent:
|
561
|
+
print("Graph.AddEdge - Error: The input graph is not a valid graph. Returning None.")
|
559
562
|
return None
|
560
563
|
if not Topology.IsInstance(edge, "Edge"):
|
561
|
-
|
562
|
-
|
564
|
+
if not silent:
|
565
|
+
print("Graph.AddEdge - Error: The input edge is not a valid edge. Returning the input graph.")
|
566
|
+
return graph
|
563
567
|
graph_vertices = Graph.Vertices(graph)
|
564
568
|
graph_edges = Graph.Edges(graph, graph_vertices, tolerance)
|
565
569
|
vertices = Edge.Vertices(edge)
|
@@ -579,7 +583,7 @@ class Graph:
|
|
579
583
|
return new_graph
|
580
584
|
|
581
585
|
@staticmethod
|
582
|
-
def AddVertex(graph, vertex, tolerance=0.0001):
|
586
|
+
def AddVertex(graph, vertex, tolerance: float = 0.0001, silent: bool = False):
|
583
587
|
"""
|
584
588
|
Adds the input vertex to the input graph.
|
585
589
|
|
@@ -591,6 +595,8 @@ class Graph:
|
|
591
595
|
The input vertex.
|
592
596
|
tolerance : float , optional
|
593
597
|
The desired tolerance. The default is 0.0001.
|
598
|
+
silent : bool , optional
|
599
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
594
600
|
|
595
601
|
Returns
|
596
602
|
-------
|
@@ -601,16 +607,18 @@ class Graph:
|
|
601
607
|
from topologicpy.Topology import Topology
|
602
608
|
|
603
609
|
if not Topology.IsInstance(graph, "Graph"):
|
604
|
-
|
610
|
+
if not silent:
|
611
|
+
print("Graph.AddVertex - Error: The input graph is not a valid graph. Returning None.")
|
605
612
|
return None
|
606
613
|
if not Topology.IsInstance(vertex, "Vertex"):
|
607
|
-
|
608
|
-
|
614
|
+
if not silent:
|
615
|
+
print("Graph.AddVertex - Error: The input vertex is not a valid vertex. Returning the input graph.")
|
616
|
+
return graph
|
609
617
|
_ = graph.AddVertices([vertex], tolerance)
|
610
618
|
return graph
|
611
619
|
|
612
620
|
@staticmethod
|
613
|
-
def AddVertices(graph, vertices, tolerance=0.0001):
|
621
|
+
def AddVertices(graph, vertices, tolerance: float = 0.0001, silent: bool = False):
|
614
622
|
"""
|
615
623
|
Adds the input vertex to the input graph.
|
616
624
|
|
@@ -622,6 +630,8 @@ class Graph:
|
|
622
630
|
The input list of vertices.
|
623
631
|
tolerance : float , optional
|
624
632
|
The desired tolerance. The default is 0.0001.
|
633
|
+
silent : bool , optional
|
634
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
625
635
|
|
626
636
|
Returns
|
627
637
|
-------
|
@@ -632,20 +642,23 @@ class Graph:
|
|
632
642
|
from topologicpy.Topology import Topology
|
633
643
|
|
634
644
|
if not Topology.IsInstance(graph, "Graph"):
|
635
|
-
|
645
|
+
if not silent:
|
646
|
+
print("Graph.AddVertices - Error: The input graph is not a valid graph. Returning None.")
|
636
647
|
return None
|
637
648
|
if not isinstance(vertices, list):
|
638
|
-
|
649
|
+
if not silent:
|
650
|
+
print("Graph.AddVertices - Error: The input list of vertices is not a valid list. Returning None.")
|
639
651
|
return None
|
640
652
|
vertices = [v for v in vertices if Topology.IsInstance(v, "Vertex")]
|
641
653
|
if len(vertices) < 1:
|
642
|
-
|
654
|
+
if not silent:
|
655
|
+
print("Graph.AddVertices - Error: Could not find any valid vertices in the input list of vertices. Returning None.")
|
643
656
|
return None
|
644
657
|
_ = graph.AddVertices(vertices, tolerance)
|
645
658
|
return graph
|
646
659
|
|
647
660
|
@staticmethod
|
648
|
-
def AdjacentVertices(graph, vertex):
|
661
|
+
def AdjacentVertices(graph, vertex, silent: bool = False):
|
649
662
|
"""
|
650
663
|
Returns the list of vertices connected to the input vertex.
|
651
664
|
|
@@ -655,6 +668,8 @@ class Graph:
|
|
655
668
|
The input graph.
|
656
669
|
vertex : topologic_core.Vertex
|
657
670
|
the input vertex.
|
671
|
+
silent : bool , optional
|
672
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
658
673
|
|
659
674
|
Returns
|
660
675
|
-------
|
@@ -665,17 +680,19 @@ class Graph:
|
|
665
680
|
from topologicpy.Topology import Topology
|
666
681
|
|
667
682
|
if not Topology.IsInstance(graph, "Graph"):
|
668
|
-
|
683
|
+
if not silent:
|
684
|
+
print("Graph.AdjacentVertices - Error: The input graph is not a valid graph. Returning None.")
|
669
685
|
return None
|
670
686
|
if not Topology.IsInstance(vertex, "Vertex"):
|
671
|
-
|
687
|
+
if not silent:
|
688
|
+
print("Graph.AdjacentVertices - Error: The input vertex is not a valid vertex. Returning None.")
|
672
689
|
return None
|
673
690
|
vertices = []
|
674
691
|
_ = graph.AdjacentVertices(vertex, vertices)
|
675
692
|
return list(vertices)
|
676
693
|
|
677
694
|
@staticmethod
|
678
|
-
def AllPaths(graph, vertexA, vertexB, timeLimit=10):
|
695
|
+
def AllPaths(graph, vertexA, vertexB, timeLimit=10, silent: bool = False):
|
679
696
|
"""
|
680
697
|
Returns all the paths that connect the input vertices within the allowed time limit in seconds.
|
681
698
|
|
@@ -689,6 +706,8 @@ class Graph:
|
|
689
706
|
The second input vertex.
|
690
707
|
timeLimit : int , optional
|
691
708
|
The time limit in second. The default is 10 seconds.
|
709
|
+
silent : bool , optional
|
710
|
+
If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
|
692
711
|
|
693
712
|
Returns
|
694
713
|
-------
|
@@ -699,20 +718,23 @@ class Graph:
|
|
699
718
|
from topologicpy.Topology import Topology
|
700
719
|
|
701
720
|
if not Topology.IsInstance(graph, "Graph"):
|
702
|
-
|
721
|
+
if not silent:
|
722
|
+
print("Graph.AllPaths - Error: The input graph is not a valid graph. Returning None.")
|
703
723
|
return None
|
704
724
|
if not Topology.IsInstance(vertexA, "Vertex"):
|
705
|
-
|
725
|
+
if not silent:
|
726
|
+
print("Graph.AllPaths - Error: The input vertexA is not a valid vertex. Returning None.")
|
706
727
|
return None
|
707
728
|
if not Topology.IsInstance(vertexB, "Vertex"):
|
708
|
-
|
729
|
+
if not silent:
|
730
|
+
print("Graph.AllPaths - Error: The input vertexB is not a valid vertex. Returning None.")
|
709
731
|
return None
|
710
732
|
paths = []
|
711
733
|
_ = graph.AllPaths(vertexA, vertexB, True, timeLimit, paths)
|
712
734
|
return paths
|
713
735
|
|
714
736
|
@staticmethod
|
715
|
-
def AverageClusteringCoefficient(graph, mantissa: int = 6):
|
737
|
+
def AverageClusteringCoefficient(graph, mantissa: int = 6, silent: bool = False):
|
716
738
|
"""
|
717
739
|
Returns the average clustering coefficient of the input graph. See https://en.wikipedia.org/wiki/Clustering_coefficient.
|
718
740
|
|
@@ -732,11 +754,13 @@ class Graph:
|
|
732
754
|
from topologicpy.Topology import Topology
|
733
755
|
|
734
756
|
if not Topology.IsInstance(graph, "Graph"):
|
735
|
-
|
757
|
+
if not silent:
|
758
|
+
print("Graph.LocalClusteringCoefficient - Error: The input graph parameter is not a valid graph. Returning None.")
|
736
759
|
return None
|
737
760
|
vertices = Graph.Vertices(graph)
|
738
761
|
if len(vertices) < 1:
|
739
|
-
|
762
|
+
if not silent:
|
763
|
+
print("Graph.LocalClusteringCoefficient - Error: The input graph parameter is a NULL graph. Returning None.")
|
740
764
|
return None
|
741
765
|
if len(vertices) == 1:
|
742
766
|
return 0.0
|
@@ -2383,6 +2407,7 @@ class Graph:
|
|
2383
2407
|
idKey: str = "TOPOLOGIC_ID",
|
2384
2408
|
outpostsKey: str = "outposts",
|
2385
2409
|
vertexCategoryKey: str = "category",
|
2410
|
+
edgeCategoryKey : str = "category",
|
2386
2411
|
useInternalVertex: bool =True,
|
2387
2412
|
storeBREP: bool =False,
|
2388
2413
|
mantissa: int = 6,
|
@@ -2415,7 +2440,7 @@ class Graph:
|
|
2415
2440
|
outpostsKey : str , optional
|
2416
2441
|
The key to use to find the list of outposts. It is case insensitive. The default is "outposts".
|
2417
2442
|
vertexCategoryKey : str , optional
|
2418
|
-
The key under which to store the node type. Node
|
2443
|
+
The key under which to store the node type. Node categories are:
|
2419
2444
|
0 : main topology
|
2420
2445
|
1 : shared topology
|
2421
2446
|
2 : shared aperture
|
@@ -2423,7 +2448,17 @@ class Graph:
|
|
2423
2448
|
4 : exterior aperture
|
2424
2449
|
5 : content
|
2425
2450
|
6 : outpost
|
2426
|
-
The default is "
|
2451
|
+
The default is "category".
|
2452
|
+
edgeCategoryKey : str , optional
|
2453
|
+
The key under which to store the node type. Edge categories are:
|
2454
|
+
0 : direct
|
2455
|
+
1 : via shared topology
|
2456
|
+
2 : via shared aperture
|
2457
|
+
3 : to exterior topology
|
2458
|
+
4 : to exterior aperture
|
2459
|
+
5 : to content
|
2460
|
+
6 : to outpost
|
2461
|
+
The default is "category".
|
2427
2462
|
useInternalVertex : bool , optional
|
2428
2463
|
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. The default is False.
|
2429
2464
|
storeBREP : bool , optional
|
@@ -2575,11 +2610,11 @@ class Graph:
|
|
2575
2610
|
e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
|
2576
2611
|
mDict = mergeDictionaries(sharedt)
|
2577
2612
|
if not mDict == None:
|
2578
|
-
keys = (Dictionary.Keys(mDict) or [])+["relationship"]
|
2579
|
-
values = (Dictionary.Values(mDict) or [])+["Direct"]
|
2613
|
+
keys = (Dictionary.Keys(mDict) or [])+["relationship", edgeCategoryKey]
|
2614
|
+
values = (Dictionary.Values(mDict) or [])+["Direct", 0]
|
2580
2615
|
else:
|
2581
|
-
keys = ["relationship"]
|
2582
|
-
values = ["Direct"]
|
2616
|
+
keys = ["relationship", edgeCategoryKey]
|
2617
|
+
values = ["Direct", 0]
|
2583
2618
|
mDict = Dictionary.ByKeysValues(keys, values)
|
2584
2619
|
if mDict:
|
2585
2620
|
e.SetDictionary(mDict)
|
@@ -2663,7 +2698,7 @@ class Graph:
|
|
2663
2698
|
vertices.append(vcc)
|
2664
2699
|
vertices.append(vop)
|
2665
2700
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
2666
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
2701
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
2667
2702
|
_ = tempe.SetDictionary(tempd)
|
2668
2703
|
edges.append(tempe)
|
2669
2704
|
|
@@ -2713,7 +2748,7 @@ class Graph:
|
|
2713
2748
|
_ = vst.SetDictionary(d1)
|
2714
2749
|
vertices.append(vst)
|
2715
2750
|
tempe = Edge.ByStartVertexEndVertex(vCell, vst, tolerance=tolerance)
|
2716
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Topologies"])
|
2751
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Topologies", 1])
|
2717
2752
|
_ = tempe.SetDictionary(tempd)
|
2718
2753
|
edges.append(tempe)
|
2719
2754
|
if toContents:
|
@@ -2737,7 +2772,7 @@ class Graph:
|
|
2737
2772
|
_ = vst2.SetDictionary(d1)
|
2738
2773
|
vertices.append(vst2)
|
2739
2774
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
2740
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
2775
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
2741
2776
|
_ = tempe.SetDictionary(tempd)
|
2742
2777
|
edges.append(tempe)
|
2743
2778
|
if viaSharedApertures:
|
@@ -2757,7 +2792,7 @@ class Graph:
|
|
2757
2792
|
_ = vsa.SetDictionary(d1)
|
2758
2793
|
vertices.append(vsa)
|
2759
2794
|
tempe = Edge.ByStartVertexEndVertex(vCell, vsa, tolerance=tolerance)
|
2760
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Apertures"])
|
2795
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Apertures", 2])
|
2761
2796
|
_ = tempe.SetDictionary(tempd)
|
2762
2797
|
edges.append(tempe)
|
2763
2798
|
if toExteriorTopologies:
|
@@ -2777,7 +2812,7 @@ class Graph:
|
|
2777
2812
|
_ = vet.SetDictionary(d1)
|
2778
2813
|
vertices.append(vet)
|
2779
2814
|
tempe = Edge.ByStartVertexEndVertex(vCell, vet, tolerance=tolerance)
|
2780
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Topologies"])
|
2815
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
2781
2816
|
_ = tempe.SetDictionary(tempd)
|
2782
2817
|
edges.append(tempe)
|
2783
2818
|
if toContents:
|
@@ -2801,7 +2836,7 @@ class Graph:
|
|
2801
2836
|
_ = vst2.SetDictionary(d1)
|
2802
2837
|
vertices.append(vst2)
|
2803
2838
|
tempe = Edge.ByStartVertexEndVertex(vet, vst2, tolerance=tolerance)
|
2804
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
2839
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
2805
2840
|
_ = tempe.SetDictionary(tempd)
|
2806
2841
|
edges.append(tempe)
|
2807
2842
|
if toExteriorApertures:
|
@@ -2821,7 +2856,7 @@ class Graph:
|
|
2821
2856
|
_ = vea.SetDictionary(d1)
|
2822
2857
|
vertices.append(vea)
|
2823
2858
|
tempe = Edge.ByStartVertexEndVertex(vCell, vea, tolerance=tolerance)
|
2824
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
2859
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
2825
2860
|
_ = tempe.SetDictionary(tempd)
|
2826
2861
|
edges.append(tempe)
|
2827
2862
|
if toContents:
|
@@ -2845,7 +2880,7 @@ class Graph:
|
|
2845
2880
|
_ = vcn.SetDictionary(d1)
|
2846
2881
|
vertices.append(vcn)
|
2847
2882
|
tempe = Edge.ByStartVertexEndVertex(vCell, vcn, tolerance=tolerance)
|
2848
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
2883
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
2849
2884
|
_ = tempe.SetDictionary(tempd)
|
2850
2885
|
edges.append(tempe)
|
2851
2886
|
|
@@ -2903,7 +2938,7 @@ class Graph:
|
|
2903
2938
|
else:
|
2904
2939
|
vop = Topology.CenterOfMass(outpost)
|
2905
2940
|
tempe = Edge.ByStartVertexEndVertex(vCell, vop, tolerance=tolerance)
|
2906
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
2941
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
2907
2942
|
_ = tempe.SetDictionary(tempd)
|
2908
2943
|
edges.append(tempe)
|
2909
2944
|
d1 = outpost.GetDictionary()
|
@@ -2941,7 +2976,7 @@ class Graph:
|
|
2941
2976
|
_ = vst.SetDictionary(d1)
|
2942
2977
|
vertices.append(vst)
|
2943
2978
|
tempe = Edge.ByStartVertexEndVertex(vCell, vst, tolerance=tolerance)
|
2944
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Topologies"])
|
2979
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
2945
2980
|
_ = tempe.SetDictionary(tempd)
|
2946
2981
|
edges.append(tempe)
|
2947
2982
|
if toContents:
|
@@ -2965,7 +3000,7 @@ class Graph:
|
|
2965
3000
|
_ = vst2.SetDictionary(d1)
|
2966
3001
|
vertices.append(vst2)
|
2967
3002
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
2968
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3003
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
2969
3004
|
_ = tempe.SetDictionary(tempd)
|
2970
3005
|
edges.append(tempe)
|
2971
3006
|
if toExteriorApertures:
|
@@ -2985,7 +3020,7 @@ class Graph:
|
|
2985
3020
|
_ = vst.SetDictionary(d1)
|
2986
3021
|
vertices.append(vst)
|
2987
3022
|
tempe = Edge.ByStartVertexEndVertex(vCell, vst, tolerance=tolerance)
|
2988
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3023
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
2989
3024
|
_ = tempe.SetDictionary(tempd)
|
2990
3025
|
edges.append(tempe)
|
2991
3026
|
if toContents:
|
@@ -3009,7 +3044,7 @@ class Graph:
|
|
3009
3044
|
_ = vst.SetDictionary(d1)
|
3010
3045
|
vertices.append(vst)
|
3011
3046
|
tempe = Edge.ByStartVertexEndVertex(vCell, vst, tolerance=tolerance)
|
3012
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3047
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3013
3048
|
_ = tempe.SetDictionary(tempd)
|
3014
3049
|
edges.append(tempe)
|
3015
3050
|
return [vertices, edges]
|
@@ -3044,11 +3079,11 @@ class Graph:
|
|
3044
3079
|
e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
|
3045
3080
|
mDict = mergeDictionaries(sharedt)
|
3046
3081
|
if not mDict == None:
|
3047
|
-
keys = (Dictionary.Keys(mDict) or [])+["relationship"]
|
3048
|
-
values = (Dictionary.Values(mDict) or [])+["Direct"]
|
3082
|
+
keys = (Dictionary.Keys(mDict) or [])+["relationship", edgeCategoryKey]
|
3083
|
+
values = (Dictionary.Values(mDict) or [])+["Direct", 0]
|
3049
3084
|
else:
|
3050
|
-
keys = ["relationship"]
|
3051
|
-
values = ["Direct"]
|
3085
|
+
keys = ["relationship", edgeCategoryKey]
|
3086
|
+
values = ["Direct", 0]
|
3052
3087
|
mDict = Dictionary.ByKeysValues(keys, values)
|
3053
3088
|
if mDict:
|
3054
3089
|
e.SetDictionary(mDict)
|
@@ -3133,7 +3168,7 @@ class Graph:
|
|
3133
3168
|
_ = vst.SetDictionary(d1)
|
3134
3169
|
vertices.append(vst)
|
3135
3170
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3136
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Topologies"])
|
3171
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Topologies", 1])
|
3137
3172
|
_ = tempe.SetDictionary(tempd)
|
3138
3173
|
edges.append(tempe)
|
3139
3174
|
if toContents:
|
@@ -3157,7 +3192,7 @@ class Graph:
|
|
3157
3192
|
_ = vst2.SetDictionary(d1)
|
3158
3193
|
vertices.append(vst2)
|
3159
3194
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3160
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3195
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3161
3196
|
_ = tempe.SetDictionary(tempd)
|
3162
3197
|
edges.append(tempe)
|
3163
3198
|
if viaSharedApertures:
|
@@ -3177,7 +3212,7 @@ class Graph:
|
|
3177
3212
|
_ = vst.SetDictionary(d1)
|
3178
3213
|
vertices.append(vst)
|
3179
3214
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3180
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Apertures"])
|
3215
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Apertures", 2])
|
3181
3216
|
_ = tempe.SetDictionary(tempd)
|
3182
3217
|
edges.append(tempe)
|
3183
3218
|
if toExteriorTopologies:
|
@@ -3196,7 +3231,7 @@ class Graph:
|
|
3196
3231
|
_ = vst.SetDictionary(d1)
|
3197
3232
|
vertices.append(vst)
|
3198
3233
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3199
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3234
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
3200
3235
|
_ = tempe.SetDictionary(tempd)
|
3201
3236
|
edges.append(tempe)
|
3202
3237
|
if toContents:
|
@@ -3220,7 +3255,7 @@ class Graph:
|
|
3220
3255
|
_ = vst2.SetDictionary(d1)
|
3221
3256
|
vertices.append(vst2)
|
3222
3257
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3223
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3258
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3224
3259
|
_ = tempe.SetDictionary(tempd)
|
3225
3260
|
edges.append(tempe)
|
3226
3261
|
if toExteriorApertures:
|
@@ -3240,7 +3275,7 @@ class Graph:
|
|
3240
3275
|
_ = vst.SetDictionary(d1)
|
3241
3276
|
vertices.append(vst)
|
3242
3277
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3243
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3278
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
3244
3279
|
_ = tempe.SetDictionary(tempd)
|
3245
3280
|
edges.append(tempe)
|
3246
3281
|
if toContents:
|
@@ -3264,7 +3299,7 @@ class Graph:
|
|
3264
3299
|
_ = vst.SetDictionary(d1)
|
3265
3300
|
vertices.append(vst)
|
3266
3301
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3267
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3302
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3268
3303
|
_ = tempe.SetDictionary(tempd)
|
3269
3304
|
edges.append(tempe)
|
3270
3305
|
|
@@ -3323,7 +3358,7 @@ class Graph:
|
|
3323
3358
|
_ = vop.SetDictionary(d1)
|
3324
3359
|
vertices.append(vcc)
|
3325
3360
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
3326
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
3361
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
3327
3362
|
_ = tempe.SetDictionary(tempd)
|
3328
3363
|
edges.append(tempe)
|
3329
3364
|
return [vertices, edges]
|
@@ -3367,7 +3402,7 @@ class Graph:
|
|
3367
3402
|
else:
|
3368
3403
|
vop = Topology.CenterOfMass(outpost)
|
3369
3404
|
tempe = Edge.ByStartVertexEndVertex(vFace, vop, tolerance=tolerance)
|
3370
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
3405
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
3371
3406
|
_ = tempe.SetDictionary(tempd)
|
3372
3407
|
edges.append(tempe)
|
3373
3408
|
if (toExteriorTopologies == True) or (toExteriorApertures == True) or (toContents == True):
|
@@ -3397,7 +3432,7 @@ class Graph:
|
|
3397
3432
|
_ = vst.SetDictionary(d1)
|
3398
3433
|
vertices.append(vst)
|
3399
3434
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3400
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Topologies"])
|
3435
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
3401
3436
|
_ = tempe.SetDictionary(tempd)
|
3402
3437
|
edges.append(tempe)
|
3403
3438
|
if toContents:
|
@@ -3421,7 +3456,7 @@ class Graph:
|
|
3421
3456
|
_ = vst2.SetDictionary(d1)
|
3422
3457
|
vertices.append(vst2)
|
3423
3458
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3424
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3459
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3425
3460
|
_ = tempe.SetDictionary(tempd)
|
3426
3461
|
edges.append(tempe)
|
3427
3462
|
if toExteriorApertures:
|
@@ -3441,7 +3476,7 @@ class Graph:
|
|
3441
3476
|
_ = vst.SetDictionary(d1)
|
3442
3477
|
vertices.append(vst)
|
3443
3478
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3444
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3479
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
3445
3480
|
_ = tempe.SetDictionary(tempd)
|
3446
3481
|
edges.append(tempe)
|
3447
3482
|
if toContents:
|
@@ -3465,7 +3500,7 @@ class Graph:
|
|
3465
3500
|
_ = vst.SetDictionary(d1)
|
3466
3501
|
vertices.append(vst)
|
3467
3502
|
tempe = Edge.ByStartVertexEndVertex(vFace, vst, tolerance=tolerance)
|
3468
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3503
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3469
3504
|
_ = tempe.SetDictionary(tempd)
|
3470
3505
|
edges.append(tempe)
|
3471
3506
|
return [vertices, edges]
|
@@ -3502,11 +3537,11 @@ class Graph:
|
|
3502
3537
|
e = Edge.ByStartVertexEndVertex(v1, v2, tolerance=tolerance)
|
3503
3538
|
mDict = mergeDictionaries(sharedt)
|
3504
3539
|
if not mDict == None:
|
3505
|
-
keys = (Dictionary.Keys(mDict) or [])+["relationship"]
|
3506
|
-
values = (Dictionary.Values(mDict) or [])+["Direct"]
|
3540
|
+
keys = (Dictionary.Keys(mDict) or [])+["relationship", edgeCategoryKey]
|
3541
|
+
values = (Dictionary.Values(mDict) or [])+["Direct", 0]
|
3507
3542
|
else:
|
3508
|
-
keys = ["relationship"]
|
3509
|
-
values = ["Direct"]
|
3543
|
+
keys = ["relationship", edgeCategoryKey]
|
3544
|
+
values = ["Direct", 0]
|
3510
3545
|
mDict = Dictionary.ByKeysValues(keys, values)
|
3511
3546
|
if mDict:
|
3512
3547
|
e.SetDictionary(mDict)
|
@@ -3600,7 +3635,7 @@ class Graph:
|
|
3600
3635
|
_ = vst.SetDictionary(d1)
|
3601
3636
|
vertices.append(vst)
|
3602
3637
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3603
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Topologies"])
|
3638
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Topologies", 1])
|
3604
3639
|
_ = tempe.SetDictionary(tempd)
|
3605
3640
|
edges.append(tempe)
|
3606
3641
|
if toContents:
|
@@ -3624,7 +3659,7 @@ class Graph:
|
|
3624
3659
|
_ = vst2.SetDictionary(d1)
|
3625
3660
|
vertices.append(vst2)
|
3626
3661
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3627
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3662
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3628
3663
|
_ = tempe.SetDictionary(tempd)
|
3629
3664
|
edges.append(tempe)
|
3630
3665
|
if viaSharedApertures:
|
@@ -3644,7 +3679,7 @@ class Graph:
|
|
3644
3679
|
_ = vst.SetDictionary(d1)
|
3645
3680
|
vertices.append(vst)
|
3646
3681
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3647
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["Via_Shared_Apertures"])
|
3682
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["Via_Shared_Apertures", 2])
|
3648
3683
|
_ = tempe.SetDictionary(tempd)
|
3649
3684
|
edges.append(tempe)
|
3650
3685
|
if toExteriorTopologies:
|
@@ -3652,7 +3687,7 @@ class Graph:
|
|
3652
3687
|
vst = exteriorTopology
|
3653
3688
|
vertices.append(exteriorTopology)
|
3654
3689
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3655
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Topologies"])
|
3690
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
3656
3691
|
_ = tempe.SetDictionary(tempd)
|
3657
3692
|
edges.append(tempe)
|
3658
3693
|
if toContents:
|
@@ -3676,7 +3711,7 @@ class Graph:
|
|
3676
3711
|
_ = vst2.SetDictionary(d1)
|
3677
3712
|
vertices.append(vst2)
|
3678
3713
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3679
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3714
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3680
3715
|
_ = tempe.SetDictionary(tempd)
|
3681
3716
|
edges.append(tempe)
|
3682
3717
|
if toExteriorApertures:
|
@@ -3696,7 +3731,7 @@ class Graph:
|
|
3696
3731
|
_ = vst.SetDictionary(d1)
|
3697
3732
|
vertices.append(vst)
|
3698
3733
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3699
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3734
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
3700
3735
|
_ = tempe.SetDictionary(tempd)
|
3701
3736
|
edges.append(tempe)
|
3702
3737
|
if toContents:
|
@@ -3720,7 +3755,7 @@ class Graph:
|
|
3720
3755
|
_ = vst.SetDictionary(d1)
|
3721
3756
|
vertices.append(vst)
|
3722
3757
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3723
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3758
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3724
3759
|
_ = tempe.SetDictionary(tempd)
|
3725
3760
|
edges.append(tempe)
|
3726
3761
|
for anEdge in topEdges:
|
@@ -3779,7 +3814,7 @@ class Graph:
|
|
3779
3814
|
_ = vop.SetDictionary(d1)
|
3780
3815
|
vertices.append(vop)
|
3781
3816
|
tempe = Edge.ByStartVertexEndVertex(vcc, vop, tolerance=tolerance)
|
3782
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
3817
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
3783
3818
|
_ = tempe.SetDictionary(tempd)
|
3784
3819
|
edges.append(tempe)
|
3785
3820
|
|
@@ -3830,7 +3865,7 @@ class Graph:
|
|
3830
3865
|
else:
|
3831
3866
|
vop = Topology.CenterOfMass(outpost)
|
3832
3867
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vop, tolerance=tolerance)
|
3833
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
3868
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
3834
3869
|
_ = tempe.SetDictionary(tempd)
|
3835
3870
|
edges.append(tempe)
|
3836
3871
|
|
@@ -3860,7 +3895,7 @@ class Graph:
|
|
3860
3895
|
_ = vst.SetDictionary(d1)
|
3861
3896
|
vertices.append(vst)
|
3862
3897
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3863
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Topologies"])
|
3898
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Topologies", 3])
|
3864
3899
|
_ = tempe.SetDictionary(tempd)
|
3865
3900
|
edges.append(tempe)
|
3866
3901
|
if toContents:
|
@@ -3884,7 +3919,7 @@ class Graph:
|
|
3884
3919
|
_ = vst2.SetDictionary(d1)
|
3885
3920
|
vertices.append(vst2)
|
3886
3921
|
tempe = Edge.ByStartVertexEndVertex(vst, vst2, tolerance=tolerance)
|
3887
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3922
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3888
3923
|
_ = tempe.SetDictionary(tempd)
|
3889
3924
|
edges.append(tempe)
|
3890
3925
|
if toExteriorApertures:
|
@@ -3905,7 +3940,7 @@ class Graph:
|
|
3905
3940
|
_ = vst.SetDictionary(exTop.GetDictionary())
|
3906
3941
|
vertices.append(vst)
|
3907
3942
|
tempe = Edge.ByStartVertexEndVertex(vEdge, vst, tolerance=tolerance)
|
3908
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Exterior_Apertures"])
|
3943
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Exterior_Apertures", 4])
|
3909
3944
|
_ = tempe.SetDictionary(tempd)
|
3910
3945
|
edges.append(tempe)
|
3911
3946
|
|
@@ -3937,7 +3972,7 @@ class Graph:
|
|
3937
3972
|
_ = vst.SetDictionary(d1)
|
3938
3973
|
vertices.append(vst)
|
3939
3974
|
tempe = Edge.ByStartVertexEndVertex(topology, vst, tolerance=tolerance)
|
3940
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Contents"])
|
3975
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Contents", 5])
|
3941
3976
|
_ = tempe.SetDictionary(tempd)
|
3942
3977
|
edges.append(tempe)
|
3943
3978
|
|
@@ -3962,7 +3997,7 @@ class Graph:
|
|
3962
3997
|
else:
|
3963
3998
|
vop = Topology.CenterOfMass(outpost)
|
3964
3999
|
tempe = Edge.ByStartVertexEndVertex(topology, vop, tolerance=tolerance)
|
3965
|
-
tempd = Dictionary.ByKeysValues(["relationship"],["To_Outposts"])
|
4000
|
+
tempd = Dictionary.ByKeysValues(["relationship", edgeCategoryKey],["To_Outposts", 6])
|
3966
4001
|
_ = tempe.SetDictionary(tempd)
|
3967
4002
|
edges.append(tempe)
|
3968
4003
|
|
@@ -5988,7 +6023,6 @@ class Graph:
|
|
5988
6023
|
flat_list = Helper.Flatten(edge_list)
|
5989
6024
|
flat_list = [x for x in flat_list if not x == None]
|
5990
6025
|
num_nodes = max(flat_list) + 1
|
5991
|
-
print("Number of Nodes:", num_nodes)
|
5992
6026
|
|
5993
6027
|
# Create an adjacency matrix.
|
5994
6028
|
adjacency_matrix = np.zeros((num_nodes, num_nodes))
|
@@ -8049,7 +8083,11 @@ class Graph:
|
|
8049
8083
|
return shortestPaths
|
8050
8084
|
|
8051
8085
|
@staticmethod
|
8052
|
-
def Show(graph,
|
8086
|
+
def Show(graph,
|
8087
|
+
sagitta = 0,
|
8088
|
+
absolute = False,
|
8089
|
+
sides = 8,
|
8090
|
+
vertexColor="black",
|
8053
8091
|
vertexSize=6,
|
8054
8092
|
vertexLabelKey=None,
|
8055
8093
|
vertexGroupKey=None,
|
@@ -8089,6 +8127,13 @@ class Graph:
|
|
8089
8127
|
----------
|
8090
8128
|
graph : topologic_core.Graph
|
8091
8129
|
The input graph.
|
8130
|
+
sagitta : float , optional
|
8131
|
+
The length of the sagitta. In mathematics, the sagitta is the line connecting the center of a chord to the apex (or highest point) of the arc subtended by that chord. The default is 0 which means a straight edge is drawn instead of an arc. The default is 0.
|
8132
|
+
absolute : bool , optional
|
8133
|
+
If set to True, the sagitta length is treated as an absolute value. Otherwise, it is treated as a ratio based on the length of the edge. The default is False.
|
8134
|
+
For example, if the length of the edge is 10, the sagitta is set to 0.5, and absolute is set to False, the sagitta length will be 5. The default is True.
|
8135
|
+
sides : int , optional
|
8136
|
+
The number of sides of the arc. The default is 8.
|
8092
8137
|
vertexColor : str , optional
|
8093
8138
|
The desired color of the output vertices. This can be any plotly color string and may be specified as:
|
8094
8139
|
- A hex string (e.g. '#ff0000')
|
@@ -8189,7 +8234,7 @@ class Graph:
|
|
8189
8234
|
print("Graph.Show - Error: The input graph is not a valid graph. Returning None.")
|
8190
8235
|
return None
|
8191
8236
|
|
8192
|
-
data= Plotly.DataByGraph(graph, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale)
|
8237
|
+
data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale)
|
8193
8238
|
fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
|
8194
8239
|
marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
|
8195
8240
|
Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
|