topologicpy 0.8.45__py3-none-any.whl → 0.8.47__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/ANN.py +19 -19
- topologicpy/BVH.py +5 -5
- topologicpy/CSG.py +17 -17
- topologicpy/Cell.py +295 -295
- topologicpy/CellComplex.py +67 -67
- topologicpy/Cluster.py +35 -35
- topologicpy/Color.py +8 -8
- topologicpy/DGL.py +52 -52
- topologicpy/Dictionary.py +22 -22
- topologicpy/Edge.py +77 -77
- topologicpy/EnergyModel.py +25 -25
- topologicpy/Face.py +270 -270
- topologicpy/Graph.py +1212 -697
- topologicpy/Grid.py +24 -24
- topologicpy/Helper.py +8 -8
- topologicpy/Honeybee.py +13 -13
- topologicpy/Matrix.py +11 -11
- topologicpy/Neo4j.py +21 -21
- topologicpy/Plotly.py +213 -213
- topologicpy/PyG.py +41 -41
- topologicpy/ShapeGrammar.py +7 -7
- topologicpy/Shell.py +104 -104
- topologicpy/Sun.py +46 -46
- topologicpy/Topology.py +392 -392
- topologicpy/Vector.py +25 -25
- topologicpy/Vertex.py +64 -64
- topologicpy/Wire.py +250 -250
- topologicpy/version.py +1 -1
- {topologicpy-0.8.45.dist-info → topologicpy-0.8.47.dist-info}/METADATA +1 -1
- topologicpy-0.8.47.dist-info/RECORD +38 -0
- topologicpy-0.8.45.dist-info/RECORD +0 -38
- {topologicpy-0.8.45.dist-info → topologicpy-0.8.47.dist-info}/WHEEL +0 -0
- {topologicpy-0.8.45.dist-info → topologicpy-0.8.47.dist-info}/licenses/LICENSE +0 -0
- {topologicpy-0.8.45.dist-info → topologicpy-0.8.47.dist-info}/top_level.txt +0 -0
topologicpy/Graph.py
CHANGED
@@ -381,9 +381,9 @@ class Graph:
|
|
381
381
|
transferEdgeDictionaries : bool, optional
|
382
382
|
If set to True, the dictionaries of the edges are transferred to the graph.
|
383
383
|
tolerance : float , optional
|
384
|
-
The desired tolerance.
|
384
|
+
The desired tolerance. Default is 0.0001.
|
385
385
|
silent : bool , optional
|
386
|
-
If set to True, error and warning messages are suppressed.
|
386
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
387
387
|
|
388
388
|
Returns
|
389
389
|
-------
|
@@ -460,9 +460,9 @@ class Graph:
|
|
460
460
|
vertex : topologic_core.Vertex
|
461
461
|
The input vertex.
|
462
462
|
tolerance : float , optional
|
463
|
-
The desired tolerance.
|
463
|
+
The desired tolerance. Default is 0.0001.
|
464
464
|
silent : bool , optional
|
465
|
-
If set to True, error and warning messages are suppressed.
|
465
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
466
466
|
|
467
467
|
Returns
|
468
468
|
-------
|
@@ -495,9 +495,9 @@ class Graph:
|
|
495
495
|
vertices : list
|
496
496
|
The input list of vertices.
|
497
497
|
tolerance : float , optional
|
498
|
-
The desired tolerance.
|
498
|
+
The desired tolerance. Default is 0.0001.
|
499
499
|
silent : bool , optional
|
500
|
-
If set to True, error and warning messages are suppressed.
|
500
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
501
501
|
|
502
502
|
Returns
|
503
503
|
-------
|
@@ -533,13 +533,13 @@ class Graph:
|
|
533
533
|
The input graph.
|
534
534
|
vertexLabelKey : str , optional
|
535
535
|
The returned vertices are labelled according to the dictionary values stored under this key.
|
536
|
-
If the vertexLabelKey does not exist, it will be created and the vertices are labelled numerically and stored in the vertex dictionary under this key.
|
536
|
+
If the vertexLabelKey does not exist, it will be created and the vertices are labelled numerically and stored in the vertex dictionary under this key. Default is None.
|
537
537
|
edgeKey : str , optional
|
538
|
-
If set, the edges' dictionaries will be searched for this key to set their weight. If the key is set to "length" (case insensitive), the length of the edge will be used as its weight. If set to None, a weight of 1 will be used.
|
538
|
+
If set, the edges' dictionaries will be searched for this key to set their weight. If the key is set to "length" (case insensitive), the length of the edge will be used as its weight. If set to None, a weight of 1 will be used. Default is "Length".
|
539
539
|
includeWeights : bool , optional
|
540
|
-
If set to True, edge weights are included. Otherwise, they are not.
|
540
|
+
If set to True, edge weights are included. Otherwise, they are not. Default is False.
|
541
541
|
mantissa : int , optional
|
542
|
-
The
|
542
|
+
The number of decimal places to round the result to. Default is 6.
|
543
543
|
|
544
544
|
Returns
|
545
545
|
-------
|
@@ -627,25 +627,25 @@ class Graph:
|
|
627
627
|
graph : topologic_core.Graph
|
628
628
|
The input graph.
|
629
629
|
vertexKey : str , optional
|
630
|
-
If set, the returned list of vertices is sorted according to the dictionary values stored under this key.
|
630
|
+
If set, the returned list of vertices is sorted according to the dictionary values stored under this key. Default is None.
|
631
631
|
reverse : bool , optional
|
632
|
-
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not.
|
632
|
+
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. Default is False.
|
633
633
|
edgeKeyFwd : str , optional
|
634
|
-
If set, the value at this key in the connecting edge from start vertex to end vertex (forward) will be used instead of the value 1.
|
634
|
+
If set, the value at this key in the connecting edge from start vertex to end vertex (forward) will be used instead of the value 1. Default is None. useEdgeIndex and useEdgeLength override this setting.
|
635
635
|
edgeKeyBwd : str , optional
|
636
|
-
If set, the value at this key in the connecting edge from end vertex to start vertex (backward) will be used instead of the value 1.
|
636
|
+
If set, the value at this key in the connecting edge from end vertex to start vertex (backward) will be used instead of the value 1. Default is None. useEdgeIndex and useEdgeLength override this setting.
|
637
637
|
bidirKey : bool , optional
|
638
|
-
If set to True or False, this key in the connecting edge will be used to determine is the edge is supposed to be bidirectional or not. If set to None, the input variable bidrectional will be used instead.
|
638
|
+
If set to True or False, this key in the connecting edge will be used to determine is the edge is supposed to be bidirectional or not. If set to None, the input variable bidrectional will be used instead. Default is None
|
639
639
|
bidirectional : bool , optional
|
640
|
-
If set to True, the edges in the graph that do not have a bidireKey in their dictionaries will be treated as being bidirectional. Otherwise, the start vertex and end vertex of the connecting edge will determine the direction.
|
640
|
+
If set to True, the edges in the graph that do not have a bidireKey in their dictionaries will be treated as being bidirectional. Otherwise, the start vertex and end vertex of the connecting edge will determine the direction. Default is True.
|
641
641
|
useEdgeIndex : bool , optional
|
642
|
-
If set to True, the adjacency matrix values will the index of the edge in Graph.Edges(graph).
|
642
|
+
If set to True, the adjacency matrix values will the index of the edge in Graph.Edges(graph). Default is False. Both useEdgeIndex, useEdgeLength should not be True at the same time. If they are, useEdgeLength will be used.
|
643
643
|
useEdgeLength : bool , optional
|
644
|
-
If set to True, the adjacency matrix values will the length of the edge in Graph.Edges(graph).
|
644
|
+
If set to True, the adjacency matrix values will the length of the edge in Graph.Edges(graph). Default is False. Both useEdgeIndex, useEdgeLength should not be True at the same time. If they are, useEdgeLength will be used.
|
645
645
|
mantissa : int , optional
|
646
|
-
The
|
646
|
+
The number of decimal places to round the result to. Default is 6.
|
647
647
|
tolerance : float , optional
|
648
|
-
The desired tolerance.
|
648
|
+
The desired tolerance. Default is 0.0001.
|
649
649
|
|
650
650
|
Returns
|
651
651
|
-------
|
@@ -734,25 +734,25 @@ class Graph:
|
|
734
734
|
graph : topologic_core.Graph
|
735
735
|
The input graph.
|
736
736
|
vertexKey : str , optional
|
737
|
-
If set, the returned list of vertices is sorted according to the dictionary values stored under this key.
|
737
|
+
If set, the returned list of vertices is sorted according to the dictionary values stored under this key. Default is None.
|
738
738
|
reverse : bool , optional
|
739
|
-
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not.
|
739
|
+
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. Default is False.
|
740
740
|
edgeKeyFwd : str , optional
|
741
|
-
If set, the value at this key in the connecting edge from start vertex to end vertex (forward) will be used instead of the value 1.
|
741
|
+
If set, the value at this key in the connecting edge from start vertex to end vertex (forward) will be used instead of the value 1. Default is None. useEdgeIndex and useEdgeLength override this setting.
|
742
742
|
edgeKeyBwd : str , optional
|
743
|
-
If set, the value at this key in the connecting edge from end vertex to start vertex (backward) will be used instead of the value 1.
|
743
|
+
If set, the value at this key in the connecting edge from end vertex to start vertex (backward) will be used instead of the value 1. Default is None. useEdgeIndex and useEdgeLength override this setting.
|
744
744
|
bidirKey : bool , optional
|
745
|
-
If set to True or False, this key in the connecting edge will be used to determine is the edge is supposed to be bidirectional or not. If set to None, the input variable bidrectional will be used instead.
|
745
|
+
If set to True or False, this key in the connecting edge will be used to determine is the edge is supposed to be bidirectional or not. If set to None, the input variable bidrectional will be used instead. Default is None
|
746
746
|
bidirectional : bool , optional
|
747
|
-
If set to True, the edges in the graph that do not have a bidireKey in their dictionaries will be treated as being bidirectional. Otherwise, the start vertex and end vertex of the connecting edge will determine the direction.
|
747
|
+
If set to True, the edges in the graph that do not have a bidireKey in their dictionaries will be treated as being bidirectional. Otherwise, the start vertex and end vertex of the connecting edge will determine the direction. Default is True.
|
748
748
|
useEdgeIndex : bool , optional
|
749
|
-
If set to True, the adjacency matrix values will the index of the edge in Graph.Edges(graph).
|
749
|
+
If set to True, the adjacency matrix values will the index of the edge in Graph.Edges(graph). Default is False. Both useEdgeIndex, useEdgeLength should not be True at the same time. If they are, useEdgeLength will be used.
|
750
750
|
useEdgeLength : bool , optional
|
751
|
-
If set to True, the adjacency matrix values will the length of the edge in Graph.Edges(graph).
|
751
|
+
If set to True, the adjacency matrix values will the length of the edge in Graph.Edges(graph). Default is False. Both useEdgeIndex, useEdgeLength should not be True at the same time. If they are, useEdgeLength will be used.
|
752
752
|
mantissa : int , optional
|
753
|
-
The
|
753
|
+
The number of decimal places to round the result to. Default is 6.
|
754
754
|
tolerance : float , optional
|
755
|
-
The desired tolerance.
|
755
|
+
The desired tolerance. Default is 0.0001.
|
756
756
|
|
757
757
|
Returns
|
758
758
|
-------
|
@@ -795,11 +795,11 @@ class Graph:
|
|
795
795
|
graph : topologic_core.Graph
|
796
796
|
The input graph.
|
797
797
|
vertexKey : str , optional
|
798
|
-
If set, the returned list of vertices is sorted according to the dictionary values stored under this key.
|
798
|
+
If set, the returned list of vertices is sorted according to the dictionary values stored under this key. Default is None.
|
799
799
|
reverse : bool , optional
|
800
|
-
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not.
|
800
|
+
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. Default is False.
|
801
801
|
tolerance : float , optional
|
802
|
-
The desired tolerance.
|
802
|
+
The desired tolerance. Default is 0.0001.
|
803
803
|
|
804
804
|
Returns
|
805
805
|
-------
|
@@ -850,7 +850,7 @@ class Graph:
|
|
850
850
|
vertex : topologic_core.Vertex
|
851
851
|
the input vertex.
|
852
852
|
silent : bool , optional
|
853
|
-
If set to True, error and warning messages are suppressed.
|
853
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
854
854
|
|
855
855
|
Returns
|
856
856
|
-------
|
@@ -884,11 +884,11 @@ class Graph:
|
|
884
884
|
vertex : topologic_core.Vertex
|
885
885
|
the input vertex.
|
886
886
|
compassDirection : str , optional
|
887
|
-
The compass direction. See Vector.CompassDirections().
|
887
|
+
The compass direction. See Vector.CompassDirections(). Default is "Up".
|
888
888
|
tolerance : float , optional
|
889
|
-
The desired tolerance.
|
889
|
+
The desired tolerance. Default is 0.0001.
|
890
890
|
silent : bool , optional
|
891
|
-
If set to True, error and warning messages are suppressed.
|
891
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
892
892
|
|
893
893
|
Returns
|
894
894
|
-------
|
@@ -942,11 +942,11 @@ class Graph:
|
|
942
942
|
vertex : topologic_core.Vertex
|
943
943
|
the input vertex.
|
944
944
|
vector : list , optional
|
945
|
-
The vector direction.
|
945
|
+
The vector direction. Default is [0,0,1].
|
946
946
|
tolerance : float , optional
|
947
|
-
The desired tolerance.
|
947
|
+
The desired tolerance. Default is 0.0001.
|
948
948
|
silent : bool , optional
|
949
|
-
If set to True, error and warning messages are suppressed.
|
949
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
950
950
|
|
951
951
|
Returns
|
952
952
|
-------
|
@@ -998,9 +998,9 @@ class Graph:
|
|
998
998
|
vertexB : topologic_core.Vertex
|
999
999
|
The second input vertex.
|
1000
1000
|
timeLimit : int , optional
|
1001
|
-
The time limit in second.
|
1001
|
+
The time limit in second. Default is 10 seconds.
|
1002
1002
|
silent : bool , optional
|
1003
|
-
If set to True, error and warning messages are suppressed.
|
1003
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
1004
1004
|
|
1005
1005
|
Returns
|
1006
1006
|
-------
|
@@ -1036,7 +1036,7 @@ class Graph:
|
|
1036
1036
|
graph : topologic_core.Graph
|
1037
1037
|
The input graph.
|
1038
1038
|
mantissa : int , optional
|
1039
|
-
The
|
1039
|
+
The number of decimal places to round the result to. Default is 6.
|
1040
1040
|
|
1041
1041
|
Returns
|
1042
1042
|
-------
|
@@ -1101,30 +1101,30 @@ class Graph:
|
|
1101
1101
|
graph : topologic_core.Graph
|
1102
1102
|
The input graph.
|
1103
1103
|
bidirectional : bool , optional
|
1104
|
-
If set to True, reverse relationships are created wherever possible. Otherwise, they are not.
|
1104
|
+
If set to True, reverse relationships are created wherever possible. Otherwise, they are not. Default is False.
|
1105
1105
|
includeAttributes : bool , optional
|
1106
|
-
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not.
|
1106
|
+
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
1107
1107
|
includeLabel : bool , optional
|
1108
|
-
If set to True, a label is attached to each node. Otherwise, it is not.
|
1108
|
+
If set to True, a label is attached to each node. Otherwise, it is not. Default is False.
|
1109
1109
|
includeGeometry : bool , optional
|
1110
|
-
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not.
|
1110
|
+
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
1111
1111
|
siteLabel : str , optional
|
1112
|
-
The desired site label.
|
1112
|
+
The desired site label. Default is "Site_0001".
|
1113
1113
|
siteDictionary : dict , optional
|
1114
|
-
The dictionary of site attributes to include in the output.
|
1114
|
+
The dictionary of site attributes to include in the output. Default is None.
|
1115
1115
|
buildingLabel : str , optional
|
1116
|
-
The desired building label.
|
1116
|
+
The desired building label. Default is "Building_0001".
|
1117
1117
|
buildingDictionary : dict , optional
|
1118
|
-
The dictionary of building attributes to include in the output.
|
1118
|
+
The dictionary of building attributes to include in the output. Default is None.
|
1119
1119
|
storeyPrefix : str , optional
|
1120
|
-
The desired prefixed to use for each building storey.
|
1120
|
+
The desired prefixed to use for each building storey. Default is "Storey".
|
1121
1121
|
floorLevels : list , optional
|
1122
1122
|
The list of floor levels. This should be a numeric list, sorted from lowest to highest.
|
1123
1123
|
If not provided, floorLevels will be computed automatically based on the vertices' (zKey)) attribute. See below.
|
1124
1124
|
verticesKey : str , optional
|
1125
|
-
The desired key name to call vertices.
|
1125
|
+
The desired key name to call vertices. Default is "vertices".
|
1126
1126
|
edgesKey : str , optional
|
1127
|
-
The desired key name to call edges.
|
1127
|
+
The desired key name to call edges. Default is "edges".
|
1128
1128
|
vertexLabelKey : str , optional
|
1129
1129
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
1130
1130
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -1132,37 +1132,37 @@ class Graph:
|
|
1132
1132
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
1133
1133
|
Note: If edge labels are not unique, they will be forced to be unique.
|
1134
1134
|
sourceKey : str , optional
|
1135
|
-
The dictionary key used to store the source vertex.
|
1135
|
+
The dictionary key used to store the source vertex. Default is "source".
|
1136
1136
|
targetKey : str , optional
|
1137
|
-
The dictionary key used to store the target vertex.
|
1137
|
+
The dictionary key used to store the target vertex. Default is "target".
|
1138
1138
|
xKey : str , optional
|
1139
|
-
The desired key name to use for x-coordinates.
|
1139
|
+
The desired key name to use for x-coordinates. Default is "hasX".
|
1140
1140
|
yKey : str , optional
|
1141
|
-
The desired key name to use for y-coordinates.
|
1141
|
+
The desired key name to use for y-coordinates. Default is "hasY".
|
1142
1142
|
zKey : str , optional
|
1143
|
-
The desired key name to use for z-coordinates.
|
1143
|
+
The desired key name to use for z-coordinates. Default is "hasZ".
|
1144
1144
|
geometryKey : str , optional
|
1145
|
-
The desired key name to use for geometry.
|
1145
|
+
The desired key name to use for geometry. Default is "brep".
|
1146
1146
|
typeKey : str , optional
|
1147
|
-
The dictionary key to use to look up the type of the node.
|
1147
|
+
The dictionary key to use to look up the type of the node. Default is "type".
|
1148
1148
|
geometryKey : str , optional
|
1149
|
-
The dictionary key to use to look up the geometry of the node.
|
1149
|
+
The dictionary key to use to look up the geometry of the node. Default is "brep".
|
1150
1150
|
spaceType : str , optional
|
1151
|
-
The dictionary string value to use to look up vertices of type "space".
|
1151
|
+
The dictionary string value to use to look up vertices of type "space". Default is "space".
|
1152
1152
|
wallType : str , optional
|
1153
|
-
The dictionary string value to use to look up vertices of type "wall".
|
1153
|
+
The dictionary string value to use to look up vertices of type "wall". Default is "wall".
|
1154
1154
|
slabType : str , optional
|
1155
|
-
The dictionary string value to use to look up vertices of type "slab".
|
1155
|
+
The dictionary string value to use to look up vertices of type "slab". Default is "slab".
|
1156
1156
|
doorType : str , optional
|
1157
|
-
The dictionary string value to use to look up vertices of type "door".
|
1157
|
+
The dictionary string value to use to look up vertices of type "door". Default is "door".
|
1158
1158
|
windowType : str , optional
|
1159
|
-
The dictionary string value to use to look up vertices of type "window".
|
1159
|
+
The dictionary string value to use to look up vertices of type "window". Default is "window".
|
1160
1160
|
contentType : str , optional
|
1161
|
-
The dictionary string value to use to look up vertices of type "content".
|
1161
|
+
The dictionary string value to use to look up vertices of type "content". Default is "contents".
|
1162
1162
|
namespace : str , optional
|
1163
|
-
The desired namespace to use in the BOT graph.
|
1163
|
+
The desired namespace to use in the BOT graph. Default is "http://github.com/wassimj/topologicpy/resources".
|
1164
1164
|
mantissa : int , optional
|
1165
|
-
The
|
1165
|
+
The number of decimal places to round the result to. Default is 6.
|
1166
1166
|
|
1167
1167
|
|
1168
1168
|
Returns
|
@@ -1415,30 +1415,30 @@ class Graph:
|
|
1415
1415
|
trix : Trix , RDF/XML-like format for RDF quads
|
1416
1416
|
nquads : N-Quads , N-Triples-like format for RDF quads
|
1417
1417
|
bidirectional : bool , optional
|
1418
|
-
If set to True, reverse relationships are created wherever possible. Otherwise, they are not.
|
1418
|
+
If set to True, reverse relationships are created wherever possible. Otherwise, they are not. Default is False.
|
1419
1419
|
includeAttributes : bool , optional
|
1420
|
-
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not.
|
1420
|
+
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
1421
1421
|
includeLabel : bool , optional
|
1422
|
-
If set to True, a label is attached to each node. Otherwise, it is not.
|
1422
|
+
If set to True, a label is attached to each node. Otherwise, it is not. Default is False.
|
1423
1423
|
includeGeometry : bool , optional
|
1424
|
-
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not.
|
1424
|
+
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
1425
1425
|
siteLabel : str , optional
|
1426
|
-
The desired site label.
|
1426
|
+
The desired site label. Default is "Site_0001".
|
1427
1427
|
siteDictionary : dict , optional
|
1428
|
-
The dictionary of site attributes to include in the output.
|
1428
|
+
The dictionary of site attributes to include in the output. Default is None.
|
1429
1429
|
buildingLabel : str , optional
|
1430
|
-
The desired building label.
|
1430
|
+
The desired building label. Default is "Building_0001".
|
1431
1431
|
buildingDictionary : dict , optional
|
1432
|
-
The dictionary of building attributes to include in the output.
|
1432
|
+
The dictionary of building attributes to include in the output. Default is None.
|
1433
1433
|
storeyPrefix : str , optional
|
1434
|
-
The desired prefixed to use for each building storey.
|
1434
|
+
The desired prefixed to use for each building storey. Default is "Storey".
|
1435
1435
|
floorLevels : list , optional
|
1436
1436
|
The list of floor levels. This should be a numeric list, sorted from lowest to highest.
|
1437
1437
|
If not provided, floorLevels will be computed automatically based on the vertices' (zKey)) attribute. See below.
|
1438
1438
|
verticesKey : str , optional
|
1439
|
-
The desired key name to call vertices.
|
1439
|
+
The desired key name to call vertices. Default is "vertices".
|
1440
1440
|
edgesKey : str , optional
|
1441
|
-
The desired key name to call edges.
|
1441
|
+
The desired key name to call edges. Default is "edges".
|
1442
1442
|
vertexLabelKey : str , optional
|
1443
1443
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
1444
1444
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -1446,35 +1446,35 @@ class Graph:
|
|
1446
1446
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
1447
1447
|
Note: If edge labels are not unique, they will be forced to be unique.
|
1448
1448
|
sourceKey : str , optional
|
1449
|
-
The dictionary key used to store the source vertex.
|
1449
|
+
The dictionary key used to store the source vertex. Default is "source".
|
1450
1450
|
targetKey : str , optional
|
1451
|
-
The dictionary key used to store the target vertex.
|
1451
|
+
The dictionary key used to store the target vertex. Default is "target".
|
1452
1452
|
xKey : str , optional
|
1453
|
-
The desired key name to use for x-coordinates.
|
1453
|
+
The desired key name to use for x-coordinates. Default is "hasX".
|
1454
1454
|
yKey : str , optional
|
1455
|
-
The desired key name to use for y-coordinates.
|
1455
|
+
The desired key name to use for y-coordinates. Default is "hasY".
|
1456
1456
|
zKey : str , optional
|
1457
|
-
The desired key name to use for z-coordinates.
|
1457
|
+
The desired key name to use for z-coordinates. Default is "hasZ".
|
1458
1458
|
geometryKey : str , optional
|
1459
|
-
The desired key name to use for geometry.
|
1459
|
+
The desired key name to use for geometry. Default is "brep".
|
1460
1460
|
typeKey : str , optional
|
1461
|
-
The dictionary key to use to look up the type of the node.
|
1461
|
+
The dictionary key to use to look up the type of the node. Default is "type".
|
1462
1462
|
spaceType : str , optional
|
1463
|
-
The dictionary string value to use to look up vertices of type "space".
|
1463
|
+
The dictionary string value to use to look up vertices of type "space". Default is "space".
|
1464
1464
|
wallType : str , optional
|
1465
|
-
The dictionary string value to use to look up vertices of type "wall".
|
1465
|
+
The dictionary string value to use to look up vertices of type "wall". Default is "wall".
|
1466
1466
|
slabType : str , optional
|
1467
|
-
The dictionary string value to use to look up vertices of type "slab".
|
1467
|
+
The dictionary string value to use to look up vertices of type "slab". Default is "slab".
|
1468
1468
|
doorType : str , optional
|
1469
|
-
The dictionary string value to use to look up vertices of type "door".
|
1469
|
+
The dictionary string value to use to look up vertices of type "door". Default is "door".
|
1470
1470
|
windowType : str , optional
|
1471
|
-
The dictionary string value to use to look up vertices of type "window".
|
1471
|
+
The dictionary string value to use to look up vertices of type "window". Default is "window".
|
1472
1472
|
contentType : str , optional
|
1473
|
-
The dictionary string value to use to look up vertices of type "content".
|
1473
|
+
The dictionary string value to use to look up vertices of type "content". Default is "contents".
|
1474
1474
|
namespace : str , optional
|
1475
|
-
The desired namespace to use in the BOT graph.
|
1475
|
+
The desired namespace to use in the BOT graph. Default is "http://github.com/wassimj/topologicpy/resources".
|
1476
1476
|
mantissa : int , optional
|
1477
|
-
The
|
1477
|
+
The number of decimal places to round the result to. Default is 6.
|
1478
1478
|
|
1479
1479
|
|
1480
1480
|
Returns
|
@@ -1525,26 +1525,26 @@ class Graph:
|
|
1525
1525
|
graph : topologic_core.Graph
|
1526
1526
|
The input graph.
|
1527
1527
|
method : str , optional
|
1528
|
-
The method of computing the betweenness centrality. The options are "vertex" or "edge".
|
1528
|
+
The method of computing the betweenness centrality. The options are "vertex" or "edge". Default is "vertex".
|
1529
1529
|
weightKey : str , optional
|
1530
1530
|
If specified, the value in the connected edges' dictionary specified by the weightKey string will be aggregated to calculate
|
1531
1531
|
the shortest path. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
1532
1532
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
1533
1533
|
normalize : bool , optional
|
1534
|
-
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not.
|
1534
|
+
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not. Default is False.
|
1535
1535
|
nxCompatible : bool , optional
|
1536
|
-
If set to True, and normalize input parameter is also set to True, the values are set to be identical to NetworkX values. Otherwise, they are normalized between 0 and 1.
|
1536
|
+
If set to True, and normalize input parameter is also set to True, the values are set to be identical to NetworkX values. Otherwise, they are normalized between 0 and 1. Default is False.
|
1537
1537
|
key : str , optional
|
1538
|
-
The desired dictionary key under which to store the betweenness centrality score.
|
1538
|
+
The desired dictionary key under which to store the betweenness centrality score. Default is "betweenness_centrality".
|
1539
1539
|
colorKey : str , optional
|
1540
|
-
The desired dictionary key under which to store the betweenness centrality color.
|
1540
|
+
The desired dictionary key under which to store the betweenness centrality color. Default is "betweenness_centrality".
|
1541
1541
|
colorScale : str , optional
|
1542
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
1542
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
1543
1543
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
1544
1544
|
mantissa : int , optional
|
1545
|
-
The
|
1545
|
+
The number of decimal places to round the result to. Default is 6.
|
1546
1546
|
tolerance : float , optional
|
1547
|
-
The desired tolerance.
|
1547
|
+
The desired tolerance. Default is 0.0001.
|
1548
1548
|
|
1549
1549
|
Returns
|
1550
1550
|
-------
|
@@ -1615,16 +1615,16 @@ class Graph:
|
|
1615
1615
|
graph : topologicp.Graph
|
1616
1616
|
The input topologic graph.
|
1617
1617
|
n : int , optional
|
1618
|
-
The desired number of partitions when selecting the "Betweenness" method. This parameter is ignored for other methods.
|
1618
|
+
The desired number of partitions when selecting the "Betweenness" method. This parameter is ignored for other methods. Default is 2.
|
1619
1619
|
m : int , optional
|
1620
|
-
The desired maximum number of tries to partition the graph when selecting the "Betweenness" method. This parameter is ignored for other methods.
|
1620
|
+
The desired maximum number of tries to partition the graph when selecting the "Betweenness" method. This parameter is ignored for other methods. Default is 10.
|
1621
1621
|
key : str , optional
|
1622
|
-
The vertex and edge dictionary key under which to store the parition number.
|
1622
|
+
The vertex and edge dictionary key under which to store the parition number. Default is "partition".
|
1623
1623
|
Valid partition numbers start from 1. Cut edges receive a partition number of 0.
|
1624
1624
|
tolerance : float , optional
|
1625
|
-
The desired tolerance.
|
1625
|
+
The desired tolerance. Default is 0.0001.
|
1626
1626
|
silent : bool , optional
|
1627
|
-
If set to True, error and warning messages are suppressed.
|
1627
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
1628
1628
|
|
1629
1629
|
Returns
|
1630
1630
|
-------
|
@@ -1684,9 +1684,9 @@ class Graph:
|
|
1684
1684
|
graph : topologic_core.Graph
|
1685
1685
|
The input graph.
|
1686
1686
|
key : str , optional
|
1687
|
-
The edge dictionary key under which to store the bridge status. 0 means the edge is NOT a bridge. 1 means that the edge IS a bridge.
|
1687
|
+
The edge dictionary key under which to store the bridge status. 0 means the edge is NOT a bridge. 1 means that the edge IS a bridge. Default is "bridge".
|
1688
1688
|
silent : bool , optional
|
1689
|
-
If set to True, error and warning messages are suppressed.
|
1689
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
1690
1690
|
|
1691
1691
|
Returns
|
1692
1692
|
-------
|
@@ -1787,7 +1787,7 @@ class Graph:
|
|
1787
1787
|
A list of dictionaries to assign to the vertices of the graph. This list should be in
|
1788
1788
|
the same order and of the same length as the rows in the adjacency matrix.
|
1789
1789
|
silent : bool , optional
|
1790
|
-
If set to True, no warnings or error messages are displayed.
|
1790
|
+
If set to True, no warnings or error messages are displayed. Default is False.
|
1791
1791
|
|
1792
1792
|
Returns
|
1793
1793
|
-------
|
@@ -1816,23 +1816,23 @@ class Graph:
|
|
1816
1816
|
A list of dictionaries to assign to the vertices of the graph. This list should be in
|
1817
1817
|
the same order and of the same length as the rows in the adjacency matrix.
|
1818
1818
|
edgeKeyFwd : str , optional
|
1819
|
-
The dictionary key under which to store the edge weight value for forward edge.
|
1819
|
+
The dictionary key under which to store the edge weight value for forward edge. Default is "weight".
|
1820
1820
|
edgeKeyBwd : str , optional
|
1821
|
-
The dictionary key under which to store the edge weight value for backward edge.
|
1821
|
+
The dictionary key under which to store the edge weight value for backward edge. Default is "weight".
|
1822
1822
|
xMin : float , optional
|
1823
|
-
The desired minimum value to assign for a vertex's X coordinate.
|
1823
|
+
The desired minimum value to assign for a vertex's X coordinate. Default is -0.5.
|
1824
1824
|
yMin : float , optional
|
1825
|
-
The desired minimum value to assign for a vertex's Y coordinate.
|
1825
|
+
The desired minimum value to assign for a vertex's Y coordinate. Default is -0.5.
|
1826
1826
|
zMin : float , optional
|
1827
|
-
The desired minimum value to assign for a vertex's Z coordinate.
|
1827
|
+
The desired minimum value to assign for a vertex's Z coordinate. Default is -0.5.
|
1828
1828
|
xMax : float , optional
|
1829
|
-
The desired maximum value to assign for a vertex's X coordinate.
|
1829
|
+
The desired maximum value to assign for a vertex's X coordinate. Default is 0.5.
|
1830
1830
|
yMax : float , optional
|
1831
|
-
The desired maximum value to assign for a vertex's Y coordinate.
|
1831
|
+
The desired maximum value to assign for a vertex's Y coordinate. Default is 0.5.
|
1832
1832
|
zMax : float , optional
|
1833
|
-
The desired maximum value to assign for a vertex's Z coordinate.
|
1833
|
+
The desired maximum value to assign for a vertex's Z coordinate. Default is 0.5.
|
1834
1834
|
silent : bool , optional
|
1835
|
-
If set to True, no warnings or error messages are displayed.
|
1835
|
+
If set to True, no warnings or error messages are displayed. Default is False.
|
1836
1836
|
|
1837
1837
|
Returns
|
1838
1838
|
-------
|
@@ -2096,49 +2096,49 @@ class Graph:
|
|
2096
2096
|
path : str
|
2097
2097
|
The path to the folder containing the .yaml and .csv files for graphs, edges, and nodes.
|
2098
2098
|
graphIDHeader : str , optional
|
2099
|
-
The column header string used to specify the graph id.
|
2099
|
+
The column header string used to specify the graph id. Default is "graph_id".
|
2100
2100
|
graphLabelHeader : str , optional
|
2101
|
-
The column header string used to specify the graph label.
|
2101
|
+
The column header string used to specify the graph label. Default is "label".
|
2102
2102
|
graphFeaturesHeader : str , optional
|
2103
|
-
The column header string used to specify the graph features.
|
2103
|
+
The column header string used to specify the graph features. Default is "feat".
|
2104
2104
|
edgeSRCHeader : str , optional
|
2105
|
-
The column header string used to specify the source vertex id of edges.
|
2105
|
+
The column header string used to specify the source vertex id of edges. Default is "src_id".
|
2106
2106
|
edgeDSTHeader : str , optional
|
2107
|
-
The column header string used to specify the destination vertex id of edges.
|
2107
|
+
The column header string used to specify the destination vertex id of edges. Default is "dst_id".
|
2108
2108
|
edgeLabelHeader : str , optional
|
2109
|
-
The column header string used to specify the label of edges.
|
2109
|
+
The column header string used to specify the label of edges. Default is "label".
|
2110
2110
|
edgeTrainMaskHeader : str , optional
|
2111
|
-
The column header string used to specify the train mask of edges.
|
2111
|
+
The column header string used to specify the train mask of edges. Default is "train_mask".
|
2112
2112
|
edgeValidateMaskHeader : str , optional
|
2113
|
-
The column header string used to specify the validate mask of edges.
|
2113
|
+
The column header string used to specify the validate mask of edges. Default is "val_mask".
|
2114
2114
|
edgeTestMaskHeader : str , optional
|
2115
|
-
The column header string used to specify the test mask of edges.
|
2115
|
+
The column header string used to specify the test mask of edges. Default is "test_mask".
|
2116
2116
|
edgeFeaturesHeader : str , optional
|
2117
|
-
The column header string used to specify the features of edges.
|
2117
|
+
The column header string used to specify the features of edges. Default is "feat".
|
2118
2118
|
edgeFeaturesKeys : list , optional
|
2119
|
-
The list of dictionary keys to use to index the edge features. The length of this list must match the length of edge features.
|
2119
|
+
The list of dictionary keys to use to index the edge features. The length of this list must match the length of edge features. Default is [].
|
2120
2120
|
nodeIDHeader : str , optional
|
2121
|
-
The column header string used to specify the id of nodes.
|
2121
|
+
The column header string used to specify the id of nodes. Default is "node_id".
|
2122
2122
|
nodeLabelHeader : str , optional
|
2123
|
-
The column header string used to specify the label of nodes.
|
2123
|
+
The column header string used to specify the label of nodes. Default is "label".
|
2124
2124
|
nodeTrainMaskHeader : str , optional
|
2125
|
-
The column header string used to specify the train mask of nodes.
|
2125
|
+
The column header string used to specify the train mask of nodes. Default is "train_mask".
|
2126
2126
|
nodeValidateMaskHeader : str , optional
|
2127
|
-
The column header string used to specify the validate mask of nodes.
|
2127
|
+
The column header string used to specify the validate mask of nodes. Default is "val_mask".
|
2128
2128
|
nodeTestMaskHeader : str , optional
|
2129
|
-
The column header string used to specify the test mask of nodes.
|
2129
|
+
The column header string used to specify the test mask of nodes. Default is "test_mask".
|
2130
2130
|
nodeFeaturesHeader : str , optional
|
2131
|
-
The column header string used to specify the features of nodes.
|
2131
|
+
The column header string used to specify the features of nodes. Default is "feat".
|
2132
2132
|
nodeXHeader : str , optional
|
2133
|
-
The column header string used to specify the X coordinate of nodes.
|
2133
|
+
The column header string used to specify the X coordinate of nodes. Default is "X".
|
2134
2134
|
nodeYHeader : str , optional
|
2135
|
-
The column header string used to specify the Y coordinate of nodes.
|
2135
|
+
The column header string used to specify the Y coordinate of nodes. Default is "Y".
|
2136
2136
|
nodeZHeader : str , optional
|
2137
|
-
The column header string used to specify the Z coordinate of nodes.
|
2137
|
+
The column header string used to specify the Z coordinate of nodes. Default is "Z".
|
2138
2138
|
tolerance : float , optional
|
2139
|
-
The desired tolerance.
|
2139
|
+
The desired tolerance. Default is 0.0001.
|
2140
2140
|
silent : bool , optional
|
2141
|
-
If set to True, error and warning messages are suppressed.
|
2141
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
2142
2142
|
|
2143
2143
|
Returns
|
2144
2144
|
-------
|
@@ -2398,9 +2398,9 @@ class Graph:
|
|
2398
2398
|
file : file object
|
2399
2399
|
The input file.
|
2400
2400
|
key : str , optional
|
2401
|
-
The desired key for storing the node label.
|
2401
|
+
The desired key for storing the node label. Default is "label".
|
2402
2402
|
tolerance : float , optional
|
2403
|
-
The desired tolerance.
|
2403
|
+
The desired tolerance. Default is 0.0001.
|
2404
2404
|
|
2405
2405
|
Returns
|
2406
2406
|
-------
|
@@ -2426,9 +2426,9 @@ class Graph:
|
|
2426
2426
|
path : str
|
2427
2427
|
The input file path.
|
2428
2428
|
key : str , optional
|
2429
|
-
The desired key for storing the node label.
|
2429
|
+
The desired key for storing the node label. Default is "label".
|
2430
2430
|
tolerance : str , optional
|
2431
|
-
The desired tolerance.
|
2431
|
+
The desired tolerance. Default is 0.0001.
|
2432
2432
|
|
2433
2433
|
Returns
|
2434
2434
|
-------
|
@@ -2456,9 +2456,9 @@ class Graph:
|
|
2456
2456
|
string : str
|
2457
2457
|
The input string.
|
2458
2458
|
key : str , optional
|
2459
|
-
The desired key for storing the node label.
|
2459
|
+
The desired key for storing the node label. Default is "label".
|
2460
2460
|
tolerance : float , optional
|
2461
|
-
The desired tolerance.
|
2461
|
+
The desired tolerance. Default is 0.0001.
|
2462
2462
|
|
2463
2463
|
Returns
|
2464
2464
|
-------
|
@@ -2534,35 +2534,35 @@ class Graph:
|
|
2534
2534
|
file : file
|
2535
2535
|
The input IFC file
|
2536
2536
|
includeTypes : list , optional
|
2537
|
-
A list of IFC object types to include in the graph.
|
2537
|
+
A list of IFC object types to include in the graph. Default is [] which means all object types are included.
|
2538
2538
|
excludeTypes : list , optional
|
2539
|
-
A list of IFC object types to exclude from the graph.
|
2539
|
+
A list of IFC object types to exclude from the graph. Default is [] which mean no object type is excluded.
|
2540
2540
|
includeRels : list , optional
|
2541
|
-
A list of IFC relationship types to include in the graph.
|
2541
|
+
A list of IFC relationship types to include in the graph. Default is [] which means all relationship types are included.
|
2542
2542
|
excludeRels : list , optional
|
2543
|
-
A list of IFC relationship types to exclude from the graph.
|
2543
|
+
A list of IFC relationship types to exclude from the graph. Default is [] which mean no relationship type is excluded.
|
2544
2544
|
transferDictionaries : bool , optional
|
2545
|
-
NOT USED. If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't.
|
2545
|
+
NOT USED. If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. Default is False.
|
2546
2546
|
useInternalVertex : bool , optional
|
2547
|
-
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid.
|
2547
|
+
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. Default is False.
|
2548
2548
|
storeBREP : bool , optional
|
2549
|
-
If set to True, store the BRep of the subtopology in its representative vertex.
|
2549
|
+
If set to True, store the BRep of the subtopology in its representative vertex. Default is False.
|
2550
2550
|
removeCoplanarFaces : bool , optional
|
2551
|
-
If set to True, coplanar faces are removed. Otherwise they are not.
|
2551
|
+
If set to True, coplanar faces are removed. Otherwise they are not. Default is False.
|
2552
2552
|
xMin : float, optional
|
2553
|
-
The desired minimum value to assign for a vertex's X coordinate.
|
2553
|
+
The desired minimum value to assign for a vertex's X coordinate. Default is -0.5.
|
2554
2554
|
yMin : float, optional
|
2555
|
-
The desired minimum value to assign for a vertex's Y coordinate.
|
2555
|
+
The desired minimum value to assign for a vertex's Y coordinate. Default is -0.5.
|
2556
2556
|
zMin : float, optional
|
2557
|
-
The desired minimum value to assign for a vertex's Z coordinate.
|
2557
|
+
The desired minimum value to assign for a vertex's Z coordinate. Default is -0.5.
|
2558
2558
|
xMax : float, optional
|
2559
|
-
The desired maximum value to assign for a vertex's X coordinate.
|
2559
|
+
The desired maximum value to assign for a vertex's X coordinate. Default is 0.5.
|
2560
2560
|
yMax : float, optional
|
2561
|
-
The desired maximum value to assign for a vertex's Y coordinate.
|
2561
|
+
The desired maximum value to assign for a vertex's Y coordinate. Default is 0.5.
|
2562
2562
|
zMax : float, optional
|
2563
|
-
The desired maximum value to assign for a vertex's Z coordinate.
|
2563
|
+
The desired maximum value to assign for a vertex's Z coordinate. Default is 0.5.
|
2564
2564
|
tolerance : float , optional
|
2565
|
-
The desired tolerance.
|
2565
|
+
The desired tolerance. Default is 0.0001.
|
2566
2566
|
|
2567
2567
|
Returns
|
2568
2568
|
-------
|
@@ -2729,35 +2729,35 @@ class Graph:
|
|
2729
2729
|
file : file
|
2730
2730
|
The input IFC file
|
2731
2731
|
includeTypes : list , optional
|
2732
|
-
A list of IFC object types to include in the graph.
|
2732
|
+
A list of IFC object types to include in the graph. Default is [] which means all object types are included.
|
2733
2733
|
excludeTypes : list , optional
|
2734
|
-
A list of IFC object types to exclude from the graph.
|
2734
|
+
A list of IFC object types to exclude from the graph. Default is [] which mean no object type is excluded.
|
2735
2735
|
includeRels : list , optional
|
2736
|
-
A list of IFC relationship types to include in the graph.
|
2736
|
+
A list of IFC relationship types to include in the graph. Default is [] which means all relationship types are included.
|
2737
2737
|
excludeRels : list , optional
|
2738
|
-
A list of IFC relationship types to exclude from the graph.
|
2738
|
+
A list of IFC relationship types to exclude from the graph. Default is [] which mean no relationship type is excluded.
|
2739
2739
|
transferDictionaries : bool , optional
|
2740
|
-
If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't.
|
2740
|
+
If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. Default is False.
|
2741
2741
|
useInternalVertex : bool , optional
|
2742
|
-
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid.
|
2742
|
+
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. Default is False.
|
2743
2743
|
storeBREP : bool , optional
|
2744
|
-
If set to True, store the BRep of the subtopology in its representative vertex.
|
2744
|
+
If set to True, store the BRep of the subtopology in its representative vertex. Default is False.
|
2745
2745
|
removeCoplanarFaces : bool , optional
|
2746
|
-
If set to True, coplanar faces are removed. Otherwise they are not.
|
2746
|
+
If set to True, coplanar faces are removed. Otherwise they are not. Default is False.
|
2747
2747
|
xMin : float, optional
|
2748
|
-
The desired minimum value to assign for a vertex's X coordinate.
|
2748
|
+
The desired minimum value to assign for a vertex's X coordinate. Default is -0.5.
|
2749
2749
|
yMin : float, optional
|
2750
|
-
The desired minimum value to assign for a vertex's Y coordinate.
|
2750
|
+
The desired minimum value to assign for a vertex's Y coordinate. Default is -0.5.
|
2751
2751
|
zMin : float, optional
|
2752
|
-
The desired minimum value to assign for a vertex's Z coordinate.
|
2752
|
+
The desired minimum value to assign for a vertex's Z coordinate. Default is -0.5.
|
2753
2753
|
xMax : float, optional
|
2754
|
-
The desired maximum value to assign for a vertex's X coordinate.
|
2754
|
+
The desired maximum value to assign for a vertex's X coordinate. Default is 0.5.
|
2755
2755
|
yMax : float, optional
|
2756
|
-
The desired maximum value to assign for a vertex's Y coordinate.
|
2756
|
+
The desired maximum value to assign for a vertex's Y coordinate. Default is 0.5.
|
2757
2757
|
zMax : float, optional
|
2758
|
-
The desired maximum value to assign for a vertex's Z coordinate.
|
2758
|
+
The desired maximum value to assign for a vertex's Z coordinate. Default is 0.5.
|
2759
2759
|
tolerance : float , optional
|
2760
|
-
The desired tolerance.
|
2760
|
+
The desired tolerance. Default is 0.0001.
|
2761
2761
|
|
2762
2762
|
Returns
|
2763
2763
|
-------
|
@@ -3154,33 +3154,33 @@ class Graph:
|
|
3154
3154
|
path : str
|
3155
3155
|
The input IFC file path.
|
3156
3156
|
includeTypes : list , optional
|
3157
|
-
A list of IFC object types to include in the graph.
|
3157
|
+
A list of IFC object types to include in the graph. Default is [] which means all object types are included.
|
3158
3158
|
excludeTypes : list , optional
|
3159
|
-
A list of IFC object types to exclude from the graph.
|
3159
|
+
A list of IFC object types to exclude from the graph. Default is [] which mean no object type is excluded.
|
3160
3160
|
includeRels : list , optional
|
3161
|
-
A list of IFC relationship types to include in the graph.
|
3161
|
+
A list of IFC relationship types to include in the graph. Default is [] which means all relationship types are included.
|
3162
3162
|
excludeRels : list , optional
|
3163
|
-
A list of IFC relationship types to exclude from the graph.
|
3163
|
+
A list of IFC relationship types to exclude from the graph. Default is [] which mean no relationship type is excluded.
|
3164
3164
|
transferDictionaries : bool , optional
|
3165
|
-
If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't.
|
3165
|
+
If set to True, the dictionaries from the IFC file will be transferred to the topology. Otherwise, they won't. Default is False.
|
3166
3166
|
useInternalVertex : bool , optional
|
3167
|
-
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid.
|
3167
|
+
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. Default is False.
|
3168
3168
|
storeBREP : bool , optional
|
3169
|
-
If set to True, store the BRep of the subtopology in its representative vertex.
|
3169
|
+
If set to True, store the BRep of the subtopology in its representative vertex. Default is False.
|
3170
3170
|
removeCoplanarFaces : bool , optional
|
3171
|
-
If set to True, coplanar faces are removed. Otherwise they are not.
|
3171
|
+
If set to True, coplanar faces are removed. Otherwise they are not. Default is False.
|
3172
3172
|
xMin : float, optional
|
3173
|
-
The desired minimum value to assign for a vertex's X coordinate.
|
3173
|
+
The desired minimum value to assign for a vertex's X coordinate. Default is -0.5.
|
3174
3174
|
yMin : float, optional
|
3175
|
-
The desired minimum value to assign for a vertex's Y coordinate.
|
3175
|
+
The desired minimum value to assign for a vertex's Y coordinate. Default is -0.5.
|
3176
3176
|
zMin : float, optional
|
3177
|
-
The desired minimum value to assign for a vertex's Z coordinate.
|
3177
|
+
The desired minimum value to assign for a vertex's Z coordinate. Default is -0.5.
|
3178
3178
|
xMax : float, optional
|
3179
|
-
The desired maximum value to assign for a vertex's X coordinate.
|
3179
|
+
The desired maximum value to assign for a vertex's X coordinate. Default is 0.5.
|
3180
3180
|
yMax : float, optional
|
3181
|
-
The desired maximum value to assign for a vertex's Y coordinate.
|
3181
|
+
The desired maximum value to assign for a vertex's Y coordinate. Default is 0.5.
|
3182
3182
|
zMax : float, optional
|
3183
|
-
The desired maximum value to assign for a vertex's Z coordinate.
|
3183
|
+
The desired maximum value to assign for a vertex's Z coordinate. Default is 0.5.
|
3184
3184
|
|
3185
3185
|
Returns
|
3186
3186
|
-------
|
@@ -3244,7 +3244,7 @@ class Graph:
|
|
3244
3244
|
edgeDictionaries : list , optional
|
3245
3245
|
The python dictionaries of the edges (in the same order as the list of edges).
|
3246
3246
|
tolerance : float , optional
|
3247
|
-
The desired tolerance.
|
3247
|
+
The desired tolerance. Default is 0.0001.
|
3248
3248
|
|
3249
3249
|
Returns
|
3250
3250
|
-------
|
@@ -3296,17 +3296,17 @@ class Graph:
|
|
3296
3296
|
nxGraph : NetworkX graph
|
3297
3297
|
The input NetworkX graph.
|
3298
3298
|
xKey : str , optional
|
3299
|
-
The dictionary key under which to find the X-Coordinate of the vertex.
|
3299
|
+
The dictionary key under which to find the X-Coordinate of the vertex. Default is 'x'.
|
3300
3300
|
yKey : str , optional
|
3301
|
-
The dictionary key under which to find the Y-Coordinate of the vertex.
|
3301
|
+
The dictionary key under which to find the Y-Coordinate of the vertex. Default is 'y'.
|
3302
3302
|
zKey : str , optional
|
3303
|
-
The dictionary key under which to find the Z-Coordinate of the vertex.
|
3303
|
+
The dictionary key under which to find the Z-Coordinate of the vertex. Default is 'z'.
|
3304
3304
|
range : tuple , optional
|
3305
|
-
The range to use for position coordinates if no values are found in the dictionaries.
|
3305
|
+
The range to use for position coordinates if no values are found in the dictionaries. Default is (-1,1)
|
3306
3306
|
mantissa : int , optional
|
3307
|
-
The
|
3307
|
+
The number of decimal places to round the result to. Default is 6.
|
3308
3308
|
tolerance : float , optional
|
3309
|
-
The desired tolerance.
|
3309
|
+
The desired tolerance. Default is 0.0001.
|
3310
3310
|
|
3311
3311
|
Returns
|
3312
3312
|
-------
|
@@ -3387,25 +3387,25 @@ class Graph:
|
|
3387
3387
|
topology : topologic_core.Topology
|
3388
3388
|
The input topology.
|
3389
3389
|
direct : bool , optional
|
3390
|
-
If set to True, connect the subtopologies directly with a single edge.
|
3390
|
+
If set to True, connect the subtopologies directly with a single edge. Default is True.
|
3391
3391
|
directApertures : bool , optional
|
3392
|
-
If set to True, connect the subtopologies directly with a single edge if they share one or more apertures.
|
3392
|
+
If set to True, connect the subtopologies directly with a single edge if they share one or more apertures. Default is False.
|
3393
3393
|
viaSharedTopologies : bool , optional
|
3394
|
-
If set to True, connect the subtopologies via their shared topologies.
|
3394
|
+
If set to True, connect the subtopologies via their shared topologies. Default is False.
|
3395
3395
|
viaSharedApertures : bool , optional
|
3396
|
-
If set to True, connect the subtopologies via their shared apertures.
|
3396
|
+
If set to True, connect the subtopologies via their shared apertures. Default is False.
|
3397
3397
|
toExteriorTopologies : bool , optional
|
3398
|
-
If set to True, connect the subtopologies to their exterior topologies.
|
3398
|
+
If set to True, connect the subtopologies to their exterior topologies. Default is False.
|
3399
3399
|
toExteriorApertures : bool , optional
|
3400
|
-
If set to True, connect the subtopologies to their exterior apertures.
|
3400
|
+
If set to True, connect the subtopologies to their exterior apertures. Default is False.
|
3401
3401
|
toContents : bool , optional
|
3402
|
-
If set to True, connect the subtopologies to their contents.
|
3402
|
+
If set to True, connect the subtopologies to their contents. Default is False.
|
3403
3403
|
toOutposts : bool , optional
|
3404
|
-
If set to True, connect the topology to the list specified in its outposts.
|
3404
|
+
If set to True, connect the topology to the list specified in its outposts. Default is False.
|
3405
3405
|
idKey : str , optional
|
3406
|
-
The key to use to find outpost by ID. It is case insensitive.
|
3406
|
+
The key to use to find outpost by ID. It is case insensitive. Default is "TOPOLOGIC_ID".
|
3407
3407
|
outpostsKey : str , optional
|
3408
|
-
The key to use to find the list of outposts. It is case insensitive.
|
3408
|
+
The key to use to find the list of outposts. It is case insensitive. Default is "outposts".
|
3409
3409
|
vertexCategoryKey : str , optional
|
3410
3410
|
The key under which to store the node type. Node categories are:
|
3411
3411
|
0 : main topology
|
@@ -3427,11 +3427,11 @@ class Graph:
|
|
3427
3427
|
6 : to outpost
|
3428
3428
|
The default is "category".
|
3429
3429
|
useInternalVertex : bool , optional
|
3430
|
-
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid.
|
3430
|
+
If set to True, use an internal vertex to represent the subtopology. Otherwise, use its centroid. Default is False.
|
3431
3431
|
storeBREP : bool , optional
|
3432
|
-
If set to True, store the BRep of the subtopology in its representative vertex.
|
3432
|
+
If set to True, store the BRep of the subtopology in its representative vertex. Default is False.
|
3433
3433
|
tolerance : float , optional
|
3434
|
-
The desired tolerance.
|
3434
|
+
The desired tolerance. Default is 0.0001.
|
3435
3435
|
|
3436
3436
|
Returns
|
3437
3437
|
-------
|
@@ -4585,26 +4585,26 @@ class Graph:
|
|
4585
4585
|
graph : topologic_core.Graph
|
4586
4586
|
The input graph.
|
4587
4587
|
method : str , optional
|
4588
|
-
The method of computing the betweenness centrality. The options are "vertex" or "edge".
|
4588
|
+
The method of computing the betweenness centrality. The options are "vertex" or "edge". Default is "vertex".
|
4589
4589
|
weightKey : str , optional
|
4590
4590
|
If specified, the value in the connected edges' dictionary specified by the weightKey string will be aggregated to calculate
|
4591
4591
|
the shortest path. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
4592
4592
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
4593
4593
|
normalize : bool , optional
|
4594
|
-
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not.
|
4594
|
+
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not. Default is False.
|
4595
4595
|
nxCompatible : bool , optional
|
4596
|
-
If set to True, and normalize input parameter is also set to True, the values are set to be identical to NetworkX values. Otherwise, they are normalized between 0 and 1.
|
4596
|
+
If set to True, and normalize input parameter is also set to True, the values are set to be identical to NetworkX values. Otherwise, they are normalized between 0 and 1. Default is False.
|
4597
4597
|
key : str , optional
|
4598
|
-
The desired dictionary key under which to store the betweenness centrality score.
|
4598
|
+
The desired dictionary key under which to store the betweenness centrality score. Default is "betweenness_centrality".
|
4599
4599
|
colorKey : str , optional
|
4600
|
-
The desired dictionary key under which to store the betweenness centrality color.
|
4600
|
+
The desired dictionary key under which to store the betweenness centrality color. Default is "betweenness_centrality".
|
4601
4601
|
colorScale : str , optional
|
4602
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
4602
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
4603
4603
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
4604
4604
|
mantissa : int , optional
|
4605
|
-
The
|
4605
|
+
The number of decimal places to round the result to. Default is 6.
|
4606
4606
|
tolerance : float , optional
|
4607
|
-
The desired tolerance.
|
4607
|
+
The desired tolerance. Default is 0.0001.
|
4608
4608
|
|
4609
4609
|
Returns
|
4610
4610
|
-------
|
@@ -4635,9 +4635,9 @@ class Graph:
|
|
4635
4635
|
graph : topologic_core.Graph
|
4636
4636
|
The input graph.
|
4637
4637
|
maxColors : int , optional
|
4638
|
-
The desired maximum number of colors to test against.
|
4638
|
+
The desired maximum number of colors to test against. Default is 3.
|
4639
4639
|
silent : bool , optional
|
4640
|
-
If set to True, error and warning messages are suppressed.
|
4640
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
4641
4641
|
|
4642
4642
|
Returns
|
4643
4643
|
-------
|
@@ -4701,13 +4701,13 @@ class Graph:
|
|
4701
4701
|
graph : topologic_core.Graph
|
4702
4702
|
The input graph.
|
4703
4703
|
oldKey : str , optional
|
4704
|
-
The existing dictionary key to use to read any pre-existing color information.
|
4704
|
+
The existing dictionary key to use to read any pre-existing color information. Default is "color".
|
4705
4705
|
key : str , optional
|
4706
|
-
The new dictionary key to use to write out new color information.
|
4706
|
+
The new dictionary key to use to write out new color information. Default is "color".
|
4707
4707
|
maxColors : int , optional
|
4708
|
-
The desired maximum number of colors to use. If set to None, the chromatic number of the graph is used.
|
4708
|
+
The desired maximum number of colors to use. If set to None, the chromatic number of the graph is used. Default is None.
|
4709
4709
|
tolerance : float , optional
|
4710
|
-
The desired tolerance.
|
4710
|
+
The desired tolerance. Default is 0.0001.
|
4711
4711
|
|
4712
4712
|
Returns
|
4713
4713
|
-------
|
@@ -4794,13 +4794,18 @@ class Graph:
|
|
4794
4794
|
weightDiameter: float = 0.0,
|
4795
4795
|
weightEigenVectorCentrality: float = 0.0,
|
4796
4796
|
weightGlobalClusteringCoefficient: float = 0.0,
|
4797
|
+
weightHopper: float = 0.0,
|
4798
|
+
weightJaccard: float = 0.0,
|
4797
4799
|
weightPageRank: float = 0.0,
|
4798
4800
|
weightStructure: float = 0.0,
|
4799
4801
|
weightWeisfeilerLehman: float = 0.0,
|
4800
|
-
weightJaccard: float = 0.0,
|
4801
4802
|
vertexIDKey: str = "id",
|
4802
4803
|
edgeWeightKey: str = None,
|
4803
|
-
|
4804
|
+
wlKey: str = None,
|
4805
|
+
hopperKey: str = None,
|
4806
|
+
iterations: int = 2,
|
4807
|
+
maxHops: int = 2,
|
4808
|
+
decay: float = 0.5,
|
4804
4809
|
mantissa: int = 6,
|
4805
4810
|
silent: bool = False):
|
4806
4811
|
"""
|
@@ -4832,6 +4837,8 @@ class Graph:
|
|
4832
4837
|
The desired weight for geometric similarity (vertex positions). Default is 0.0.
|
4833
4838
|
weightGlobalClusteringCoefficient : float , optional
|
4834
4839
|
The desired weight for global clustering coefficient similarity (graph-level and node-level). Default is 0.0.
|
4840
|
+
weightHopper : float , optional
|
4841
|
+
The desired weight for Hopper kernel similarity. Default is 0.0.
|
4835
4842
|
weightJaccard: float , optional
|
4836
4843
|
The desired weight for the Weighted Jaccard similarity. Default is 0.0.
|
4837
4844
|
weightPageRank : float , optional
|
@@ -4840,19 +4847,26 @@ class Graph:
|
|
4840
4847
|
The desired weight for structural similarity (number of vertices and edges). Default is 0.0.
|
4841
4848
|
weightWeisfeilerLehman : float , optional
|
4842
4849
|
The desired weight for Weisfeiler-Lehman kernel similarity (iterative label propagation). Default is 0.0.
|
4843
|
-
|
4844
4850
|
vertexIDKey: str , optional
|
4845
|
-
The dictionary key under which to find the unique vertex ID.
|
4851
|
+
The dictionary key under which to find the unique vertex ID. Default is "id".
|
4846
4852
|
edgeWeightKey: str , optional
|
4847
4853
|
The dictionary key under which to find the weight of the edge for weighted graphs.
|
4848
4854
|
If this parameter is specified as "length" or "distance" then the length of the edge is used as its weight.
|
4849
4855
|
The default is None which means all edges are treated as if they have a weight of 1.
|
4856
|
+
wlKey: str , optional
|
4857
|
+
The vertex key to use for the Weifeiler-Lehman kernel initial labels. Default is None which means it will use vertex degree as an initial label.
|
4858
|
+
hopperKey: str , optional
|
4859
|
+
The vertex key to use for the Hopper kernel to derive node features. Default is None which means it will use vertex degree as an initial label.
|
4850
4860
|
iterations : int , optional
|
4851
|
-
The desired number of Weisfeiler-Lehman iterations. Default is
|
4861
|
+
WL kernel-specific parameter: The desired number of Weisfeiler-Lehman kernel iterations. Default is 2.
|
4862
|
+
maxHops : int , optional
|
4863
|
+
Hopper kernel-specific parameter: The maximum shortest-path hop distance to consider. Default is 3.
|
4864
|
+
decay : float , optional
|
4865
|
+
Hopper kernel-specific parameter: A per-hop geometric decay factor in the range (0, 1]. Default is 0.5.
|
4852
4866
|
mantissa : int , optional
|
4853
|
-
The
|
4867
|
+
The number of decimal places to round the result to. Default is 6.
|
4854
4868
|
silent : bool , optional
|
4855
|
-
If set to True, error and warning messages are suppressed.
|
4869
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
4856
4870
|
|
4857
4871
|
Returns
|
4858
4872
|
-------
|
@@ -4867,6 +4881,7 @@ class Graph:
|
|
4867
4881
|
"eigenvector_centrality"
|
4868
4882
|
"geometry"
|
4869
4883
|
"global_clustering_coefficient"
|
4884
|
+
"hopper"
|
4870
4885
|
"jaccard"
|
4871
4886
|
"pagerank"
|
4872
4887
|
"structure"
|
@@ -4929,15 +4944,13 @@ class Graph:
|
|
4929
4944
|
graph2 : topologic Graph
|
4930
4945
|
Second graph.
|
4931
4946
|
vertexIDKey: str , optional
|
4932
|
-
The dictionary key under which to find the unique vertex ID.
|
4947
|
+
The dictionary key under which to find the unique vertex ID. Default is "id".
|
4933
4948
|
edgeWeightKey: str , optional
|
4934
4949
|
The dictionary key under which to find the weight of the edge for weighted graphs.
|
4935
4950
|
If this parameter is specified as "length" or "distance" then the length of the edge is used as its weight.
|
4936
4951
|
The default is None which means all edges are treated as if they have a weight of 1.
|
4937
|
-
iterations : int , optional
|
4938
|
-
The desired number of Weisfeiler-Lehman iterations. Default is 3.
|
4939
4952
|
mantissa : int , optional
|
4940
|
-
The
|
4953
|
+
The number of decimal places to round the result to. Default is 6.
|
4941
4954
|
|
4942
4955
|
Returns
|
4943
4956
|
-------
|
@@ -5043,6 +5056,10 @@ class Graph:
|
|
5043
5056
|
diff = abs(v1 - v2) / max(abs(v1), abs(v2), 1e-6)
|
5044
5057
|
return round((1 - diff), mantissa)
|
5045
5058
|
|
5059
|
+
def hopper_similarity(graphA, graphB, key=None, maxHops=3, decay=0.5, mantissa=6, silent=False):
|
5060
|
+
score = Graph.HopperKernel(graphA, graphB, key=key, maxHops=maxHops, decay=decay, normalize=True, mantissa=mantissa, silent=silent)
|
5061
|
+
return score
|
5062
|
+
|
5046
5063
|
def pagerank_similarity(graphA, graphB, mantissa=6):
|
5047
5064
|
v1 = safe_mean(Graph.PageRank(graphA))
|
5048
5065
|
v2 = safe_mean(Graph.PageRank(graphB))
|
@@ -5062,39 +5079,9 @@ class Graph:
|
|
5062
5079
|
|
5063
5080
|
return round((vertex_score + edge_score) / 2, mantissa)
|
5064
5081
|
|
5065
|
-
def
|
5066
|
-
|
5067
|
-
|
5068
|
-
|
5069
|
-
for v in vertices:
|
5070
|
-
d = Topology.Dictionary(v)
|
5071
|
-
label = str(Dictionary.ValueAtKey(d, "label")) if d and Dictionary.ValueAtKey(d, "label") else "0"
|
5072
|
-
labels[v] = label
|
5073
|
-
|
5074
|
-
all_label_counts = Counter()
|
5075
|
-
|
5076
|
-
for _ in range(iterations):
|
5077
|
-
new_labels = {}
|
5078
|
-
for v in vertices:
|
5079
|
-
neighbors = Graph.AdjacentVertices(graph, v)
|
5080
|
-
neighbor_labels = sorted(labels.get(n, "0") for n in neighbors)
|
5081
|
-
long_label = labels[v] + "_" + "_".join(neighbor_labels)
|
5082
|
-
hashed_label = hashlib.md5(long_label.encode()).hexdigest()
|
5083
|
-
new_labels[v] = hashed_label
|
5084
|
-
all_label_counts[hashed_label] += 1
|
5085
|
-
labels = new_labels
|
5086
|
-
|
5087
|
-
return all_label_counts
|
5088
|
-
|
5089
|
-
def weisfeiler_lehman_similarity(graphA, graphB, iterations=3, mantissa=6):
|
5090
|
-
f1 = weisfeiler_lehman_fingerprint(graphA, iterations)
|
5091
|
-
f2 = weisfeiler_lehman_fingerprint(graphB, iterations)
|
5092
|
-
|
5093
|
-
common_labels = set(f1.keys()) & set(f2.keys())
|
5094
|
-
score = sum(min(f1[label], f2[label]) for label in common_labels)
|
5095
|
-
norm = max(sum(f1.values()), sum(f2.values()), 1)
|
5096
|
-
|
5097
|
-
return round(score / norm, mantissa)
|
5082
|
+
def weisfeiler_lehman_similarity(graphA, graphB, key=None, iterations=2, mantissa=6, silent=True):
|
5083
|
+
score = Graph.WLKernel(graphA, graphB, key=key, iterations=iterations, normalize=True, mantissa=mantissa, silent=silent)
|
5084
|
+
return score
|
5098
5085
|
|
5099
5086
|
if not Topology.IsInstance(graphA, "graph"):
|
5100
5087
|
if not silent:
|
@@ -5114,23 +5101,25 @@ class Graph:
|
|
5114
5101
|
weightDiameter,
|
5115
5102
|
weightEigenVectorCentrality,
|
5116
5103
|
weightGlobalClusteringCoefficient,
|
5104
|
+
weightHopper,
|
5117
5105
|
weightPageRank,
|
5118
5106
|
weightStructure,
|
5119
5107
|
weightWeisfeilerLehman,
|
5120
5108
|
weightJaccard])
|
5121
|
-
accessibility_centrality_score = accessibility_centrality_similarity(graphA, graphB, mantissa=
|
5122
|
-
attribute_score = attribute_similarity(graphA, graphB, mantissa=
|
5123
|
-
betweenness_centrality_score = betweenness_centrality_similarity(graphA, graphB, mantissa=
|
5124
|
-
closeness_centrality_score = closeness_centrality_similarity(graphA, graphB, mantissa=
|
5125
|
-
degree_centrality_score = degree_centrality_similarity(graphA, graphB, mantissa=
|
5126
|
-
diameter_score = diameter_similarity(graphA, graphB, mantissa=
|
5127
|
-
eigenvector_centrality_score = eigenvector_centrality_similarity(graphA, graphB, mantissa=
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5109
|
+
accessibility_centrality_score = accessibility_centrality_similarity(graphA, graphB, mantissa=6) if weightAccessibilityCentrality else 0
|
5110
|
+
attribute_score = attribute_similarity(graphA, graphB, mantissa=6) if weightAttributes else 0
|
5111
|
+
betweenness_centrality_score = betweenness_centrality_similarity(graphA, graphB, mantissa=6) if weightBetwennessCentrality else 0
|
5112
|
+
closeness_centrality_score = closeness_centrality_similarity(graphA, graphB, mantissa=6) if weightClosenessCentrality else 0
|
5113
|
+
degree_centrality_score = degree_centrality_similarity(graphA, graphB, mantissa=6) if weightDegreeCentrality else 0
|
5114
|
+
diameter_score = diameter_similarity(graphA, graphB, mantissa=6) if weightDiameter else 0
|
5115
|
+
eigenvector_centrality_score = eigenvector_centrality_similarity(graphA, graphB, mantissa=6) if weightEigenVectorCentrality else 0
|
5116
|
+
geometry_score = geometry_similarity(graphA, graphB, mantissa=6) if weightGeometry else 0
|
5117
|
+
global_clustering_coefficient_score = global_clustering_coefficient_similarity(graphA, graphB, mantissa=6) if weightGlobalClusteringCoefficient else 0
|
5118
|
+
hopper_score = hopper_similarity(graphA, graphB, key=hopperKey, maxHops=maxHops, decay=decay, mantissa=6, silent=silent) if weightHopper else 0
|
5119
|
+
jaccard_score = weighted_jaccard_similarity(graphA, graphB, vertexIDKey=vertexIDKey, edgeWeightKey=edgeWeightKey, mantissa=6) if weightJaccard else 0
|
5120
|
+
pagerank_score = pagerank_similarity(graphA, graphB, mantissa=6) if weightPageRank else 0
|
5121
|
+
structure_score = structure_similarity(graphA, graphB, mantissa=6) if weightStructure else 0
|
5122
|
+
weisfeiler_lehman_score = weisfeiler_lehman_similarity(graphA, graphB, key=wlKey, iterations=iterations, mantissa=6, silent=silent) if weightWeisfeilerLehman else 0
|
5134
5123
|
|
5135
5124
|
weighted_sum = (
|
5136
5125
|
accessibility_centrality_score * weightAccessibilityCentrality +
|
@@ -5142,6 +5131,7 @@ class Graph:
|
|
5142
5131
|
eigenvector_centrality_score * weightEigenVectorCentrality +
|
5143
5132
|
geometry_score * weightGeometry +
|
5144
5133
|
global_clustering_coefficient_score * weightGlobalClusteringCoefficient +
|
5134
|
+
hopper_score * weightHopper +
|
5145
5135
|
jaccard_score * weightJaccard +
|
5146
5136
|
pagerank_score * weightPageRank +
|
5147
5137
|
structure_score * weightStructure +
|
@@ -5162,6 +5152,7 @@ class Graph:
|
|
5162
5152
|
"eigenvector_centrality": round(eigenvector_centrality_score, mantissa),
|
5163
5153
|
"geometry": round(geometry_score, mantissa),
|
5164
5154
|
"global_clustering_coefficient": round(global_clustering_coefficient_score, mantissa),
|
5155
|
+
"hopper": round(hopper_score, mantissa),
|
5165
5156
|
"jaccard": round(jaccard_score, mantissa),
|
5166
5157
|
"pagerank": round(pagerank_score, mantissa),
|
5167
5158
|
"structure": round(structure_score, mantissa),
|
@@ -5179,9 +5170,9 @@ class Graph:
|
|
5179
5170
|
graph : topologicpy.Graph
|
5180
5171
|
The input topologic graph.
|
5181
5172
|
tolerance : float , optional
|
5182
|
-
The desired tolerance.
|
5173
|
+
The desired tolerance. Default is 0.0001.
|
5183
5174
|
silent : bool , optional
|
5184
|
-
If set to True, error and warning messages are suppressed.
|
5175
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5185
5176
|
|
5186
5177
|
Returns
|
5187
5178
|
-------
|
@@ -5255,9 +5246,9 @@ class Graph:
|
|
5255
5246
|
graph : topologic_core.Graph
|
5256
5247
|
The input graph.
|
5257
5248
|
tolerance : float , optional
|
5258
|
-
The desired tolerance.
|
5249
|
+
The desired tolerance. Default is 0.0001.
|
5259
5250
|
silent : bool , optional
|
5260
|
-
If set to True, error and warning messages are suppressed.
|
5251
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5261
5252
|
|
5262
5253
|
Returns
|
5263
5254
|
-------
|
@@ -5297,11 +5288,11 @@ class Graph:
|
|
5297
5288
|
graph : topologic_core.Graph
|
5298
5289
|
The input graph.
|
5299
5290
|
key : str , optional
|
5300
|
-
The vertex and edge dictionary key under which to store the component number.
|
5291
|
+
The vertex and edge dictionary key under which to store the component number. Default is "component".
|
5301
5292
|
tolerance : float , optional
|
5302
|
-
The desired tolerance.
|
5293
|
+
The desired tolerance. Default is 0.0001.
|
5303
5294
|
silent : bool , optional
|
5304
|
-
If set to True, error and warning messages are suppressed.
|
5295
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5305
5296
|
|
5306
5297
|
Returns
|
5307
5298
|
-------
|
@@ -5388,9 +5379,9 @@ class Graph:
|
|
5388
5379
|
edge : topologic_core.Edge
|
5389
5380
|
The input graph edge that needs to be contracted.
|
5390
5381
|
vertex : topollogic.Vertex , optional
|
5391
|
-
The vertex to replace the contracted edge. If set to None, the centroid of the edge is chosen.
|
5382
|
+
The vertex to replace the contracted edge. If set to None, the centroid of the edge is chosen. Default is None.
|
5392
5383
|
tolerance : float , optional
|
5393
|
-
The desired tolerance.
|
5384
|
+
The desired tolerance. Default is 0.0001.
|
5394
5385
|
|
5395
5386
|
Returns
|
5396
5387
|
-------
|
@@ -5518,11 +5509,11 @@ class Graph:
|
|
5518
5509
|
colorScale : str , optional
|
5519
5510
|
Plotly color scale name (e.g., "viridis", "plasma").
|
5520
5511
|
mantissa : int , optional
|
5521
|
-
The
|
5512
|
+
The number of decimal places to round the result to. Default is 6.
|
5522
5513
|
tolerance : float , optional
|
5523
|
-
The desired tolerance.
|
5514
|
+
The desired tolerance. Default is 0.0001.
|
5524
5515
|
silent : bool , optional
|
5525
|
-
If set to True, error and warning messages are suppressed.
|
5516
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5526
5517
|
|
5527
5518
|
Returns
|
5528
5519
|
-------
|
@@ -5641,13 +5632,13 @@ class Graph:
|
|
5641
5632
|
graph : topologicp.Graph
|
5642
5633
|
The input topologic graph.
|
5643
5634
|
key : str , optional
|
5644
|
-
The dictionary key under which to store the partition number.
|
5635
|
+
The dictionary key under which to store the partition number. Default is "partition".
|
5645
5636
|
mantissa : int , optional
|
5646
|
-
The
|
5637
|
+
The number of decimal places to round the result to. Default is 6.
|
5647
5638
|
tolerance : float , optional
|
5648
|
-
The desired tolerance.
|
5639
|
+
The desired tolerance. Default is 0.0001.
|
5649
5640
|
silent : bool , optional
|
5650
|
-
If set to True, error and warning messages are suppressed.
|
5641
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5651
5642
|
Returns
|
5652
5643
|
-------
|
5653
5644
|
topologicpy.Graph
|
@@ -5668,13 +5659,13 @@ class Graph:
|
|
5668
5659
|
graph : topologicp.Graph
|
5669
5660
|
The input topologic graph.
|
5670
5661
|
key : str , optional
|
5671
|
-
The dictionary key under which to store the partition number.
|
5662
|
+
The dictionary key under which to store the partition number. Default is "partition".
|
5672
5663
|
mantissa : int , optional
|
5673
|
-
The
|
5664
|
+
The number of decimal places to round the result to. Default is 6.
|
5674
5665
|
tolerance : float , optional
|
5675
|
-
The desired tolerance.
|
5666
|
+
The desired tolerance. Default is 0.0001.
|
5676
5667
|
silent : bool , optional
|
5677
|
-
If set to True, error and warning messages are suppressed.
|
5668
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5678
5669
|
Returns
|
5679
5670
|
-------
|
5680
5671
|
topologicpy.Graph
|
@@ -5763,7 +5754,7 @@ class Graph:
|
|
5763
5754
|
verticesB : topologic_core.Vertex
|
5764
5755
|
The second list of input vertices.
|
5765
5756
|
tolerance : float , optional
|
5766
|
-
The desired tolerance.
|
5757
|
+
The desired tolerance. Default is 0.0001.
|
5767
5758
|
|
5768
5759
|
Returns
|
5769
5760
|
-------
|
@@ -5806,26 +5797,26 @@ class Graph:
|
|
5806
5797
|
graph : topologic_core.Graph
|
5807
5798
|
The input graph.
|
5808
5799
|
vertices : list , optional
|
5809
|
-
The input list of vertices.
|
5800
|
+
The input list of vertices. Default is None which means all graph vertices are computed.
|
5810
5801
|
normalize : bool , optional
|
5811
|
-
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not.
|
5802
|
+
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not. Default is False.
|
5812
5803
|
weightKey : str , optional
|
5813
5804
|
If specified, the value in the connected edges' dictionary specified by the weightKey string will be aggregated to calculate
|
5814
5805
|
the vertex degree. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
5815
5806
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
5816
5807
|
key : str , optional
|
5817
|
-
The dictionary key under which to store the connectivity score.
|
5808
|
+
The dictionary key under which to store the connectivity score. Default is "connectivity".
|
5818
5809
|
colorKey : str , optional
|
5819
|
-
The desired dictionary key under which to store the connectivity color.
|
5810
|
+
The desired dictionary key under which to store the connectivity color. Default is "cn_color".
|
5820
5811
|
colorScale : str , optional
|
5821
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
5812
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
5822
5813
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
5823
5814
|
mantissa : int , optional
|
5824
|
-
The
|
5815
|
+
The number of decimal places to round the result to. Default is 6.
|
5825
5816
|
tolerance : float , optional
|
5826
|
-
The desired tolerance.
|
5817
|
+
The desired tolerance. Default is 0.0001.
|
5827
5818
|
silent : bool , optional
|
5828
|
-
If set to True, error and warning messages are suppressed.
|
5819
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5829
5820
|
|
5830
5821
|
Returns
|
5831
5822
|
-------
|
@@ -5856,7 +5847,7 @@ class Graph:
|
|
5856
5847
|
edge : topologic_core.Edge
|
5857
5848
|
The input edge.
|
5858
5849
|
tolerance : float , optional
|
5859
|
-
The desired tolerance.
|
5850
|
+
The desired tolerance. Default is 0.0001.
|
5860
5851
|
|
5861
5852
|
Returns
|
5862
5853
|
-------
|
@@ -5886,7 +5877,7 @@ class Graph:
|
|
5886
5877
|
vertex : topologic_core.Vertex
|
5887
5878
|
The input Vertex.
|
5888
5879
|
tolerance : float , optional
|
5889
|
-
Ther desired tolerance.
|
5880
|
+
Ther desired tolerance. Default is 0.0001.
|
5890
5881
|
|
5891
5882
|
Returns
|
5892
5883
|
-------
|
@@ -5914,9 +5905,9 @@ class Graph:
|
|
5914
5905
|
graph : topologic_core.Graph
|
5915
5906
|
The input graph.
|
5916
5907
|
key : str , optional
|
5917
|
-
The vertex dictionary key under which to store the cut status. 0 means the vertex is NOT a cut vertex. 1 means that the vertex IS a cut vertex.
|
5908
|
+
The vertex dictionary key under which to store the cut status. 0 means the vertex is NOT a cut vertex. 1 means that the vertex IS a cut vertex. Default is "cut".
|
5918
5909
|
silent : bool , optional
|
5919
|
-
If set to True, error and warning messages are suppressed.
|
5910
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
5920
5911
|
|
5921
5912
|
Returns
|
5922
5913
|
-------
|
@@ -5989,18 +5980,18 @@ class Graph:
|
|
5989
5980
|
the vertex degree. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
5990
5981
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
5991
5982
|
normalize : bool , optional
|
5992
|
-
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not.
|
5983
|
+
If set to True, the values are normalized to be in the range 0 to 1. Otherwise they are not. Default is False.
|
5993
5984
|
key : str , optional
|
5994
|
-
The desired dictionary key under which to store the degree centrality score.
|
5985
|
+
The desired dictionary key under which to store the degree centrality score. Default is "degree_centrality".
|
5995
5986
|
colorKey : str , optional
|
5996
|
-
The desired dictionary key under which to store the degree centrality color.
|
5987
|
+
The desired dictionary key under which to store the degree centrality color. Default is "dc_color".
|
5997
5988
|
colorScale : str , optional
|
5998
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
5989
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
5999
5990
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
6000
5991
|
mantissa : int , optional
|
6001
|
-
The
|
5992
|
+
The number of decimal places to round the result to. Default is 6.
|
6002
5993
|
tolerance : float , optional
|
6003
|
-
The desired tolerance.
|
5994
|
+
The desired tolerance. Default is 0.0001.
|
6004
5995
|
|
6005
5996
|
Returns
|
6006
5997
|
-------
|
@@ -6122,11 +6113,11 @@ class Graph:
|
|
6122
6113
|
graph : topologic_core.Graph
|
6123
6114
|
The input graph.
|
6124
6115
|
vertex : topologic_core.Vertex , optional
|
6125
|
-
The input root vertex. If not set, the first vertex in the graph is set as the root vertex.
|
6116
|
+
The input root vertex. If not set, the first vertex in the graph is set as the root vertex. Default is None.
|
6126
6117
|
tolerance : float , optional
|
6127
|
-
The desired tolerance.
|
6118
|
+
The desired tolerance. Default is 0.0001.
|
6128
6119
|
silent : bool , optional
|
6129
|
-
If set to True, error and warning messages are suppressed.
|
6120
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
6130
6121
|
|
6131
6122
|
Returns
|
6132
6123
|
-------
|
@@ -6176,15 +6167,15 @@ class Graph:
|
|
6176
6167
|
graph : topologic_core.Graph
|
6177
6168
|
The input graph.
|
6178
6169
|
vertices : list , optional
|
6179
|
-
The input list of vertices.
|
6170
|
+
The input list of vertices. Default is None.
|
6180
6171
|
key : str , optional
|
6181
|
-
The dictionary key under which to store the depth score.
|
6172
|
+
The dictionary key under which to store the depth score. Default is "depth".
|
6182
6173
|
type : str , optional
|
6183
|
-
The type of depth distance to calculate. The options are "topological" or "metric".
|
6174
|
+
The type of depth distance to calculate. The options are "topological" or "metric". Default is "topological". See https://www.spacesyntax.online/overview-2/analysis-of-spatial-relations/.
|
6184
6175
|
mantissa : int , optional
|
6185
|
-
The
|
6176
|
+
The number of decimal places to round the result to. Default is 6.
|
6186
6177
|
tolerance : float , optional
|
6187
|
-
The desired tolerance.
|
6178
|
+
The desired tolerance. Default is 0.0001.
|
6188
6179
|
|
6189
6180
|
Returns
|
6190
6181
|
-------
|
@@ -6308,11 +6299,11 @@ class Graph:
|
|
6308
6299
|
vertexB : topologic_core.Vertex
|
6309
6300
|
The second input vertex.
|
6310
6301
|
type : str , optional
|
6311
|
-
The type of depth distance to calculate. The options are "topological" or "metric".
|
6302
|
+
The type of depth distance to calculate. The options are "topological" or "metric". Default is "topological". See https://www.spacesyntax.online/overview-2/analysis-of-spatial-relations/.
|
6312
6303
|
mantissa : int , optional
|
6313
|
-
The
|
6304
|
+
The number of decimal places to round the result to. Default is 6.
|
6314
6305
|
tolerance : float , optional
|
6315
|
-
The desired tolerance.
|
6306
|
+
The desired tolerance. Default is 0.0001.
|
6316
6307
|
|
6317
6308
|
Returns
|
6318
6309
|
-------
|
@@ -6352,7 +6343,7 @@ class Graph:
|
|
6352
6343
|
vertexB : topologic_core.Vertex
|
6353
6344
|
The second input Vertex.
|
6354
6345
|
tolerance : float , optional
|
6355
|
-
The desired tolerance.
|
6346
|
+
The desired tolerance. Default is 0.0001.
|
6356
6347
|
|
6357
6348
|
Returns
|
6358
6349
|
-------
|
@@ -6385,7 +6376,7 @@ class Graph:
|
|
6385
6376
|
vertices : list , optional
|
6386
6377
|
An optional list of vertices to restrict the returned list of edges only to those connected to this list.
|
6387
6378
|
tolerance : float , optional
|
6388
|
-
The desired tolerance.
|
6379
|
+
The desired tolerance. Default is 0.0001.
|
6389
6380
|
|
6390
6381
|
Returns
|
6391
6382
|
-------
|
@@ -6425,11 +6416,11 @@ class Graph:
|
|
6425
6416
|
weightKey : str, optional
|
6426
6417
|
Ignored in this implementation. Reserved for future use if weighted adjacency matrix is desired.
|
6427
6418
|
normalize : bool, optional
|
6428
|
-
If set to True, the centrality values are normalized to be in the range 0 to 1.
|
6419
|
+
If set to True, the centrality values are normalized to be in the range 0 to 1. Default is False.
|
6429
6420
|
key : str, optional
|
6430
|
-
The desired dictionary key under which to store the eigenvector centrality score.
|
6421
|
+
The desired dictionary key under which to store the eigenvector centrality score. Default is "eigen_vector_centrality".
|
6431
6422
|
colorKey : str, optional
|
6432
|
-
The desired dictionary key under which to store the eigenvector centrality color.
|
6423
|
+
The desired dictionary key under which to store the eigenvector centrality color. Default is "evc_color".
|
6433
6424
|
colorScale : str, optional
|
6434
6425
|
The desired type of Plotly color scale to use (e.g., "viridis", "plasma"). Default is "viridis".
|
6435
6426
|
For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
@@ -6579,32 +6570,32 @@ class Graph:
|
|
6579
6570
|
trix : Trix , RDF/XML-like format for RDF quads
|
6580
6571
|
nquads : N-Quads , N-Triples-like format for RDF quads
|
6581
6572
|
overwrite : bool , optional
|
6582
|
-
If set to True, any existing file is overwritten. Otherwise, it is not.
|
6573
|
+
If set to True, any existing file is overwritten. Otherwise, it is not. Default is False.
|
6583
6574
|
bidirectional : bool , optional
|
6584
|
-
If set to True, reverse relationships are created wherever possible. Otherwise, they are not.
|
6575
|
+
If set to True, reverse relationships are created wherever possible. Otherwise, they are not. Default is False.
|
6585
6576
|
includeAttributes : bool , optional
|
6586
|
-
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not.
|
6577
|
+
If set to True, the attributes associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
6587
6578
|
includeLabel : bool , optional
|
6588
|
-
If set to True, a label is attached to each node. Otherwise, it is not.
|
6579
|
+
If set to True, a label is attached to each node. Otherwise, it is not. Default is False.
|
6589
6580
|
includeGeometry : bool , optional
|
6590
|
-
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not.
|
6581
|
+
If set to True, the geometry associated with vertices in the graph are written out. Otherwise, they are not. Default is False.
|
6591
6582
|
siteLabel : str , optional
|
6592
|
-
The desired site label.
|
6583
|
+
The desired site label. Default is "Site_0001".
|
6593
6584
|
siteDictionary : dict , optional
|
6594
|
-
The dictionary of site attributes to include in the output.
|
6585
|
+
The dictionary of site attributes to include in the output. Default is None.
|
6595
6586
|
buildingLabel : str , optional
|
6596
|
-
The desired building label.
|
6587
|
+
The desired building label. Default is "Building_0001".
|
6597
6588
|
buildingDictionary : dict , optional
|
6598
|
-
The dictionary of building attributes to include in the output.
|
6589
|
+
The dictionary of building attributes to include in the output. Default is None.
|
6599
6590
|
storeyPrefix : str , optional
|
6600
|
-
The desired prefixed to use for each building storey.
|
6591
|
+
The desired prefixed to use for each building storey. Default is "Storey".
|
6601
6592
|
floorLevels : list , optional
|
6602
6593
|
The list of floor levels. This should be a numeric list, sorted from lowest to highest.
|
6603
6594
|
If not provided, floorLevels will be computed automatically based on the vertices' (zKey)) attribute. See below.
|
6604
6595
|
verticesKey : str , optional
|
6605
|
-
The desired key name to call vertices.
|
6596
|
+
The desired key name to call vertices. Default is "vertices".
|
6606
6597
|
edgesKey : str , optional
|
6607
|
-
The desired key name to call edges.
|
6598
|
+
The desired key name to call edges. Default is "edges".
|
6608
6599
|
vertexLabelKey : str , optional
|
6609
6600
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
6610
6601
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -6612,37 +6603,37 @@ class Graph:
|
|
6612
6603
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
6613
6604
|
Note: If edge labels are not unique, they will be forced to be unique.
|
6614
6605
|
sourceKey : str , optional
|
6615
|
-
The dictionary key used to store the source vertex.
|
6606
|
+
The dictionary key used to store the source vertex. Default is "source".
|
6616
6607
|
targetKey : str , optional
|
6617
|
-
The dictionary key used to store the target vertex.
|
6608
|
+
The dictionary key used to store the target vertex. Default is "target".
|
6618
6609
|
xKey : str , optional
|
6619
|
-
The desired key name to use for x-coordinates.
|
6610
|
+
The desired key name to use for x-coordinates. Default is "hasX".
|
6620
6611
|
yKey : str , optional
|
6621
|
-
The desired key name to use for y-coordinates.
|
6612
|
+
The desired key name to use for y-coordinates. Default is "hasY".
|
6622
6613
|
zKey : str , optional
|
6623
|
-
The desired key name to use for z-coordinates.
|
6614
|
+
The desired key name to use for z-coordinates. Default is "hasZ".
|
6624
6615
|
geometryKey : str , optional
|
6625
|
-
The desired key name to use for geometry.
|
6616
|
+
The desired key name to use for geometry. Default is "brep".
|
6626
6617
|
typeKey : str , optional
|
6627
|
-
The dictionary key to use to look up the type of the node.
|
6618
|
+
The dictionary key to use to look up the type of the node. Default is "type".
|
6628
6619
|
geometryKey : str , optional
|
6629
|
-
The dictionary key to use to look up the geometry of the node.
|
6620
|
+
The dictionary key to use to look up the geometry of the node. Default is "brep".
|
6630
6621
|
spaceType : str , optional
|
6631
|
-
The dictionary string value to use to look up vertices of type "space".
|
6622
|
+
The dictionary string value to use to look up vertices of type "space". Default is "space".
|
6632
6623
|
wallType : str , optional
|
6633
|
-
The dictionary string value to use to look up vertices of type "wall".
|
6624
|
+
The dictionary string value to use to look up vertices of type "wall". Default is "wall".
|
6634
6625
|
slabType : str , optional
|
6635
|
-
The dictionary string value to use to look up vertices of type "slab".
|
6626
|
+
The dictionary string value to use to look up vertices of type "slab". Default is "slab".
|
6636
6627
|
doorType : str , optional
|
6637
|
-
The dictionary string value to use to look up vertices of type "door".
|
6628
|
+
The dictionary string value to use to look up vertices of type "door". Default is "door".
|
6638
6629
|
windowType : str , optional
|
6639
|
-
The dictionary string value to use to look up vertices of type "window".
|
6630
|
+
The dictionary string value to use to look up vertices of type "window". Default is "window".
|
6640
6631
|
contentType : str , optional
|
6641
|
-
The dictionary string value to use to look up vertices of type "content".
|
6632
|
+
The dictionary string value to use to look up vertices of type "content". Default is "contents".
|
6642
6633
|
namespace : str , optional
|
6643
|
-
The desired namespace to use in the BOT graph.
|
6634
|
+
The desired namespace to use in the BOT graph. Default is "http://github.com/wassimj/topologicpy/resources".
|
6644
6635
|
mantissa : int , optional
|
6645
|
-
The
|
6636
|
+
The number of decimal places to round the result to. Default is 6.
|
6646
6637
|
|
6647
6638
|
Returns
|
6648
6639
|
-------
|
@@ -6748,81 +6739,81 @@ class Graph:
|
|
6748
6739
|
graphFeatures : str , optional
|
6749
6740
|
The input graph features. This is a single string of numeric features separated by commas. Example: "3.456, 2.011, 56.4". The defauly is "".
|
6750
6741
|
graphIDHeader : str , optional
|
6751
|
-
The desired graph ID column header.
|
6742
|
+
The desired graph ID column header. Default is "graph_id".
|
6752
6743
|
graphLabelHeader : str , optional
|
6753
|
-
The desired graph label column header.
|
6744
|
+
The desired graph label column header. Default is "label".
|
6754
6745
|
graphFeaturesHeader : str , optional
|
6755
|
-
The desired graph features column header.
|
6746
|
+
The desired graph features column header. Default is "feat".
|
6756
6747
|
edgeLabelKey : str , optional
|
6757
|
-
The edge label dictionary key saved in each graph edge.
|
6748
|
+
The edge label dictionary key saved in each graph edge. Default is "label".
|
6758
6749
|
defaultEdgeLabel : int , optional
|
6759
|
-
The default edge label to use if no edge label is found.
|
6750
|
+
The default edge label to use if no edge label is found. Default is 0.
|
6760
6751
|
edgeLabelHeader : str , optional
|
6761
|
-
The desired edge label column header.
|
6752
|
+
The desired edge label column header. Default is "label".
|
6762
6753
|
edgeSRCHeader : str , optional
|
6763
|
-
The desired edge source column header.
|
6754
|
+
The desired edge source column header. Default is "src_id".
|
6764
6755
|
edgeDSTHeader : str , optional
|
6765
|
-
The desired edge destination column header.
|
6756
|
+
The desired edge destination column header. Default is "dst_id".
|
6766
6757
|
edgeFeaturesHeader : str , optional
|
6767
|
-
The desired edge features column header.
|
6758
|
+
The desired edge features column header. Default is "feat".
|
6768
6759
|
edgeFeaturesKeys : list , optional
|
6769
|
-
The list of feature dictionary keys saved in the dicitonaries of edges.
|
6760
|
+
The list of feature dictionary keys saved in the dicitonaries of edges. Default is [].
|
6770
6761
|
edgeTrainMaskHeader : str , optional
|
6771
|
-
The desired edge train mask column header.
|
6762
|
+
The desired edge train mask column header. Default is "train_mask".
|
6772
6763
|
edgeValidateMaskHeader : str , optional
|
6773
|
-
The desired edge validate mask column header.
|
6764
|
+
The desired edge validate mask column header. Default is "val_mask".
|
6774
6765
|
edgeTestMaskHeader : str , optional
|
6775
|
-
The desired edge test mask column header.
|
6766
|
+
The desired edge test mask column header. Default is "test_mask".
|
6776
6767
|
edgeMaskKey : str , optional
|
6777
6768
|
The dictionary key where the edge train, validate, test category is to be found. The value should be 0 for train
|
6778
|
-
1 for validate, and 2 for test. If no key is found, the ratio of train/validate/test will be used.
|
6769
|
+
1 for validate, and 2 for test. If no key is found, the ratio of train/validate/test will be used. Default is "mask".
|
6779
6770
|
edgeTrainRatio : float , optional
|
6780
|
-
The desired ratio of the edge data to use for training. The number must be between 0 and 1.
|
6771
|
+
The desired ratio of the edge data to use for training. The number must be between 0 and 1. Default is 0.8 which means 80% of the data will be used for training.
|
6781
6772
|
This value is ignored if an edgeMaskKey is foud.
|
6782
6773
|
edgeValidateRatio : float , optional
|
6783
|
-
The desired ratio of the edge data to use for validation. The number must be between 0 and 1.
|
6774
|
+
The desired ratio of the edge data to use for validation. The number must be between 0 and 1. Default is 0.1 which means 10% of the data will be used for validation.
|
6784
6775
|
This value is ignored if an edgeMaskKey is foud.
|
6785
6776
|
edgeTestRatio : float , optional
|
6786
|
-
The desired ratio of the edge data to use for testing. The number must be between 0 and 1.
|
6777
|
+
The desired ratio of the edge data to use for testing. The number must be between 0 and 1. Default is 0.1 which means 10% of the data will be used for testing.
|
6787
6778
|
This value is ignored if an edgeMaskKey is foud.
|
6788
6779
|
bidirectional : bool , optional
|
6789
|
-
If set to True, a reversed edge will also be saved for each edge in the graph. Otherwise, it will not.
|
6780
|
+
If set to True, a reversed edge will also be saved for each edge in the graph. Otherwise, it will not. Default is True.
|
6790
6781
|
nodeFeaturesKeys : list , optional
|
6791
|
-
The list of features keys saved in the dicitonaries of nodes.
|
6782
|
+
The list of features keys saved in the dicitonaries of nodes. Default is [].
|
6792
6783
|
nodeLabelKey : str , optional
|
6793
|
-
The node label dictionary key saved in each graph vertex.
|
6784
|
+
The node label dictionary key saved in each graph vertex. Default is "label".
|
6794
6785
|
defaultNodeLabel : int , optional
|
6795
|
-
The default node label to use if no node label is found.
|
6786
|
+
The default node label to use if no node label is found. Default is 0.
|
6796
6787
|
nodeIDHeader : str , optional
|
6797
|
-
The desired node ID column header.
|
6788
|
+
The desired node ID column header. Default is "node_id".
|
6798
6789
|
nodeLabelHeader : str , optional
|
6799
|
-
The desired node label column header.
|
6790
|
+
The desired node label column header. Default is "label".
|
6800
6791
|
nodeFeaturesHeader : str , optional
|
6801
|
-
The desired node features column header.
|
6792
|
+
The desired node features column header. Default is "feat".
|
6802
6793
|
nodeTrainMaskHeader : str , optional
|
6803
|
-
The desired node train mask column header.
|
6794
|
+
The desired node train mask column header. Default is "train_mask".
|
6804
6795
|
nodeValidateMaskHeader : str , optional
|
6805
|
-
The desired node validate mask column header.
|
6796
|
+
The desired node validate mask column header. Default is "val_mask".
|
6806
6797
|
nodeTestMaskHeader : str , optional
|
6807
|
-
The desired node test mask column header.
|
6798
|
+
The desired node test mask column header. Default is "test_mask".
|
6808
6799
|
nodeMaskKey : str , optional
|
6809
6800
|
The dictionary key where the node train, validate, test category is to be found. The value should be 0 for train
|
6810
|
-
1 for validate, and 2 for test. If no key is found, the ratio of train/validate/test will be used.
|
6801
|
+
1 for validate, and 2 for test. If no key is found, the ratio of train/validate/test will be used. Default is "mask".
|
6811
6802
|
nodeTrainRatio : float , optional
|
6812
|
-
The desired ratio of the node data to use for training. The number must be between 0 and 1.
|
6803
|
+
The desired ratio of the node data to use for training. The number must be between 0 and 1. Default is 0.8 which means 80% of the data will be used for training.
|
6813
6804
|
This value is ignored if an nodeMaskKey is foud.
|
6814
6805
|
nodeValidateRatio : float , optional
|
6815
|
-
The desired ratio of the node data to use for validation. The number must be between 0 and 1.
|
6806
|
+
The desired ratio of the node data to use for validation. The number must be between 0 and 1. Default is 0.1 which means 10% of the data will be used for validation.
|
6816
6807
|
This value is ignored if an nodeMaskKey is foud.
|
6817
6808
|
nodeTestRatio : float , optional
|
6818
|
-
The desired ratio of the node data to use for testing. The number must be between 0 and 1.
|
6809
|
+
The desired ratio of the node data to use for testing. The number must be between 0 and 1. Default is 0.1 which means 10% of the data will be used for testing.
|
6819
6810
|
This value is ignored if an nodeMaskKey is foud.
|
6820
6811
|
mantissa : int , optional
|
6821
|
-
The
|
6812
|
+
The number of decimal places to round the result to. Default is 6.
|
6822
6813
|
tolerance : float , optional
|
6823
|
-
The desired tolerance.
|
6814
|
+
The desired tolerance. Default is 0.0001.
|
6824
6815
|
overwrite : bool , optional
|
6825
|
-
If set to True, any existing files are overwritten. Otherwise, the input list of graphs is appended to the end of each file.
|
6816
|
+
If set to True, any existing files are overwritten. Otherwise, the input list of graphs is appended to the end of each file. Default is False.
|
6826
6817
|
|
6827
6818
|
Returns
|
6828
6819
|
-------
|
@@ -7106,45 +7097,45 @@ class Graph:
|
|
7106
7097
|
path : str
|
7107
7098
|
The desired path to the output folder where the graphs, edges, and nodes CSV files will be saved.
|
7108
7099
|
graphWidth : float or int , optional
|
7109
|
-
The desired graph width.
|
7100
|
+
The desired graph width. Default is 20.
|
7110
7101
|
graphLength : float or int , optional
|
7111
|
-
The desired graph length.
|
7102
|
+
The desired graph length. Default is 20.
|
7112
7103
|
graphHeight : float or int , optional
|
7113
|
-
The desired graph height.
|
7104
|
+
The desired graph height. Default is 20.
|
7114
7105
|
defaultVertexColor : str , optional
|
7115
|
-
The desired default vertex color.
|
7106
|
+
The desired default vertex color. Default is "black".
|
7116
7107
|
defaultVertexSize : float or int , optional
|
7117
|
-
The desired default vertex size.
|
7108
|
+
The desired default vertex size. Default is 3.
|
7118
7109
|
defaultEdgeColor : str , optional
|
7119
|
-
The desired default edge color.
|
7110
|
+
The desired default edge color. Default is "black".
|
7120
7111
|
defaultEdgeWeight : float or int , optional
|
7121
|
-
The desired default edge weight. The edge weight determines the width of the displayed edge.
|
7112
|
+
The desired default edge weight. The edge weight determines the width of the displayed edge. Default is 3.
|
7122
7113
|
defaultEdgeType : str , optional
|
7123
|
-
The desired default edge type. This can be one of "directed" or "undirected".
|
7114
|
+
The desired default edge type. This can be one of "directed" or "undirected". Default is "undirected".
|
7124
7115
|
vertexLabelKey : str , optional
|
7125
7116
|
If specified, the vertex dictionary is searched for this key to determine the vertex label. If not specified
|
7126
|
-
the vertex label being is set to "Node X" where is X is a unique number.
|
7117
|
+
the vertex label being is set to "Node X" where is X is a unique number. Default is None.
|
7127
7118
|
vertexColorKey : str , optional
|
7128
7119
|
If specified, the vertex dictionary is searched for this key to determine the vertex color. If not specified
|
7129
|
-
the vertex color is set to the value defined by defaultVertexColor parameter.
|
7120
|
+
the vertex color is set to the value defined by defaultVertexColor parameter. Default is None.
|
7130
7121
|
vertexSizeKey : str , optional
|
7131
7122
|
If specified, the vertex dictionary is searched for this key to determine the vertex size. If not specified
|
7132
|
-
the vertex size is set to the value defined by defaultVertexSize parameter.
|
7123
|
+
the vertex size is set to the value defined by defaultVertexSize parameter. Default is None.
|
7133
7124
|
edgeLabelKey : str , optional
|
7134
7125
|
If specified, the edge dictionary is searched for this key to determine the edge label. If not specified
|
7135
|
-
the edge label being is set to "Edge X" where is X is a unique number.
|
7126
|
+
the edge label being is set to "Edge X" where is X is a unique number. Default is None.
|
7136
7127
|
edgeColorKey : str , optional
|
7137
7128
|
If specified, the edge dictionary is searched for this key to determine the edge color. If not specified
|
7138
|
-
the edge color is set to the value defined by defaultEdgeColor parameter.
|
7129
|
+
the edge color is set to the value defined by defaultEdgeColor parameter. Default is None.
|
7139
7130
|
edgeWeightKey : str , optional
|
7140
7131
|
If specified, the edge dictionary is searched for this key to determine the edge weight. If not specified
|
7141
|
-
the edge weight is set to the value defined by defaultEdgeWeight parameter.
|
7132
|
+
the edge weight is set to the value defined by defaultEdgeWeight parameter. Default is None.
|
7142
7133
|
overwrite : bool , optional
|
7143
|
-
If set to True, any existing file is overwritten. Otherwise, it is not.
|
7134
|
+
If set to True, any existing file is overwritten. Otherwise, it is not. Default is False.
|
7144
7135
|
mantissa : int , optional
|
7145
|
-
The
|
7136
|
+
The number of decimal places to round the result to. Default is 6.
|
7146
7137
|
tolerance : float , optional
|
7147
|
-
The desired tolerance.
|
7138
|
+
The desired tolerance. Default is 0.0001.
|
7148
7139
|
|
7149
7140
|
Returns
|
7150
7141
|
-------
|
@@ -7492,7 +7483,7 @@ class Graph:
|
|
7492
7483
|
path : str
|
7493
7484
|
The path to the output file (e.g., "output.gv").
|
7494
7485
|
device : str, optional
|
7495
|
-
The output format device, such as 'svg_inline', 'pdf', or 'png'.
|
7486
|
+
The output format device, such as 'svg_inline', 'pdf', or 'png'. Default is 'svg_inline'.
|
7496
7487
|
deviceKey : str, optional
|
7497
7488
|
Dictionary key to override the `device` value. Default is None.
|
7498
7489
|
scale : float, optional
|
@@ -7612,7 +7603,7 @@ class Graph:
|
|
7612
7603
|
overwrite : bool, optional
|
7613
7604
|
If True, overwrites existing files at the given path. Default is False.
|
7614
7605
|
silent : bool, optional
|
7615
|
-
If True,
|
7606
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
7616
7607
|
|
7617
7608
|
Returns
|
7618
7609
|
-------
|
@@ -7694,9 +7685,9 @@ class Graph:
|
|
7694
7685
|
path : str
|
7695
7686
|
The path to the JSON file.
|
7696
7687
|
verticesKey : str , optional
|
7697
|
-
The desired key name to call vertices.
|
7688
|
+
The desired key name to call vertices. Default is "vertices".
|
7698
7689
|
edgesKey : str , optional
|
7699
|
-
The desired key name to call edges.
|
7690
|
+
The desired key name to call edges. Default is "edges".
|
7700
7691
|
vertexLabelKey : str , optional
|
7701
7692
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
7702
7693
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -7704,19 +7695,19 @@ class Graph:
|
|
7704
7695
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
7705
7696
|
Note: If edge labels are not unique, they will be forced to be unique.
|
7706
7697
|
xKey : str , optional
|
7707
|
-
The desired key name to use for x-coordinates.
|
7698
|
+
The desired key name to use for x-coordinates. Default is "x".
|
7708
7699
|
yKey : str , optional
|
7709
|
-
The desired key name to use for y-coordinates.
|
7700
|
+
The desired key name to use for y-coordinates. Default is "y".
|
7710
7701
|
zKey : str , optional
|
7711
|
-
The desired key name to use for z-coordinates.
|
7702
|
+
The desired key name to use for z-coordinates. Default is "z".
|
7712
7703
|
indent : int , optional
|
7713
|
-
The desired amount of indent spaces to use.
|
7704
|
+
The desired amount of indent spaces to use. Default is 4.
|
7714
7705
|
sortKeys : bool , optional
|
7715
|
-
If set to True, the keys will be sorted. Otherwise, they won't be.
|
7706
|
+
If set to True, the keys will be sorted. Otherwise, they won't be. Default is False.
|
7716
7707
|
mantissa : int , optional
|
7717
|
-
The
|
7708
|
+
The number of decimal places to round the result to. Default is 6.
|
7718
7709
|
overwrite : bool , optional
|
7719
|
-
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won't.
|
7710
|
+
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won't. Default is False.
|
7720
7711
|
|
7721
7712
|
Returns
|
7722
7713
|
-------
|
@@ -7762,9 +7753,9 @@ class Graph:
|
|
7762
7753
|
graph : topologic_core.Graph
|
7763
7754
|
The input graph
|
7764
7755
|
mantissa : int , optional
|
7765
|
-
The
|
7756
|
+
The number of decimal places to round the result to. Default is 6.
|
7766
7757
|
silent : bool , optional
|
7767
|
-
If set to True, error and warning messages are suppressed.
|
7758
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
7768
7759
|
|
7769
7760
|
Returns
|
7770
7761
|
-------
|
@@ -7793,14 +7784,14 @@ class Graph:
|
|
7793
7784
|
graph : topologicp.Graph
|
7794
7785
|
The input topologic graph.
|
7795
7786
|
key : str , optional
|
7796
|
-
The vertex and edge dictionary key under which to store the parition number.
|
7787
|
+
The vertex and edge dictionary key under which to store the parition number. Default is "partition".
|
7797
7788
|
Valid partition numbers start from 1. Cut edges receive a partition number of 0.
|
7798
7789
|
mantissa : int , optional
|
7799
|
-
The
|
7790
|
+
The number of decimal places to round the result to. Default is 6.
|
7800
7791
|
tolerance : float , optional
|
7801
|
-
The desired tolerance.
|
7792
|
+
The desired tolerance. Default is 0.0001.
|
7802
7793
|
silent : bool , optional
|
7803
|
-
|
7794
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
7804
7795
|
|
7805
7796
|
Returns
|
7806
7797
|
-------
|
@@ -7867,7 +7858,7 @@ class Graph:
|
|
7867
7858
|
graph : topologic_core.Graph
|
7868
7859
|
The input graph.
|
7869
7860
|
silent : bool , optional
|
7870
|
-
If set to True, error and warning messages are suppressed.
|
7861
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
7871
7862
|
|
7872
7863
|
Returns
|
7873
7864
|
-------
|
@@ -7899,7 +7890,7 @@ class Graph:
|
|
7899
7890
|
maxIterations : int , optional
|
7900
7891
|
This number limits the number of iterations to prevent the function from running indefinitely, particularly for very large or complex graphs.
|
7901
7892
|
silent : bool , optional
|
7902
|
-
If set to True, error and warning messages are suppressed.
|
7893
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
7903
7894
|
|
7904
7895
|
Returns
|
7905
7896
|
-------
|
@@ -8014,25 +8005,25 @@ class Graph:
|
|
8014
8005
|
If set to 'cluster 2D', or 'cluster 3D, the nodes will be clustered according to the 'key' input parameter. The overall radius of the cluster is determined by the size input parameter (radius = size/2)
|
8015
8006
|
The default is 'spring 2D'.
|
8016
8007
|
k : float, optional
|
8017
|
-
The desired spring constant to use for the attractive and repulsive forces.
|
8008
|
+
The desired spring constant to use for the attractive and repulsive forces. Default is 0.8.
|
8018
8009
|
seed : int , optional
|
8019
|
-
The desired random seed to use.
|
8010
|
+
The desired random seed to use. Default is None.
|
8020
8011
|
iterations : int , optional
|
8021
|
-
The desired maximum number of iterations to solve the forces in the 'spring' mode.
|
8012
|
+
The desired maximum number of iterations to solve the forces in the 'spring' mode. Default is 50.
|
8022
8013
|
rootVertex : topologic_core.Vertex , optional
|
8023
8014
|
The desired vertex to use as the root of the tree and radial layouts.
|
8024
8015
|
size : float , optional
|
8025
8016
|
The desired overall size of the graph.
|
8026
8017
|
sides : int , optional
|
8027
|
-
The desired number of sides of the circle layout option.
|
8018
|
+
The desired number of sides of the circle layout option. Default is 16
|
8028
8019
|
length : float, optional
|
8029
|
-
The desired horizontal length for the line layout option.
|
8020
|
+
The desired horizontal length for the line layout option. Default is 1.0.
|
8030
8021
|
key : string, optional
|
8031
|
-
The key under which to find the clustering value for the 'cluster_2d' and 'cluster_3d' options.
|
8022
|
+
The key under which to find the clustering value for the 'cluster_2d' and 'cluster_3d' options. Default is "".
|
8032
8023
|
tolerance : float , optional
|
8033
|
-
The desired tolerance.
|
8024
|
+
The desired tolerance. Default is 0.0001.
|
8034
8025
|
silent : bool , optional
|
8035
|
-
If set to True, error and warning messages are suppressed.
|
8026
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
8036
8027
|
|
8037
8028
|
Returns
|
8038
8029
|
-------
|
@@ -9075,7 +9066,7 @@ class Graph:
|
|
9075
9066
|
graph : topologic_core.Graph
|
9076
9067
|
The input graph.
|
9077
9068
|
device : str, optional
|
9078
|
-
The output format device, such as 'svg_inline', 'pdf', or 'png'.
|
9069
|
+
The output format device, such as 'svg_inline', 'pdf', or 'png'. Default is 'svg_inline'.
|
9079
9070
|
deviceKey : str, optional
|
9080
9071
|
Dictionary key to override the `device` value. Default is None.
|
9081
9072
|
scale : float, optional
|
@@ -9195,7 +9186,7 @@ class Graph:
|
|
9195
9186
|
overwrite : bool, optional
|
9196
9187
|
If True, overwrites existing files at the given path. Default is False.
|
9197
9188
|
silent : bool, optional
|
9198
|
-
If True,
|
9189
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
9199
9190
|
|
9200
9191
|
Returns
|
9201
9192
|
-------
|
@@ -9345,24 +9336,24 @@ class Graph:
|
|
9345
9336
|
["vertex", "edge", "wire", "face", "shell", "cell", "cellComplex"].
|
9346
9337
|
topDown : bool , optional
|
9347
9338
|
If set to True, the graph edges are directed from topologies to their subtopologies.
|
9348
|
-
Otherwise, they are directed from topologies to their supertopologies.
|
9339
|
+
Otherwise, they are directed from topologies to their supertopologies. Default is False.
|
9349
9340
|
minDistance : float , optional
|
9350
|
-
The desired minimum distance between the vertices of the graph.
|
9341
|
+
The desired minimum distance between the vertices of the graph. Default is 0.1.
|
9351
9342
|
vertexLabelKey: str , optional
|
9352
|
-
The desired vertex dictionary key under which to store a unique label (of the form Type_Index).
|
9343
|
+
The desired vertex dictionary key under which to store a unique label (of the form Type_Index). Default is "label".
|
9353
9344
|
vertexTypeKey: str , optional
|
9354
|
-
The desired vertex dictionary key under which to store the topology type (e.g. "vertex", "edge", "wire").
|
9345
|
+
The desired vertex dictionary key under which to store the topology type (e.g. "vertex", "edge", "wire"). Default is "type".
|
9355
9346
|
vertexColorKey: str , optional
|
9356
|
-
The desired vertex dictionary key under which to store the topology color.
|
9347
|
+
The desired vertex dictionary key under which to store the topology color. Default is "color".
|
9357
9348
|
colorScale : str , optional
|
9358
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
9349
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
9359
9350
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
9360
9351
|
storeBREP : bool , optional
|
9361
|
-
If set to True, store the BRep of the topology in its representative vertex.
|
9352
|
+
If set to True, store the BRep of the topology in its representative vertex. Default is False.
|
9362
9353
|
tolerance : float
|
9363
|
-
The desired tolerance.
|
9354
|
+
The desired tolerance. Default is 0.0001.
|
9364
9355
|
silent : bool , optional
|
9365
|
-
|
9356
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
9366
9357
|
|
9367
9358
|
Returns
|
9368
9359
|
-------
|
@@ -9462,6 +9453,278 @@ class Graph:
|
|
9462
9453
|
return_graph = Graph.SetDictionary(return_graph, Topology.Dictionary(topology))
|
9463
9454
|
return return_graph
|
9464
9455
|
|
9456
|
+
|
9457
|
+
@staticmethod
|
9458
|
+
def HopperKernel(graphA,
|
9459
|
+
graphB,
|
9460
|
+
key: str = None,
|
9461
|
+
maxHops: int = 3,
|
9462
|
+
decay: float = 0.5,
|
9463
|
+
normalize: bool = True,
|
9464
|
+
mantissa: int = 6,
|
9465
|
+
silent: bool = False):
|
9466
|
+
"""
|
9467
|
+
Returns the Graph Hopper kernel between two graphs. This kernel compares hop-wise shortest-path
|
9468
|
+
frontiers between nodes in two graphs using an automatically selected node-level kernel:
|
9469
|
+
numeric Radial Basis Function (RBF) if the `key` values are numeric, categorical (delta) if the `key` values are non-numeric,
|
9470
|
+
or vertex degree if `key` is None or missing. See Vishwanathan et al. (2010) for path-based graph kernels.
|
9471
|
+
|
9472
|
+
Parameters
|
9473
|
+
----------
|
9474
|
+
graphA : topologic_core.Graph
|
9475
|
+
The first input graph.
|
9476
|
+
graphB : topologic_core.Graph
|
9477
|
+
The second input graph.
|
9478
|
+
key : str , optional
|
9479
|
+
The vertex dictionary key used to derive node features. If numeric for most vertices, a numeric
|
9480
|
+
RBF node kernel is used; if non-numeric, a delta node kernel is used. If None or missing, the
|
9481
|
+
vertex degree is used as a numeric feature. Default is None.
|
9482
|
+
maxHops : int , optional
|
9483
|
+
The maximum shortest-path hop distance to consider. Default is 3.
|
9484
|
+
decay : float , optional
|
9485
|
+
A per-hop geometric decay factor in the range (0, 1]. Default is 0.5.
|
9486
|
+
normalize : bool , optional
|
9487
|
+
If True, the kernel is cosine-normalized using self-kernel values so that identical graphs score 1.0.
|
9488
|
+
The default is True.
|
9489
|
+
mantissa : int , optional
|
9490
|
+
The number of decimal places to which to round the result. Default is 6.
|
9491
|
+
silent : bool , optional
|
9492
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
9493
|
+
|
9494
|
+
Returns
|
9495
|
+
-------
|
9496
|
+
float
|
9497
|
+
The (optionally normalized) Graph Hopper kernel value rounded to the specified mantissa.
|
9498
|
+
"""
|
9499
|
+
from math import sqrt, exp
|
9500
|
+
from statistics import median
|
9501
|
+
from topologicpy.Topology import Topology
|
9502
|
+
from topologicpy.Dictionary import Dictionary
|
9503
|
+
|
9504
|
+
# Validate graphs
|
9505
|
+
if not Topology.IsInstance(graphA, "Graph"):
|
9506
|
+
if not silent: print("Graph.HopperKernel - Error: The input graphA parameter is not a valid topologic graph. Returning None.")
|
9507
|
+
return None
|
9508
|
+
if not Topology.IsInstance(graphB, "Graph"):
|
9509
|
+
if not silent: print("Graph.HopperKernel - Error: The input graphB parameter is not a valid topologic graph. Returning None.")
|
9510
|
+
return None
|
9511
|
+
|
9512
|
+
# Clamp/clean params
|
9513
|
+
if maxHops < 0: maxHops = 0
|
9514
|
+
try:
|
9515
|
+
decay = float(decay)
|
9516
|
+
except Exception:
|
9517
|
+
decay = 0.5
|
9518
|
+
if decay <= 0: decay = 1.0 # no decay if mis-set
|
9519
|
+
|
9520
|
+
# Helpers
|
9521
|
+
def _vertices_and_index(G):
|
9522
|
+
V = Graph.Vertices(G) or []
|
9523
|
+
vidx = {v: i for i, v in enumerate(V)}
|
9524
|
+
return V, vidx
|
9525
|
+
|
9526
|
+
def _adj_lists(G, vidx):
|
9527
|
+
adj = {i: [] for i in vidx.values()}
|
9528
|
+
for v, i in vidx.items():
|
9529
|
+
nbrs = Graph.AdjacentVertices(G, v) or []
|
9530
|
+
adj[i] = sorted(vidx[n] for n in nbrs if n in vidx and n is not v)
|
9531
|
+
return adj
|
9532
|
+
|
9533
|
+
def _degree_features(adj):
|
9534
|
+
# one-dimensional numeric feature as a tuple
|
9535
|
+
return {i: (float(len(neigh)),) for i, neigh in adj.items()}
|
9536
|
+
|
9537
|
+
def _collect_key_values(G, V, vidx):
|
9538
|
+
# returns dict idx -> raw value or None
|
9539
|
+
vals = {}
|
9540
|
+
if key is None:
|
9541
|
+
return vals, 0, 0 # empty means fallback later
|
9542
|
+
found = 0
|
9543
|
+
nonnull = 0
|
9544
|
+
for v in V:
|
9545
|
+
d = Topology.Dictionary(v)
|
9546
|
+
val = Dictionary.ValueAtKey(d, key)
|
9547
|
+
if val is not None:
|
9548
|
+
nonnull += 1
|
9549
|
+
vals[vidx[v]] = val
|
9550
|
+
found += 1
|
9551
|
+
return vals, found, nonnull
|
9552
|
+
|
9553
|
+
def _infer_feature_mode(valsA, valsB):
|
9554
|
+
# Decide numeric vs label from available non-null values
|
9555
|
+
samples = []
|
9556
|
+
for d in (valsA, valsB):
|
9557
|
+
for val in d.values():
|
9558
|
+
if val is not None:
|
9559
|
+
samples.append(val)
|
9560
|
+
if not samples:
|
9561
|
+
return "degree" # fallback
|
9562
|
+
numeric = 0
|
9563
|
+
total = 0
|
9564
|
+
for x in samples:
|
9565
|
+
total += 1
|
9566
|
+
try:
|
9567
|
+
float(x)
|
9568
|
+
numeric += 1
|
9569
|
+
except Exception:
|
9570
|
+
pass
|
9571
|
+
frac = (numeric / total) if total else 0.0
|
9572
|
+
return "numeric" if frac >= 0.8 else "label"
|
9573
|
+
|
9574
|
+
def _features_from_key(mode, vals, adj):
|
9575
|
+
if mode == "numeric":
|
9576
|
+
# coerce to float, missing -> 0.0
|
9577
|
+
feats = {}
|
9578
|
+
for i in adj:
|
9579
|
+
v = vals.get(i, None)
|
9580
|
+
try:
|
9581
|
+
feats[i] = (float(v),)
|
9582
|
+
except Exception:
|
9583
|
+
feats[i] = (0.0,)
|
9584
|
+
return feats
|
9585
|
+
if mode == "label":
|
9586
|
+
labs = {}
|
9587
|
+
for i in adj:
|
9588
|
+
v = vals.get(i, None)
|
9589
|
+
labs[i] = str(v) if v is not None else "__MISSING__"
|
9590
|
+
return labs
|
9591
|
+
# degree fallback
|
9592
|
+
return _degree_features(adj)
|
9593
|
+
|
9594
|
+
def _shells_by_hops(adj, max_hops):
|
9595
|
+
# For each root, BFS layers up to max_hops. Returns list of lists of sets.
|
9596
|
+
n = len(adj)
|
9597
|
+
shells = [ [set() for _ in range(max_hops+1)] for _ in range(n) ]
|
9598
|
+
for root in range(n):
|
9599
|
+
visited = set([root])
|
9600
|
+
shells[root][0].add(root)
|
9601
|
+
frontier = [root]
|
9602
|
+
for h in range(1, max_hops+1):
|
9603
|
+
new_frontier = []
|
9604
|
+
for u in frontier:
|
9605
|
+
for w in adj[u]:
|
9606
|
+
if w not in visited:
|
9607
|
+
visited.add(w)
|
9608
|
+
new_frontier.append(w)
|
9609
|
+
if not new_frontier:
|
9610
|
+
break
|
9611
|
+
shells[root][h].update(new_frontier)
|
9612
|
+
frontier = new_frontier
|
9613
|
+
return shells
|
9614
|
+
|
9615
|
+
def _pairwise_median_sigma(pool):
|
9616
|
+
# pool is a list of numeric tuples
|
9617
|
+
vals = []
|
9618
|
+
m = len(pool)
|
9619
|
+
for i in range(m):
|
9620
|
+
xi = pool[i]
|
9621
|
+
for j in range(i+1, m):
|
9622
|
+
xj = pool[j]
|
9623
|
+
s = 0.0
|
9624
|
+
for a, b in zip(xi, xj):
|
9625
|
+
d = a - b
|
9626
|
+
s += d*d
|
9627
|
+
vals.append(sqrt(s))
|
9628
|
+
if not vals:
|
9629
|
+
return 1.0
|
9630
|
+
med = median(vals)
|
9631
|
+
return med if med > 0 else 1.0
|
9632
|
+
|
9633
|
+
# If Key is None, encode the degree centrality
|
9634
|
+
if key == None:
|
9635
|
+
_ = Graph.DegreeCentrality(graphA, key="_dc_")
|
9636
|
+
_ = Graph.DegreeCentrality(graphB, key="_dc_")
|
9637
|
+
key = "_dc_"
|
9638
|
+
|
9639
|
+
# Indexing and adjacency
|
9640
|
+
VA, idxA = _vertices_and_index(graphA)
|
9641
|
+
VB, idxB = _vertices_and_index(graphB)
|
9642
|
+
adjA = _adj_lists(graphA, idxA)
|
9643
|
+
adjB = _adj_lists(graphB, idxB)
|
9644
|
+
|
9645
|
+
# Build features according to key and data type
|
9646
|
+
valsA, _, _ = _collect_key_values(graphA, VA, idxA)
|
9647
|
+
valsB, _, _ = _collect_key_values(graphB, VB, idxB)
|
9648
|
+
mode = _infer_feature_mode(valsA, valsB) if key is not None else "degree"
|
9649
|
+
|
9650
|
+
featsA = _features_from_key(mode, valsA, adjA)
|
9651
|
+
featsB = _features_from_key(mode, valsB, adjB)
|
9652
|
+
|
9653
|
+
# Prepare shells
|
9654
|
+
shellsA = _shells_by_hops(adjA, maxHops)
|
9655
|
+
shellsB = _shells_by_hops(adjB, maxHops)
|
9656
|
+
|
9657
|
+
# Node kernels
|
9658
|
+
hopNormalize = True # fixed to reduce size bias
|
9659
|
+
|
9660
|
+
if mode == "label":
|
9661
|
+
def knode_AB(x, y):
|
9662
|
+
return 1.0 if featsA[x] == featsB[y] else 0.0
|
9663
|
+
def knode_AA(x, y):
|
9664
|
+
return 1.0 if featsA[x] == featsA[y] else 0.0
|
9665
|
+
def knode_BB(x, y):
|
9666
|
+
return 1.0 if featsB[x] == featsB[y] else 0.0
|
9667
|
+
else:
|
9668
|
+
# numeric RBF; estimate sigma from pooled features
|
9669
|
+
pool = list(featsA.values()) + list(featsB.values())
|
9670
|
+
sigma = _pairwise_median_sigma(pool)
|
9671
|
+
denom = 2.0 * (sigma * sigma)
|
9672
|
+
def _rbf(fX, fY):
|
9673
|
+
s = 0.0
|
9674
|
+
for a, b in zip(fX, fY):
|
9675
|
+
d = a - b
|
9676
|
+
s += d*d
|
9677
|
+
return exp(-s / denom) if denom > 0 else 0.0
|
9678
|
+
def knode_AB(x, y):
|
9679
|
+
return _rbf(featsA[x], featsB[y])
|
9680
|
+
def knode_AA(x, y):
|
9681
|
+
return _rbf(featsA[x], featsA[y])
|
9682
|
+
def knode_BB(x, y):
|
9683
|
+
return _rbf(featsB[x], featsB[y])
|
9684
|
+
|
9685
|
+
# Core kernel accumulation
|
9686
|
+
def _kernel_raw(shellsX, shellsY, knode_xy):
|
9687
|
+
total = 0.0
|
9688
|
+
nX = len(shellsX); nY = len(shellsY)
|
9689
|
+
for h in range(maxHops+1):
|
9690
|
+
hop_sum = 0.0
|
9691
|
+
for u in range(nX):
|
9692
|
+
Su = shellsX[u][h]
|
9693
|
+
if not Su:
|
9694
|
+
continue
|
9695
|
+
for v in range(nY):
|
9696
|
+
Sv = shellsY[v][h]
|
9697
|
+
if not Sv:
|
9698
|
+
continue
|
9699
|
+
inner = 0.0
|
9700
|
+
for x in Su:
|
9701
|
+
for y in Sv:
|
9702
|
+
inner += knode_xy(x, y)
|
9703
|
+
if hopNormalize:
|
9704
|
+
denom_local = float(len(Su) * len(Sv))
|
9705
|
+
if denom_local > 0:
|
9706
|
+
inner /= denom_local
|
9707
|
+
hop_sum += inner
|
9708
|
+
total += (decay ** h) * hop_sum
|
9709
|
+
return total
|
9710
|
+
|
9711
|
+
K_ab = _kernel_raw(shellsA, shellsB, knode_AB)
|
9712
|
+
|
9713
|
+
if not normalize:
|
9714
|
+
return round(float(K_ab), mantissa)
|
9715
|
+
|
9716
|
+
# Self-kernels for normalization
|
9717
|
+
K_aa = _kernel_raw(shellsA, shellsA, knode_AA)
|
9718
|
+
K_bb = _kernel_raw(shellsB, shellsB, knode_BB)
|
9719
|
+
|
9720
|
+
denom_norm = (K_aa * K_bb) ** 0.5
|
9721
|
+
value = float(K_ab) / denom_norm if denom_norm > 0 else 0.0
|
9722
|
+
# Cleanup keys and values that we encoded:
|
9723
|
+
if key == "_dc_":
|
9724
|
+
_ = [Topology.SetDictionary(v, Dictionary.RemoveKey(Topology.Dictionary(v), "_dc_")) for v in Graph.Vertices(graphA)]
|
9725
|
+
_ = [Topology.SetDictionary(v, Dictionary.RemoveKey(Topology.Dictionary(v), "_dc_")) for v in Graph.Vertices(graphB)]
|
9726
|
+
return round(value, mantissa)
|
9727
|
+
|
9465
9728
|
@staticmethod
|
9466
9729
|
def IncomingEdges(graph, vertex, directed: bool = False, tolerance: float = 0.0001) -> list:
|
9467
9730
|
"""
|
@@ -9475,9 +9738,9 @@ class Graph:
|
|
9475
9738
|
vertex : topologic_core.Vertex
|
9476
9739
|
The input vertex.
|
9477
9740
|
directed : bool , optional
|
9478
|
-
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph.
|
9741
|
+
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. Default is False.
|
9479
9742
|
tolerance : float , optional
|
9480
|
-
The desired tolerance.
|
9743
|
+
The desired tolerance. Default is 0.0001.
|
9481
9744
|
|
9482
9745
|
Returns
|
9483
9746
|
-------
|
@@ -9519,9 +9782,9 @@ class Graph:
|
|
9519
9782
|
vertex : topologic_core.Vertex
|
9520
9783
|
The input vertex.
|
9521
9784
|
directed : bool , optional
|
9522
|
-
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph.
|
9785
|
+
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. Default is False.
|
9523
9786
|
tolerance : float , optional
|
9524
|
-
The desired tolerance.
|
9787
|
+
The desired tolerance. Default is 0.0001.
|
9525
9788
|
|
9526
9789
|
Returns
|
9527
9790
|
-------
|
@@ -9588,11 +9851,11 @@ class Graph:
|
|
9588
9851
|
colorScale : str , optional
|
9589
9852
|
Plotly color scale name (e.g., "viridis", "plasma").
|
9590
9853
|
mantissa : int , optional
|
9591
|
-
The
|
9854
|
+
The number of decimal places to round the result to. Default is 6.
|
9592
9855
|
tolerance : float , optional
|
9593
|
-
The desired tolerance.
|
9856
|
+
The desired tolerance. Default is 0.0001.
|
9594
9857
|
silent : bool , optional
|
9595
|
-
If set to True, error and warning messages are suppressed.
|
9858
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
9596
9859
|
|
9597
9860
|
Returns
|
9598
9861
|
-------
|
@@ -9622,7 +9885,7 @@ class Graph:
|
|
9622
9885
|
graph : topologic_core.Graph
|
9623
9886
|
The input graph.
|
9624
9887
|
tolerance : float , optional
|
9625
|
-
The desired tolerance.
|
9888
|
+
The desired tolerance. Default is 0.0001.
|
9626
9889
|
|
9627
9890
|
Returns
|
9628
9891
|
-------
|
@@ -9730,7 +9993,7 @@ class Graph:
|
|
9730
9993
|
vertexB : topologic_core.Vertex
|
9731
9994
|
The second input vertex
|
9732
9995
|
silent : bool , optional
|
9733
|
-
If set to True, error and warning messages are suppressed.
|
9996
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
9734
9997
|
|
9735
9998
|
Returns
|
9736
9999
|
-------
|
@@ -9875,25 +10138,25 @@ class Graph:
|
|
9875
10138
|
context : dict, optional
|
9876
10139
|
A JSON-LD context mapping TopologicPy keys to IRIs (e.g., schema.org, geo, etc.).
|
9877
10140
|
verticesKey : str , optional
|
9878
|
-
The desired key name to call vertices.
|
10141
|
+
The desired key name to call vertices. Default is "vertices".
|
9879
10142
|
edgesKey : str , optional
|
9880
|
-
The desired key name to call edges.
|
10143
|
+
The desired key name to call edges. Default is "edges".
|
9881
10144
|
labelKey : str , optional
|
9882
|
-
The desired key name to use for label.
|
10145
|
+
The desired key name to use for label. Default is "label".
|
9883
10146
|
sourceKey : str , optional
|
9884
|
-
The desired key name to use for source.
|
10147
|
+
The desired key name to use for source. Default is "source".
|
9885
10148
|
targetKey : str , optional
|
9886
|
-
The desired key name to use for target.
|
10149
|
+
The desired key name to use for target. Default is "target".
|
9887
10150
|
categoryKey : str , optional
|
9888
|
-
The desired key name to use for lcategoryabel.
|
10151
|
+
The desired key name to use for lcategoryabel. Default is "category".
|
9889
10152
|
xKey : str , optional
|
9890
|
-
The desired key name to use for x-coordinates.
|
10153
|
+
The desired key name to use for x-coordinates. Default is "x".
|
9891
10154
|
yKey : str , optional
|
9892
|
-
The desired key name to use for y-coordinates.
|
10155
|
+
The desired key name to use for y-coordinates. Default is "y".
|
9893
10156
|
zKey : str , optional
|
9894
|
-
The desired key name to use for z-coordinates.
|
10157
|
+
The desired key name to use for z-coordinates. Default is "z".
|
9895
10158
|
mantissa : int , optional
|
9896
|
-
The
|
10159
|
+
The number of decimal places to round the result to. Default is 6.
|
9897
10160
|
|
9898
10161
|
Returns
|
9899
10162
|
-------
|
@@ -9985,29 +10248,29 @@ class Graph:
|
|
9985
10248
|
context : dict, optional
|
9986
10249
|
A JSON-LD context mapping TopologicPy keys to IRIs (e.g., schema.org, geo, etc.).
|
9987
10250
|
verticesKey : str , optional
|
9988
|
-
The desired key name to call vertices.
|
10251
|
+
The desired key name to call vertices. Default is "vertices".
|
9989
10252
|
edgesKey : str , optional
|
9990
|
-
The desired key name to call edges.
|
10253
|
+
The desired key name to call edges. Default is "edges".
|
9991
10254
|
labelKey : str , optional
|
9992
|
-
The desired key name to use for label.
|
10255
|
+
The desired key name to use for label. Default is "label".
|
9993
10256
|
sourceKey : str , optional
|
9994
|
-
The desired key name to use for source.
|
10257
|
+
The desired key name to use for source. Default is "source".
|
9995
10258
|
targetKey : str , optional
|
9996
|
-
The desired key name to use for target.
|
10259
|
+
The desired key name to use for target. Default is "target".
|
9997
10260
|
categoryKey : str , optional
|
9998
|
-
The desired key name to use for lcategoryabel.
|
10261
|
+
The desired key name to use for lcategoryabel. Default is "category".
|
9999
10262
|
xKey : str , optional
|
10000
|
-
The desired key name to use for x-coordinates.
|
10263
|
+
The desired key name to use for x-coordinates. Default is "x".
|
10001
10264
|
yKey : str , optional
|
10002
|
-
The desired key name to use for y-coordinates.
|
10265
|
+
The desired key name to use for y-coordinates. Default is "y".
|
10003
10266
|
zKey : str , optional
|
10004
|
-
The desired key name to use for z-coordinates.
|
10267
|
+
The desired key name to use for z-coordinates. Default is "z".
|
10005
10268
|
indent : int , optional
|
10006
|
-
The desired indent.
|
10269
|
+
The desired indent. Default is 2.
|
10007
10270
|
sortKeys : bool , optional
|
10008
|
-
If set to True, the keys will be sorted. Otherwise, they won't be.
|
10271
|
+
If set to True, the keys will be sorted. Otherwise, they won't be. Default is False.
|
10009
10272
|
mantissa : int , optional
|
10010
|
-
The
|
10273
|
+
The number of decimal places to round the result to. Default is 6.
|
10011
10274
|
Returns
|
10012
10275
|
-------
|
10013
10276
|
dict
|
@@ -10055,9 +10318,9 @@ class Graph:
|
|
10055
10318
|
path : str
|
10056
10319
|
The path to the JSON file.
|
10057
10320
|
verticesKey : str , optional
|
10058
|
-
The desired key name to call vertices.
|
10321
|
+
The desired key name to call vertices. Default is "vertices".
|
10059
10322
|
edgesKey : str , optional
|
10060
|
-
The desired key name to call edges.
|
10323
|
+
The desired key name to call edges. Default is "edges".
|
10061
10324
|
vertexLabelKey : str , optional
|
10062
10325
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
10063
10326
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -10065,19 +10328,19 @@ class Graph:
|
|
10065
10328
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
10066
10329
|
Note: If edge labels are not unique, they will be forced to be unique.
|
10067
10330
|
xKey : str , optional
|
10068
|
-
The desired key name to use for x-coordinates.
|
10331
|
+
The desired key name to use for x-coordinates. Default is "x".
|
10069
10332
|
yKey : str , optional
|
10070
|
-
The desired key name to use for y-coordinates.
|
10333
|
+
The desired key name to use for y-coordinates. Default is "y".
|
10071
10334
|
zKey : str , optional
|
10072
|
-
The desired key name to use for z-coordinates.
|
10335
|
+
The desired key name to use for z-coordinates. Default is "z".
|
10073
10336
|
indent : int , optional
|
10074
|
-
The desired amount of indent spaces to use.
|
10337
|
+
The desired amount of indent spaces to use. Default is 4.
|
10075
10338
|
sortKeys : bool , optional
|
10076
|
-
If set to True, the keys will be sorted. Otherwise, they won't be.
|
10339
|
+
If set to True, the keys will be sorted. Otherwise, they won't be. Default is False.
|
10077
10340
|
mantissa : int , optional
|
10078
|
-
The
|
10341
|
+
The number of decimal places to round the result to. Default is 6.
|
10079
10342
|
overwrite : bool , optional
|
10080
|
-
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won't.
|
10343
|
+
If set to True the ouptut file will overwrite any pre-existing file. Otherwise, it won't. Default is False.
|
10081
10344
|
|
10082
10345
|
Returns
|
10083
10346
|
-------
|
@@ -10146,9 +10409,9 @@ class Graph:
|
|
10146
10409
|
graph : topologic_core.Graph
|
10147
10410
|
The input graph.
|
10148
10411
|
verticesKey : str , optional
|
10149
|
-
The desired key name to call vertices.
|
10412
|
+
The desired key name to call vertices. Default is "vertices".
|
10150
10413
|
edgesKey : str , optional
|
10151
|
-
The desired key name to call edges.
|
10414
|
+
The desired key name to call edges. Default is "edges".
|
10152
10415
|
vertexLabelKey : str , optional
|
10153
10416
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
10154
10417
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -10156,21 +10419,21 @@ class Graph:
|
|
10156
10419
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
10157
10420
|
Note: If edge labels are not unique, they will be forced to be unique.
|
10158
10421
|
sourceKey : str , optional
|
10159
|
-
The dictionary key used to store the source vertex.
|
10422
|
+
The dictionary key used to store the source vertex. Default is "source".
|
10160
10423
|
targetKey : str , optional
|
10161
|
-
The dictionary key used to store the target vertex.
|
10424
|
+
The dictionary key used to store the target vertex. Default is "target".
|
10162
10425
|
xKey : str , optional
|
10163
|
-
The desired key name to use for x-coordinates.
|
10426
|
+
The desired key name to use for x-coordinates. Default is "x".
|
10164
10427
|
yKey : str , optional
|
10165
|
-
The desired key name to use for y-coordinates.
|
10428
|
+
The desired key name to use for y-coordinates. Default is "y".
|
10166
10429
|
zKey : str , optional
|
10167
|
-
The desired key name to use for z-coordinates.
|
10430
|
+
The desired key name to use for z-coordinates. Default is "z".
|
10168
10431
|
geometryKey : str , optional
|
10169
|
-
The desired key name to use for geometry.
|
10432
|
+
The desired key name to use for geometry. Default is "brep".
|
10170
10433
|
mantissa : int , optional
|
10171
|
-
The
|
10434
|
+
The number of decimal places to round the result to. Default is 6.
|
10172
10435
|
tolerance : float , optional
|
10173
|
-
The desired tolerance.
|
10436
|
+
The desired tolerance. Default is 0.0001.
|
10174
10437
|
|
10175
10438
|
Returns
|
10176
10439
|
-------
|
@@ -10263,9 +10526,9 @@ class Graph:
|
|
10263
10526
|
graph : topologic_core.Graph
|
10264
10527
|
The input graph.
|
10265
10528
|
verticesKey : str , optional
|
10266
|
-
The desired key name to call vertices.
|
10529
|
+
The desired key name to call vertices. Default is "vertices".
|
10267
10530
|
edgesKey : str , optional
|
10268
|
-
The desired key name to call edges.
|
10531
|
+
The desired key name to call edges. Default is "edges".
|
10269
10532
|
vertexLabelKey : str , optional
|
10270
10533
|
If set to a valid string, the vertex label will be set to the value at this key. Otherwise it will be set to Vertex_XXXX where XXXX is a sequential unique number.
|
10271
10534
|
Note: If vertex labels are not unique, they will be forced to be unique.
|
@@ -10273,17 +10536,17 @@ class Graph:
|
|
10273
10536
|
If set to a valid string, the edge label will be set to the value at this key. Otherwise it will be set to Edge_XXXX where XXXX is a sequential unique number.
|
10274
10537
|
Note: If edge labels are not unique, they will be forced to be unique.
|
10275
10538
|
xKey : str , optional
|
10276
|
-
The desired key name to use for x-coordinates.
|
10539
|
+
The desired key name to use for x-coordinates. Default is "x".
|
10277
10540
|
yKey : str , optional
|
10278
|
-
The desired key name to use for y-coordinates.
|
10541
|
+
The desired key name to use for y-coordinates. Default is "y".
|
10279
10542
|
zKey : str , optional
|
10280
|
-
The desired key name to use for z-coordinates.
|
10543
|
+
The desired key name to use for z-coordinates. Default is "z".
|
10281
10544
|
indent : int , optional
|
10282
|
-
The desired amount of indent spaces to use.
|
10545
|
+
The desired amount of indent spaces to use. Default is 4.
|
10283
10546
|
sortKeys : bool , optional
|
10284
|
-
If set to True, the keys will be sorted. Otherwise, they won't be.
|
10547
|
+
If set to True, the keys will be sorted. Otherwise, they won't be. Default is False.
|
10285
10548
|
mantissa : int , optional
|
10286
|
-
The
|
10549
|
+
The number of decimal places to round the result to. Default is 6.
|
10287
10550
|
|
10288
10551
|
Returns
|
10289
10552
|
-------
|
@@ -10296,6 +10559,92 @@ class Graph:
|
|
10296
10559
|
json_string = json.dumps(json_data, indent=indent, sort_keys=sortKeys)
|
10297
10560
|
return json_string
|
10298
10561
|
|
10562
|
+
@staticmethod
|
10563
|
+
def Kernel(graphA,
|
10564
|
+
graphB,
|
10565
|
+
method: str = "WL",
|
10566
|
+
key: str = None,
|
10567
|
+
iterations: int = 2,
|
10568
|
+
maxHops: int = 3,
|
10569
|
+
decay: float = 0.5,
|
10570
|
+
normalize: bool = True,
|
10571
|
+
mantissa: int = 6,
|
10572
|
+
silent: bool = False,
|
10573
|
+
**kwargs):
|
10574
|
+
"""
|
10575
|
+
Returns a graph-to-graph kernel value using the selected method. This is a
|
10576
|
+
convenience dispatcher over specific kernel implementations (e.g., WL and Hopper).
|
10577
|
+
|
10578
|
+
Parameters
|
10579
|
+
----------
|
10580
|
+
graphA : topologic_core.Graph
|
10581
|
+
The first input graph.
|
10582
|
+
graphB : topologic_core.Graph
|
10583
|
+
The second input graph.
|
10584
|
+
method : str , optional
|
10585
|
+
The kernel method to use. Supported values: "WL" (Weisfeiler–Lehman),
|
10586
|
+
"Hopper" (Graph Hopper). The default is "WL".
|
10587
|
+
key : str , optional
|
10588
|
+
A vertex dictionary key used by the selected method to derive node labels/features.
|
10589
|
+
For "WL", if None the vertex degree is used as the initial label. For "Hopper",
|
10590
|
+
if None or missing, the vertex degree is used as a numeric feature. Default is None.
|
10591
|
+
iterations : int , optional
|
10592
|
+
WL-specific parameter: number of WL iterations. Ignored by other methods. Default is 2.
|
10593
|
+
maxHops : int , optional
|
10594
|
+
Hopper-specific parameter: maximum shortest-path hop distance. Ignored by other methods. Default is 3.
|
10595
|
+
decay : float , optional
|
10596
|
+
Hopper-specific parameter: per-hop geometric decay in (0, 1]. Ignored by other methods. Default is 0.5.
|
10597
|
+
normalize : bool , optional
|
10598
|
+
If True, returns a normalized kernel score in [0, 1] when supported by the method. Default is True.
|
10599
|
+
mantissa : int , optional
|
10600
|
+
Number of decimal places for rounding the returned value. Default is 6.
|
10601
|
+
silent : bool , optional
|
10602
|
+
If True, error and warning messages are suppressed. Default is False.
|
10603
|
+
**kwargs
|
10604
|
+
Reserved for future method-specific options; ignored by current implementations.
|
10605
|
+
|
10606
|
+
Returns
|
10607
|
+
-------
|
10608
|
+
float
|
10609
|
+
The kernel value computed by the selected method, rounded to `mantissa`,
|
10610
|
+
or None if inputs are invalid or the method is unsupported.
|
10611
|
+
|
10612
|
+
Notes
|
10613
|
+
-----
|
10614
|
+
- "WL" calls `Graph.WLKernel(graphA, graphB, key=..., iterations=..., normalize=..., mantissa=...)`.
|
10615
|
+
- "Hopper" calls `Graph.HopperKernel(graphA, graphB, key=..., maxHops=..., decay=..., normalize=..., mantissa=...)`.
|
10616
|
+
- Method selection is case-insensitive and tolerates common aliases for WL.
|
10617
|
+
"""
|
10618
|
+
# Normalize method string and map aliases
|
10619
|
+
m = (method or "WL").strip().lower()
|
10620
|
+
if m in ("wl", "weisfeiler", "weisfeiler-lehman", "weisfeiler_lehman"):
|
10621
|
+
return Graph.WLKernel(
|
10622
|
+
graphA=graphA,
|
10623
|
+
graphB=graphB,
|
10624
|
+
key=key,
|
10625
|
+
iterations=iterations,
|
10626
|
+
normalize=normalize,
|
10627
|
+
mantissa=mantissa,
|
10628
|
+
silent=silent
|
10629
|
+
)
|
10630
|
+
elif m in ("hopper", "graphhopper", "graph_hopper"):
|
10631
|
+
return Graph.HopperKernel(
|
10632
|
+
graphA=graphA,
|
10633
|
+
graphB=graphB,
|
10634
|
+
key=key,
|
10635
|
+
maxHops=maxHops,
|
10636
|
+
decay=decay,
|
10637
|
+
normalize=normalize,
|
10638
|
+
mantissa=mantissa,
|
10639
|
+
silent=silent
|
10640
|
+
)
|
10641
|
+
else:
|
10642
|
+
if not silent:
|
10643
|
+
print(f'Graph.Kernel - Error: Unsupported method "{method}". '
|
10644
|
+
f'Supported methods are "WL" and "Hopper". Returning None.')
|
10645
|
+
return None
|
10646
|
+
|
10647
|
+
@staticmethod
|
10299
10648
|
def Laplacian(graph, silent: bool = False, normalized: bool = False):
|
10300
10649
|
"""
|
10301
10650
|
Returns the Laplacian matrix of the input graph. See https://en.wikipedia.org/wiki/Laplacian_matrix.
|
@@ -10305,9 +10654,9 @@ class Graph:
|
|
10305
10654
|
graph : topologic_core.Graph
|
10306
10655
|
The input graph.
|
10307
10656
|
silent : bool , optional
|
10308
|
-
If set to True, error and warning messages are suppressed.
|
10657
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
10309
10658
|
normalized : bool , optional
|
10310
|
-
If set to True, the returned Laplacian matrix is normalized.
|
10659
|
+
If set to True, the returned Laplacian matrix is normalized. Default is False.
|
10311
10660
|
|
10312
10661
|
Returns
|
10313
10662
|
-------
|
@@ -10365,11 +10714,11 @@ class Graph:
|
|
10365
10714
|
the vertex degree. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
10366
10715
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
10367
10716
|
mantissa : int , optional
|
10368
|
-
The
|
10717
|
+
The number of decimal places to round the result to. Default is 6.
|
10369
10718
|
tolerance : float , optional
|
10370
|
-
The desired tolerance.
|
10719
|
+
The desired tolerance. Default is 0.0001.
|
10371
10720
|
silent : bool , optional
|
10372
|
-
If set to True, error and warning messages are suppressed.
|
10721
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
10373
10722
|
|
10374
10723
|
Returns
|
10375
10724
|
-------
|
@@ -10399,9 +10748,9 @@ class Graph:
|
|
10399
10748
|
transferEdgeDictionaries : bool, optional
|
10400
10749
|
If set to True, the dictionaries of the edges of the input graph are transferred to the vertices of the line graph.
|
10401
10750
|
tolerance : float, optional
|
10402
|
-
The desired tolerance.
|
10751
|
+
The desired tolerance. Default is 0.0001.
|
10403
10752
|
silent : bool , optional
|
10404
|
-
If set to True, error and warning messages are suppressed.
|
10753
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
10405
10754
|
|
10406
10755
|
Returns
|
10407
10756
|
-------
|
@@ -10471,13 +10820,13 @@ class Graph:
|
|
10471
10820
|
graph : topologic_core.Graph
|
10472
10821
|
The input graph.
|
10473
10822
|
vertices : list , optional
|
10474
|
-
The input list of vertices. If set to None, the local clustering coefficient of all vertices will be computed.
|
10823
|
+
The input list of vertices. If set to None, the local clustering coefficient of all vertices will be computed. Default is None.
|
10475
10824
|
key : str , optional
|
10476
|
-
The dictionary key under which to store the local clustering coefficient score.
|
10825
|
+
The dictionary key under which to store the local clustering coefficient score. Default is "lcc".
|
10477
10826
|
mantissa : int , optional
|
10478
|
-
The
|
10827
|
+
The number of decimal places to round the result to. Default is 6.
|
10479
10828
|
tolerance : float , optional
|
10480
|
-
The desired tolerance.
|
10829
|
+
The desired tolerance. Default is 0.0001.
|
10481
10830
|
|
10482
10831
|
Returns
|
10483
10832
|
-------
|
@@ -10557,15 +10906,15 @@ class Graph:
|
|
10557
10906
|
vertexB : topologic_core.Vertex
|
10558
10907
|
The second input vertex.
|
10559
10908
|
vertexKey : str , optional
|
10560
|
-
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.
|
10909
|
+
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. Default is None.
|
10561
10910
|
edgeKey : str , optional
|
10562
|
-
The edge key to maximize. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed.
|
10911
|
+
The edge key to maximize. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed. Default is "length".
|
10563
10912
|
costKey : str , optional
|
10564
|
-
If not None, the total cost of the longest_path will be stored in its dictionary under this key.
|
10913
|
+
If not None, the total cost of the longest_path will be stored in its dictionary under this key. Default is None.
|
10565
10914
|
timeLimit : int , optional
|
10566
|
-
The time limit in second.
|
10915
|
+
The time limit in second. Default is 10 seconds.
|
10567
10916
|
tolerance : float , optional
|
10568
|
-
The desired tolerance.
|
10917
|
+
The desired tolerance. Default is 0.0001.
|
10569
10918
|
|
10570
10919
|
Returns
|
10571
10920
|
-------
|
@@ -10665,9 +11014,9 @@ class Graph:
|
|
10665
11014
|
edgeKeys : str or list of str, optional
|
10666
11015
|
Keys used to semantically compare edges.
|
10667
11016
|
maxMatches : int , optional
|
10668
|
-
The maximum number of matches to find.
|
11017
|
+
The maximum number of matches to find. Default is 10.
|
10669
11018
|
timeLimit : int , optional
|
10670
|
-
The time limit in seconds.
|
11019
|
+
The time limit in seconds. Default is 10 seconds. Note that this time limit only applies to finding the matches.
|
10671
11020
|
tolerance : float, optional
|
10672
11021
|
Allowed numeric deviation or minimum string similarity (e.g. 0.2 = ≥80% match). Default is 0.
|
10673
11022
|
silent : bool, optional
|
@@ -10951,17 +11300,17 @@ class Graph:
|
|
10951
11300
|
sink : topologic_core.Vertex
|
10952
11301
|
The input sink/target vertex.
|
10953
11302
|
edgeKeyFwd : str , optional
|
10954
|
-
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.
|
11303
|
+
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. Default is None.
|
10955
11304
|
edgeKeyBwd : str , optional
|
10956
|
-
The edge dictionary key to use to find the value of the backward capacity of the edge. This is only considered if the edge is set to be bidrectional.
|
11305
|
+
The edge dictionary key to use to find the value of the backward capacity of the edge. This is only considered if the edge is set to be bidrectional. Default is None.
|
10957
11306
|
bidirKey : str , optional
|
10958
|
-
The edge dictionary key to use to determine if the edge is bidrectional.
|
11307
|
+
The edge dictionary key to use to determine if the edge is bidrectional. Default is None.
|
10959
11308
|
bidrectional : bool , optional
|
10960
|
-
If set to True, the whole graph is considered to be bidirectional.
|
11309
|
+
If set to True, the whole graph is considered to be bidirectional. Default is False.
|
10961
11310
|
residualKey : str , optional
|
10962
|
-
The name of the key to use to store the residual value of each edge capacity in the input graph.
|
11311
|
+
The name of the key to use to store the residual value of each edge capacity in the input graph. Default is "residual".
|
10963
11312
|
tolerance : float , optional
|
10964
|
-
The desired tolerance.
|
11313
|
+
The desired tolerance. Default is 0.0001.
|
10965
11314
|
|
10966
11315
|
Returns
|
10967
11316
|
-------
|
@@ -11068,9 +11417,9 @@ class Graph:
|
|
11068
11417
|
transferDictionaries : bool, optional
|
11069
11418
|
If True, the dictionaries of all input vertices (including the target vertex if given) are merged. Default is True.
|
11070
11419
|
tolerance : float , optional
|
11071
|
-
The desired tolerance.
|
11420
|
+
The desired tolerance. Default is 0.0001.
|
11072
11421
|
silent : bool , optional
|
11073
|
-
If set to True, error and warning messages are suppressed.
|
11422
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
11074
11423
|
|
11075
11424
|
Returns
|
11076
11425
|
-------
|
@@ -11208,9 +11557,9 @@ class Graph:
|
|
11208
11557
|
graph : topologic_core.Graph
|
11209
11558
|
The input graph.
|
11210
11559
|
mantissa : int , optional
|
11211
|
-
The
|
11560
|
+
The number of decimal places to round the result to. Default is 6.
|
11212
11561
|
tolerance : float , optional
|
11213
|
-
The desired tolerance.
|
11562
|
+
The desired tolerance. Default is 0.0001.
|
11214
11563
|
|
11215
11564
|
Returns
|
11216
11565
|
-------
|
@@ -11266,9 +11615,9 @@ class Graph:
|
|
11266
11615
|
vertexB : topologic_core.Vertex
|
11267
11616
|
The second input vertex.
|
11268
11617
|
mantissa : int , optional
|
11269
|
-
The
|
11618
|
+
The number of decimal places to round the result to. Default is 6.
|
11270
11619
|
tolerance : float , optional
|
11271
|
-
The desired tolerance.
|
11620
|
+
The desired tolerance. Default is 0.0001.
|
11272
11621
|
|
11273
11622
|
Returns
|
11274
11623
|
-------
|
@@ -11331,9 +11680,9 @@ class Graph:
|
|
11331
11680
|
graph : topologic_core.Graph
|
11332
11681
|
The input graph.
|
11333
11682
|
edgeKey : string , optional
|
11334
|
-
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.
|
11683
|
+
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. Default is None
|
11335
11684
|
tolerance : float , optional
|
11336
|
-
The desired tolerance.
|
11685
|
+
The desired tolerance. Default is 0.0001.
|
11337
11686
|
|
11338
11687
|
Returns
|
11339
11688
|
-------
|
@@ -11399,9 +11748,9 @@ class Graph:
|
|
11399
11748
|
destinations : list
|
11400
11749
|
The input list of destinations (vertices). Navigation edges will connect these vertices to sources.
|
11401
11750
|
tolerance : float , optional
|
11402
|
-
The desired tolerance.
|
11751
|
+
The desired tolerance. Default is 0.0001.
|
11403
11752
|
numWorkers : int, optional
|
11404
|
-
Number of workers run in parallel to process.
|
11753
|
+
Number of workers run in parallel to process. Default is None which sets the number to twice the number of CPU cores.
|
11405
11754
|
|
11406
11755
|
Returns
|
11407
11756
|
-------
|
@@ -11543,17 +11892,17 @@ class Graph:
|
|
11543
11892
|
graph : topologic_core.Graph
|
11544
11893
|
The input graph.
|
11545
11894
|
xKey : str , optional
|
11546
|
-
The dictionary key under which to store the X-Coordinate of the vertex.
|
11895
|
+
The dictionary key under which to store the X-Coordinate of the vertex. Default is 'x'.
|
11547
11896
|
yKey : str , optional
|
11548
|
-
The dictionary key under which to store the Y-Coordinate of the vertex.
|
11897
|
+
The dictionary key under which to store the Y-Coordinate of the vertex. Default is 'y'.
|
11549
11898
|
zKey : str , optional
|
11550
|
-
The dictionary key under which to store the Z-Coordinate of the vertex.
|
11899
|
+
The dictionary key under which to store the Z-Coordinate of the vertex. Default is 'z'.
|
11551
11900
|
mantissa : int , optional
|
11552
|
-
The
|
11901
|
+
The number of decimal places to round the result to. Default is 6.
|
11553
11902
|
tolerance : float , optional
|
11554
|
-
The desired tolerance.
|
11903
|
+
The desired tolerance. Default is 0.0001.
|
11555
11904
|
silent : bool , optional
|
11556
|
-
If set to True, error and warning messages are suppressed.
|
11905
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
11557
11906
|
|
11558
11907
|
Returns
|
11559
11908
|
-------
|
@@ -11655,9 +12004,9 @@ class Graph:
|
|
11655
12004
|
vertex : topologic_core.Vertex
|
11656
12005
|
The input vertex.
|
11657
12006
|
directed : bool , optional
|
11658
|
-
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph.
|
12007
|
+
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. Default is False.
|
11659
12008
|
tolerance : float , optional
|
11660
|
-
The desired tolerance.
|
12009
|
+
The desired tolerance. Default is 0.0001.
|
11661
12010
|
|
11662
12011
|
Returns
|
11663
12012
|
-------
|
@@ -11699,9 +12048,9 @@ class Graph:
|
|
11699
12048
|
vertex : topologic_core.Vertex
|
11700
12049
|
The input vertex.
|
11701
12050
|
directed : bool , optional
|
11702
|
-
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph.
|
12051
|
+
If set to True, the graph is considered to be directed. Otherwise, it will be considered as an unidrected graph. Default is False.
|
11703
12052
|
tolerance : float , optional
|
11704
|
-
The desired tolerance.
|
12053
|
+
The desired tolerance. Default is 0.0001.
|
11705
12054
|
|
11706
12055
|
Returns
|
11707
12056
|
-------
|
@@ -11738,24 +12087,24 @@ class Graph:
|
|
11738
12087
|
graph : topologic_core.Graph
|
11739
12088
|
The input graph.
|
11740
12089
|
alpha : float , optional
|
11741
|
-
The damping (dampening) factor.
|
12090
|
+
The damping (dampening) factor. Default is 0.85. See https://en.wikipedia.org/wiki/PageRank.
|
11742
12091
|
maxIterations : int , optional
|
11743
|
-
The maximum number of iterations to calculate the page rank.
|
12092
|
+
The maximum number of iterations to calculate the page rank. Default is 100.
|
11744
12093
|
normalize : bool , optional
|
11745
|
-
If set to True, the results will be normalized from 0 to 1. Otherwise, they won't be.
|
12094
|
+
If set to True, the results will be normalized from 0 to 1. Otherwise, they won't be. Default is True.
|
11746
12095
|
directed : bool , optional
|
11747
|
-
If set to True, the graph is considered as a directed graph. Otherwise, it will be considered as an undirected graph.
|
12096
|
+
If set to True, the graph is considered as a directed graph. Otherwise, it will be considered as an undirected graph. Default is False.
|
11748
12097
|
key : str , optional
|
11749
|
-
The dictionary key under which to store the page_rank score.
|
12098
|
+
The dictionary key under which to store the page_rank score. Default is "page_rank"
|
11750
12099
|
colorKey : str , optional
|
11751
|
-
The desired dictionary key under which to store the pagerank color.
|
12100
|
+
The desired dictionary key under which to store the pagerank color. Default is "pr_color".
|
11752
12101
|
colorScale : str , optional
|
11753
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
12102
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
11754
12103
|
In addition to these, three color-blind friendly scales are included. These are "protanopia", "deuteranopia", and "tritanopia" for red, green, and blue colorblindness respectively.
|
11755
12104
|
mantissa : int , optional
|
11756
12105
|
The desired length of the mantissa.
|
11757
12106
|
tolerance : float , optional
|
11758
|
-
The desired tolerance.
|
12107
|
+
The desired tolerance. Default is 0.0001.
|
11759
12108
|
|
11760
12109
|
Returns
|
11761
12110
|
-------
|
@@ -11829,20 +12178,20 @@ class Graph:
|
|
11829
12178
|
- "Betweenness"
|
11830
12179
|
- "Community" or "Louvain"
|
11831
12180
|
- "Fiedler" or "Eigen"
|
11832
|
-
It is case insensitive.
|
12181
|
+
It is case insensitive. Default is "Betweenness"
|
11833
12182
|
n : int , optional
|
11834
|
-
The desired number of partitions when selecting the "Betweenness" method. This parameter is ignored for other methods.
|
12183
|
+
The desired number of partitions when selecting the "Betweenness" method. This parameter is ignored for other methods. Default is 2.
|
11835
12184
|
m : int , optional
|
11836
|
-
The desired maximum number of tries to partition the graph when selecting the "Betweenness" method. This parameter is ignored for other methods.
|
12185
|
+
The desired maximum number of tries to partition the graph when selecting the "Betweenness" method. This parameter is ignored for other methods. Default is 10.
|
11837
12186
|
key : str , optional
|
11838
|
-
The vertex and edge dictionary key under which to store the parition number.
|
12187
|
+
The vertex and edge dictionary key under which to store the parition number. Default is "partition".
|
11839
12188
|
Valid partition numbers start from 1. Cut edges receive a partition number of 0.
|
11840
12189
|
mantissa : int , optional
|
11841
|
-
The
|
12190
|
+
The number of decimal places to round the result to. Default is 6.
|
11842
12191
|
tolerance : float , optional
|
11843
|
-
The desired tolerance.
|
12192
|
+
The desired tolerance. Default is 0.0001.
|
11844
12193
|
silent : bool , optional
|
11845
|
-
If set to True, error and warning messages are suppressed.
|
12194
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
11846
12195
|
|
11847
12196
|
Returns
|
11848
12197
|
-------
|
@@ -11881,7 +12230,7 @@ class Graph:
|
|
11881
12230
|
vertexB : topologic_core.Vertex
|
11882
12231
|
The second input vertex.
|
11883
12232
|
tolerance : float, optional
|
11884
|
-
The desired tolerance.
|
12233
|
+
The desired tolerance. Default is 0.0001.
|
11885
12234
|
|
11886
12235
|
Returns
|
11887
12236
|
-------
|
@@ -11928,48 +12277,48 @@ class Graph:
|
|
11928
12277
|
overwrite : bool , optional
|
11929
12278
|
If set to True, the HTML file is overwritten.
|
11930
12279
|
height : int , optional
|
11931
|
-
The desired figure height in pixels.
|
12280
|
+
The desired figure height in pixels. Default is 900 pixels.
|
11932
12281
|
backgroundColor : str, optional
|
11933
|
-
The desired background color for the figure. This can be a named color or a hexadecimal value.
|
12282
|
+
The desired background color for the figure. This can be a named color or a hexadecimal value. Default is 'white'.
|
11934
12283
|
fontColor : str , optional
|
11935
|
-
The desired font color for the figure. This can be a named color or a hexadecimal value.
|
12284
|
+
The desired font color for the figure. This can be a named color or a hexadecimal value. Default is 'black'.
|
11936
12285
|
notebook : bool , optional
|
11937
|
-
If set to True, the figure will be targeted at a Jupyter Notebook. Note that this is not working well. Pyvis has bugs.
|
12286
|
+
If set to True, the figure will be targeted at a Jupyter Notebook. Note that this is not working well. Pyvis has bugs. Default is False.
|
11938
12287
|
vertexSize : int , optional
|
11939
|
-
The desired default vertex size.
|
12288
|
+
The desired default vertex size. Default is 6.
|
11940
12289
|
vertexSizeKey : str , optional
|
11941
|
-
If not set to None, the vertex size will be derived from the dictionary value set at this key. If set to "degree", the size of the vertex will be determined by its degree (number of neighbors).
|
12290
|
+
If not set to None, the vertex size will be derived from the dictionary value set at this key. If set to "degree", the size of the vertex will be determined by its degree (number of neighbors). Default is None.
|
11942
12291
|
vertexColor : str , optional
|
11943
|
-
The desired default vertex color. his can be a named color or a hexadecimal value.
|
12292
|
+
The desired default vertex color. his can be a named color or a hexadecimal value. Default is 'black'.
|
11944
12293
|
vertexColorKey : str , optional
|
11945
|
-
If not set to None, the vertex color will be derived from the dictionary value set at this key.
|
12294
|
+
If not set to None, the vertex color will be derived from the dictionary value set at this key. Default is None.
|
11946
12295
|
vertexLabelKey : str , optional
|
11947
|
-
If not set to None, the vertex label will be derived from the dictionary value set at this key.
|
12296
|
+
If not set to None, the vertex label will be derived from the dictionary value set at this key. Default is None.
|
11948
12297
|
vertexGroupKey : str , optional
|
11949
|
-
If not set to None, the vertex color will be determined by the group the vertex belongs to as derived from the value set at this key.
|
12298
|
+
If not set to None, the vertex color will be determined by the group the vertex belongs to as derived from the value set at this key. Default is None.
|
11950
12299
|
vertexGroups : list , optional
|
11951
|
-
The list of all possible vertex groups. This will help in vertex coloring.
|
12300
|
+
The list of all possible vertex groups. This will help in vertex coloring. Default is None.
|
11952
12301
|
minVertexGroup : int or float , optional
|
11953
|
-
If the vertex groups are numeric, specify the minimum value you wish to consider for vertex coloring.
|
12302
|
+
If the vertex groups are numeric, specify the minimum value you wish to consider for vertex coloring. Default is None.
|
11954
12303
|
maxVertexGroup : int or float , optional
|
11955
|
-
If the vertex groups are numeric, specify the maximum value you wish to consider for vertex coloring.
|
12304
|
+
If the vertex groups are numeric, specify the maximum value you wish to consider for vertex coloring. Default is None.
|
11956
12305
|
|
11957
12306
|
edgeWeight : int , optional
|
11958
|
-
The desired default weight of the edge. This determines its thickness.
|
12307
|
+
The desired default weight of the edge. This determines its thickness. Default is 0.
|
11959
12308
|
edgeWeightKey : str, optional
|
11960
|
-
If not set to None, the edge weight will be derived from the dictionary value set at this key. If set to "length" or "distance", the weight of the edge will be determined by its geometric length.
|
12309
|
+
If not set to None, the edge weight will be derived from the dictionary value set at this key. If set to "length" or "distance", the weight of the edge will be determined by its geometric length. Default is None.
|
11961
12310
|
edgeLabelKey : str , optional
|
11962
|
-
If not set to None, the edge label will be derived from the dictionary value set at this key.
|
12311
|
+
If not set to None, the edge label will be derived from the dictionary value set at this key. Default is None.
|
11963
12312
|
showNeighbors : bool , optional
|
11964
|
-
If set to True, a list of neighbors is shown when you hover over a vertex.
|
12313
|
+
If set to True, a list of neighbors is shown when you hover over a vertex. Default is True.
|
11965
12314
|
selectMenu : bool , optional
|
11966
|
-
If set to True, a selection menu will be displayed.
|
12315
|
+
If set to True, a selection menu will be displayed. Default is True
|
11967
12316
|
filterMenu : bool , optional
|
11968
|
-
If set to True, a filtering menu will be displayed.
|
12317
|
+
If set to True, a filtering menu will be displayed. Default is True.
|
11969
12318
|
colorScale : str , optional
|
11970
|
-
The desired type of plotly color scales to use (e.g. "viridis", "plasma").
|
12319
|
+
The desired type of plotly color scales to use (e.g. "viridis", "plasma"). Default is "viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
11971
12320
|
tolerance : float , optional
|
11972
|
-
The desired tolerance.
|
12321
|
+
The desired tolerance. Default is 0.0001.
|
11973
12322
|
Returns
|
11974
12323
|
-------
|
11975
12324
|
None
|
@@ -12121,7 +12470,7 @@ class Graph:
|
|
12121
12470
|
edge : topologic_core.Edge
|
12122
12471
|
The input edge.
|
12123
12472
|
tolerance : float , optional
|
12124
|
-
The desired tolerance.
|
12473
|
+
The desired tolerance. Default is 0.0001.
|
12125
12474
|
|
12126
12475
|
Returns
|
12127
12476
|
-------
|
@@ -12150,7 +12499,7 @@ class Graph:
|
|
12150
12499
|
graph : topologic_core.Graph
|
12151
12500
|
The input graph.
|
12152
12501
|
tolerance : float , optional
|
12153
|
-
The desired tolerance.
|
12502
|
+
The desired tolerance. Default is 0.0001.
|
12154
12503
|
|
12155
12504
|
Returns
|
12156
12505
|
-------
|
@@ -12177,7 +12526,7 @@ class Graph:
|
|
12177
12526
|
vertex : topologic_core.Vertex
|
12178
12527
|
The input vertex.
|
12179
12528
|
tolerance : float , optional
|
12180
|
-
The desired tolerance.
|
12529
|
+
The desired tolerance. Default is 0.0001.
|
12181
12530
|
|
12182
12531
|
Returns
|
12183
12532
|
-------
|
@@ -12246,11 +12595,11 @@ class Graph:
|
|
12246
12595
|
vertexB : topologic_core.Vertex
|
12247
12596
|
The second input vertex.
|
12248
12597
|
vertexKey : string , optional
|
12249
|
-
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.
|
12598
|
+
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. Default is None.
|
12250
12599
|
edgeKey : string , optional
|
12251
|
-
The edge key to minimise. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed.
|
12600
|
+
The edge key to minimise. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed. Default is "length".
|
12252
12601
|
tolerance : float , optional
|
12253
|
-
The desired tolerance.
|
12602
|
+
The desired tolerance. Default is 0.0001.
|
12254
12603
|
|
12255
12604
|
Returns
|
12256
12605
|
-------
|
@@ -12305,15 +12654,15 @@ class Graph:
|
|
12305
12654
|
vertexB : topologic_core.Vertex
|
12306
12655
|
The second input vertex.
|
12307
12656
|
vertexKey : string , optional
|
12308
|
-
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.
|
12657
|
+
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. Default is None.
|
12309
12658
|
edgeKey : string , optional
|
12310
|
-
The edge key to minimise. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed.
|
12659
|
+
The edge key to minimise. If set the edges 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 of the key must be numeric. If set to "length" (case insensitive), the shortest path by length is computed. Default is "length".
|
12311
12660
|
timeLimit : int , optional
|
12312
|
-
The search time limit in seconds.
|
12661
|
+
The search time limit in seconds. Default is 10 seconds
|
12313
12662
|
pathLimit: int , optional
|
12314
|
-
The number of found paths limit.
|
12663
|
+
The number of found paths limit. Default is 10 paths.
|
12315
12664
|
tolerance : float , optional
|
12316
|
-
The desired tolerance.
|
12665
|
+
The desired tolerance. Default is 0.0001.
|
12317
12666
|
|
12318
12667
|
Returns
|
12319
12668
|
-------
|
@@ -12416,14 +12765,14 @@ class Graph:
|
|
12416
12765
|
*graphs : topologic_core.Graph
|
12417
12766
|
One or more toplogic_core.graph objects.
|
12418
12767
|
sagitta : float , optional
|
12419
|
-
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.
|
12768
|
+
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. Default is 0 which means a straight edge is drawn instead of an arc. Default is 0.
|
12420
12769
|
absolute : bool , optional
|
12421
|
-
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.
|
12422
|
-
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.
|
12770
|
+
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. Default is False.
|
12771
|
+
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. Default is True.
|
12423
12772
|
sides : int , optional
|
12424
|
-
The number of sides of the arc.
|
12773
|
+
The number of sides of the arc. Default is 8.
|
12425
12774
|
angle : float, optional
|
12426
|
-
An additional angle in degrees to rotate arcs (where sagitta is more than 0).
|
12775
|
+
An additional angle in degrees to rotate arcs (where sagitta is more than 0). Default is 0.
|
12427
12776
|
vertexColor : str , optional
|
12428
12777
|
The desired color of the output vertices. This can be any plotly color string and may be specified as:
|
12429
12778
|
- A hex string (e.g. '#ff0000')
|
@@ -12433,27 +12782,27 @@ class Graph:
|
|
12433
12782
|
- A named CSS color.
|
12434
12783
|
The default is "black".
|
12435
12784
|
vertexColorKey : str , optional
|
12436
|
-
The dictionary key under which to find the vertex color.
|
12785
|
+
The dictionary key under which to find the vertex color. Default is None.
|
12437
12786
|
vertexSize : float , optional
|
12438
|
-
The desired size of the vertices.
|
12787
|
+
The desired size of the vertices. Default is 1.1.
|
12439
12788
|
vertexSizeKey : str , optional
|
12440
|
-
The dictionary key under which to find the vertex size.
|
12789
|
+
The dictionary key under which to find the vertex size. Default is None.
|
12441
12790
|
vertexLabelKey : str , optional
|
12442
|
-
The dictionary key to use to display the vertex label.
|
12791
|
+
The dictionary key to use to display the vertex label. Default is None.
|
12443
12792
|
vertexGroupKey : str , optional
|
12444
|
-
The dictionary key to use to display the vertex group.
|
12793
|
+
The dictionary key to use to display the vertex group. Default is None.
|
12445
12794
|
vertexGroups : list , optional
|
12446
|
-
The list of vertex groups against which to index the color of the vertex.
|
12795
|
+
The list of vertex groups against which to index the color of the vertex. Default is [].
|
12447
12796
|
vertexMinGroup : int or float , optional
|
12448
|
-
For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups.
|
12797
|
+
For numeric vertexGroups, vertexMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the minimum value in vertexGroups. Default is None.
|
12449
12798
|
vertexMaxGroup : int or float , optional
|
12450
|
-
For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups.
|
12799
|
+
For numeric vertexGroups, vertexMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the vertexGroupKey. If set to None, it is set to the maximum value in vertexGroups. Default is None.
|
12451
12800
|
showVertices : bool , optional
|
12452
|
-
If set to True the vertices will be drawn. Otherwise, they will not be drawn.
|
12801
|
+
If set to True the vertices will be drawn. Otherwise, they will not be drawn. Default is True.
|
12453
12802
|
showVertexLabel : bool , optional
|
12454
|
-
If set to True, the vertex labels are shown permenantely on screen. Otherwise, they are not.
|
12803
|
+
If set to True, the vertex labels are shown permenantely on screen. Otherwise, they are not. Default is False.
|
12455
12804
|
showVertexLegend : bool , optional
|
12456
|
-
If set to True the vertex legend will be drawn. Otherwise, it will not be drawn.
|
12805
|
+
If set to True the vertex legend will be drawn. Otherwise, it will not be drawn. Default is False.
|
12457
12806
|
edgeColor : str , optional
|
12458
12807
|
The desired color of the output edges. This can be any plotly color string and may be specified as:
|
12459
12808
|
- A hex string (e.g. '#ff0000')
|
@@ -12463,43 +12812,43 @@ class Graph:
|
|
12463
12812
|
- A named CSS color.
|
12464
12813
|
The default is "black".
|
12465
12814
|
edgeColorKey : str , optional
|
12466
|
-
The dictionary key under which to find the edge color.
|
12815
|
+
The dictionary key under which to find the edge color. Default is None.
|
12467
12816
|
edgeWidth : float , optional
|
12468
|
-
The desired thickness of the output edges.
|
12817
|
+
The desired thickness of the output edges. Default is 1.
|
12469
12818
|
edgeWidthKey : str , optional
|
12470
|
-
The dictionary key under which to find the edge width.
|
12819
|
+
The dictionary key under which to find the edge width. Default is None.
|
12471
12820
|
edgeLabelKey : str , optional
|
12472
|
-
The dictionary key to use to display the edge label.
|
12821
|
+
The dictionary key to use to display the edge label. Default is None.
|
12473
12822
|
edgeGroupKey : str , optional
|
12474
|
-
The dictionary key to use to display the edge group.
|
12823
|
+
The dictionary key to use to display the edge group. Default is None.
|
12475
12824
|
edgeGroups : list , optional
|
12476
|
-
The list of edge groups against which to index the color of the edge.
|
12825
|
+
The list of edge groups against which to index the color of the edge. Default is [].
|
12477
12826
|
edgeMinGroup : int or float , optional
|
12478
|
-
For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups.
|
12827
|
+
For numeric edgeGroups, edgeMinGroup is the desired minimum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the minimum value in edgeGroups. Default is None.
|
12479
12828
|
edgeMaxGroup : int or float , optional
|
12480
|
-
For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups.
|
12829
|
+
For numeric edgeGroups, edgeMaxGroup is the desired maximum value for the scaling of colors. This should match the type of value associated with the edgeGroupKey. If set to None, it is set to the maximum value in edgeGroups. Default is None.
|
12481
12830
|
showEdges : bool , optional
|
12482
|
-
If set to True the edges will be drawn. Otherwise, they will not be drawn.
|
12831
|
+
If set to True the edges will be drawn. Otherwise, they will not be drawn. Default is True.
|
12483
12832
|
showEdgeLabel : bool , optional
|
12484
|
-
If set to True, the edge labels are shown permenantely on screen. Otherwise, they are not.
|
12833
|
+
If set to True, the edge labels are shown permenantely on screen. Otherwise, they are not. Default is False.
|
12485
12834
|
showEdgeLegend : bool , optional
|
12486
|
-
If set to True the edge legend will be drawn. Otherwise, it will not be drawn.
|
12835
|
+
If set to True the edge legend will be drawn. Otherwise, it will not be drawn. Default is False.
|
12487
12836
|
colorScale : str , optional
|
12488
|
-
The desired type of plotly color scales to use (e.g. "Viridis", "Plasma").
|
12837
|
+
The desired type of plotly color scales to use (e.g. "Viridis", "Plasma"). Default is "Viridis". For a full list of names, see https://plotly.com/python/builtin-colorscales/.
|
12489
12838
|
renderer : str , optional
|
12490
|
-
The desired renderer. See Plotly.Renderers(). If set to None, the code will attempt to discover the most suitable renderer.
|
12839
|
+
The desired renderer. See Plotly.Renderers(). If set to None, the code will attempt to discover the most suitable renderer. Default is None.
|
12491
12840
|
width : int , optional
|
12492
12841
|
The width in pixels of the figure. The default value is 950.
|
12493
12842
|
height : int , optional
|
12494
12843
|
The height in pixels of the figure. The default value is 950.
|
12495
12844
|
xAxis : bool , optional
|
12496
|
-
If set to True the x axis is drawn. Otherwise it is not drawn.
|
12845
|
+
If set to True the x axis is drawn. Otherwise it is not drawn. Default is False.
|
12497
12846
|
yAxis : bool , optional
|
12498
|
-
If set to True the y axis is drawn. Otherwise it is not drawn.
|
12847
|
+
If set to True the y axis is drawn. Otherwise it is not drawn. Default is False.
|
12499
12848
|
zAxis : bool , optional
|
12500
|
-
If set to True the z axis is drawn. Otherwise it is not drawn.
|
12849
|
+
If set to True the z axis is drawn. Otherwise it is not drawn. Default is False.
|
12501
12850
|
axisSize : float , optional
|
12502
|
-
The size of the X, Y, Z, axes.
|
12851
|
+
The size of the X, Y, Z, axes. Default is 1.
|
12503
12852
|
backgroundColor : str , optional
|
12504
12853
|
The desired color of the background. This can be any plotly color string and may be specified as:
|
12505
12854
|
- A hex string (e.g. '#ff0000')
|
@@ -12517,17 +12866,17 @@ class Graph:
|
|
12517
12866
|
marginBottom : int , optional
|
12518
12867
|
The size in pixels of the bottom margin. The default value is 0.
|
12519
12868
|
camera : list , optional
|
12520
|
-
The desired location of the camera).
|
12869
|
+
The desired location of the camera). Default is [-1.25, -1.25, 1.25].
|
12521
12870
|
center : list , optional
|
12522
|
-
The desired center (camera target).
|
12871
|
+
The desired center (camera target). Default is [0, 0, 0].
|
12523
12872
|
up : list , optional
|
12524
|
-
The desired up vector.
|
12873
|
+
The desired up vector. Default is [0, 0, 1].
|
12525
12874
|
projection : str , optional
|
12526
|
-
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive.
|
12875
|
+
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. Default is "perspective"
|
12527
12876
|
tolerance : float , optional
|
12528
|
-
The desired tolerance.
|
12877
|
+
The desired tolerance. Default is 0.0001.
|
12529
12878
|
silent : bool , optional
|
12530
|
-
If set to True, error and warning messages are suppressed.
|
12879
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
12531
12880
|
|
12532
12881
|
Returns
|
12533
12882
|
-------
|
@@ -12617,14 +12966,14 @@ class Graph:
|
|
12617
12966
|
The input graph.
|
12618
12967
|
vertexKey : str , optional
|
12619
12968
|
The dictionary key under which to store the cut vertex status of each vertex. See https://en.wikipedia.org/wiki/Cut_(graph_theory).
|
12620
|
-
vertex cuts are indicated with a value of 1.
|
12969
|
+
vertex cuts are indicated with a value of 1. Default is "cutVertex".
|
12621
12970
|
edgeKey : str , optional
|
12622
12971
|
The dictionary key under which to store the cut edge status of each edge. See https://en.wikipedia.org/wiki/Cut_(graph_theory).
|
12623
|
-
edge cuts are indicated with a value of 1.
|
12972
|
+
edge cuts are indicated with a value of 1. Default is "cutVertex".
|
12624
12973
|
tolerance : float , optional
|
12625
|
-
The desired tolerance.
|
12974
|
+
The desired tolerance. Default is 0.0001.
|
12626
12975
|
silent : bool , optional
|
12627
|
-
If set to True, error and warning messages are suppressed.
|
12976
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
12628
12977
|
|
12629
12978
|
Returns
|
12630
12979
|
-------
|
@@ -12701,15 +13050,15 @@ class Graph:
|
|
12701
13050
|
superGraph : topologic_core.Graph
|
12702
13051
|
The input supergraph.
|
12703
13052
|
strict : bool , optional
|
12704
|
-
If set to True, each subgraph edge must be represented by a single edge in the supergraph. Otherwise, an edge in the subgraph can be represented either with an edge or a path in the supergraph.
|
13053
|
+
If set to True, each subgraph edge must be represented by a single edge in the supergraph. Otherwise, an edge in the subgraph can be represented either with an edge or a path in the supergraph. Default is False.
|
12705
13054
|
vertexMatcher : callable, optional
|
12706
13055
|
If specified, this function is called to check if two vertices are matched. The format must be vertex_matcher(sub_vertex, super_vertex, mantissa, tolerance) -> bool.
|
12707
13056
|
vertexKey : str , optional
|
12708
|
-
The dictionary key to use for vertex matching if the vertexMatcher input parameter is set to None.
|
13057
|
+
The dictionary key to use for vertex matching if the vertexMatcher input parameter is set to None. Default is "id".
|
12709
13058
|
mantissa : int , optional
|
12710
|
-
The
|
13059
|
+
The number of decimal places to round the result to. Default is 6.
|
12711
13060
|
tolerance : float , optional
|
12712
|
-
The desired tolerance.
|
13061
|
+
The desired tolerance. Default is 0.0001.
|
12713
13062
|
|
12714
13063
|
Returns
|
12715
13064
|
-------
|
@@ -12841,7 +13190,7 @@ class Graph:
|
|
12841
13190
|
vertexB : topologic_core.Vertex
|
12842
13191
|
The second input vertex.
|
12843
13192
|
tolerance : float , optional
|
12844
|
-
The desired tolerance.
|
13193
|
+
The desired tolerance. Default is 0.0001.
|
12845
13194
|
|
12846
13195
|
Returns
|
12847
13196
|
-------
|
@@ -12909,9 +13258,9 @@ class Graph:
|
|
12909
13258
|
graph : topologic_core.Graph
|
12910
13259
|
The input graph.
|
12911
13260
|
vertex : topologic_core.Vertex , optional
|
12912
|
-
The input root vertex. If not set, the first vertex in the graph is set as the root vertex.
|
13261
|
+
The input root vertex. If not set, the first vertex in the graph is set as the root vertex. Default is None.
|
12913
13262
|
tolerance : float , optional
|
12914
|
-
The desired tolerance.
|
13263
|
+
The desired tolerance. Default is 0.0001.
|
12915
13264
|
|
12916
13265
|
Returns
|
12917
13266
|
-------
|
@@ -12993,11 +13342,11 @@ class Graph:
|
|
12993
13342
|
the vertex degree. If a numeric value cannot be retrieved from an edge, a value of 1 is used instead.
|
12994
13343
|
This is used in weighted graphs. if weightKey is set to "Length" or "Distance", the length of the edge will be used as its weight.
|
12995
13344
|
mantissa : int , optional
|
12996
|
-
The
|
13345
|
+
The number of decimal places to round the result to. Default is 6.
|
12997
13346
|
tolerance : float , optional
|
12998
|
-
The desired tolerance.
|
13347
|
+
The desired tolerance. Default is 0.0001.
|
12999
13348
|
silent : bool , optional
|
13000
|
-
If set to True, error and warning messages are suppressed.
|
13349
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13001
13350
|
|
13002
13351
|
Returns
|
13003
13352
|
-------
|
@@ -13043,9 +13392,9 @@ class Graph:
|
|
13043
13392
|
graph : topologic_core.Graph
|
13044
13393
|
The input graph.
|
13045
13394
|
vertexKey : str , optional
|
13046
|
-
If set, the returned list of vertices is sorted according to the dicitonary values stored under this key.
|
13395
|
+
If set, the returned list of vertices is sorted according to the dicitonary values stored under this key. Default is None.
|
13047
13396
|
reverse : bool , optional
|
13048
|
-
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not.
|
13397
|
+
If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. Default is False.
|
13049
13398
|
|
13050
13399
|
Returns
|
13051
13400
|
-------
|
@@ -13087,11 +13436,11 @@ class Graph:
|
|
13087
13436
|
face : topologic_core.Face
|
13088
13437
|
The input boundary. View edges will be clipped to this face. The holes in the face are used as the obstacles
|
13089
13438
|
viewpointsA : list , optional
|
13090
|
-
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.
|
13439
|
+
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. Default is None.
|
13091
13440
|
viewpointsB : list , optional
|
13092
|
-
The input list of viewpoints (vertices). Visibility edges will connect these vertices to viewpointsA. If set to None, this parameters will be set to all vertices of the input face.
|
13441
|
+
The input list of viewpoints (vertices). Visibility edges will connect these vertices to viewpointsA. If set to None, this parameters will be set to all vertices of the input face. Default is None.
|
13093
13442
|
tolerance : float , optional
|
13094
|
-
The desired tolerance.
|
13443
|
+
The desired tolerance. Default is 0.0001.
|
13095
13444
|
|
13096
13445
|
Returns
|
13097
13446
|
-------
|
@@ -13183,15 +13532,15 @@ class Graph:
|
|
13183
13532
|
vertexB : topologic_core.Vertex
|
13184
13533
|
The second vertex.
|
13185
13534
|
vertexIDKey : str , optional
|
13186
|
-
The dictionary key under which to find the unique vertex ID.
|
13535
|
+
The dictionary key under which to find the unique vertex ID. Default is "id".
|
13187
13536
|
edgeWeightKey : str , optional
|
13188
13537
|
The dictionary key under which to find the weight of the edge for weighted graphs.
|
13189
13538
|
If this parameter is specified as "length" or "distance" then the length of the edge is used as its weight.
|
13190
13539
|
The default is None which means all edges are treated as if they have a weight of 1.
|
13191
13540
|
mantissa : int , optional
|
13192
|
-
The
|
13541
|
+
The number of decimal places to round the result to. Default is 6.
|
13193
13542
|
silent : bool , optional
|
13194
|
-
If set to True, error and warning messages are suppressed.
|
13543
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13195
13544
|
|
13196
13545
|
Returns
|
13197
13546
|
-------
|
@@ -13301,14 +13650,14 @@ class Graph:
|
|
13301
13650
|
vertexKeys : list or str , optional
|
13302
13651
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13303
13652
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13304
|
-
vertices (within the tolerance) will be used to determine sameness.
|
13653
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13305
13654
|
useCentroid : bool , optional
|
13306
13655
|
If set to True, the coordinates of identical vertices from each graph are averaged to located the new merged vertex of the resulting graph.
|
13307
|
-
Otherwise, the coordinates of the vertex of the first input graph are used.
|
13656
|
+
Otherwise, the coordinates of the vertex of the first input graph are used. Default is False.
|
13308
13657
|
tolerance : float , optional
|
13309
|
-
The desired tolerance.
|
13658
|
+
The desired tolerance. Default is 0.0001.
|
13310
13659
|
silent : bool , optional
|
13311
|
-
If set to True, error and warning messages are suppressed.
|
13660
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13312
13661
|
|
13313
13662
|
Returns
|
13314
13663
|
-------
|
@@ -13427,14 +13776,14 @@ class Graph:
|
|
13427
13776
|
vertexKeys : list or str , optional
|
13428
13777
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13429
13778
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13430
|
-
vertices (within the tolerance) will be used to determine sameness.
|
13779
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13431
13780
|
useCentroid : bool , optional
|
13432
13781
|
If set to True, the coordinates of identical vertices from each graph are averaged to located the new merged vertex of the resulting graph.
|
13433
|
-
Otherwise, the coordinates of the vertex of the second input graph are used.
|
13782
|
+
Otherwise, the coordinates of the vertex of the second input graph are used. Default is False.
|
13434
13783
|
tolerance : float , optional
|
13435
|
-
The desired tolerance.
|
13784
|
+
The desired tolerance. Default is 0.0001.
|
13436
13785
|
silent : bool , optional
|
13437
|
-
If set to True, error and warning messages are suppressed.
|
13786
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13438
13787
|
|
13439
13788
|
|
13440
13789
|
Returns
|
@@ -13550,14 +13899,14 @@ class Graph:
|
|
13550
13899
|
vertexKeys : list or str , optional
|
13551
13900
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13552
13901
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13553
|
-
vertices (within the tolerance) will be used to determine sameness.
|
13902
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13554
13903
|
useCentroid : bool , optional
|
13555
13904
|
If set to True, the coordinates of identical vertices from each graph are averaged to located the new merged vertex of the resulting graph.
|
13556
|
-
Otherwise, the coordinates of the vertex of the first input graph are used.
|
13905
|
+
Otherwise, the coordinates of the vertex of the first input graph are used. Default is False.
|
13557
13906
|
tolerance : float , optional
|
13558
|
-
The desired tolerance.
|
13907
|
+
The desired tolerance. Default is 0.0001.
|
13559
13908
|
silent : bool , optional
|
13560
|
-
If set to True, error and warning messages are suppressed.
|
13909
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13561
13910
|
|
13562
13911
|
Returns
|
13563
13912
|
-------
|
@@ -13659,14 +14008,14 @@ class Graph:
|
|
13659
14008
|
vertexKeys : list or str , optional
|
13660
14009
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13661
14010
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13662
|
-
vertices (within the tolerance) will be used to determine sameness.
|
14011
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13663
14012
|
useCentroid : bool , optional
|
13664
14013
|
If set to True, the coordinates of identical vertices from each graph are averaged to located the new merged vertex of the resulting graph.
|
13665
|
-
Otherwise, the coordinates of the vertex of the first input graph are used.
|
14014
|
+
Otherwise, the coordinates of the vertex of the first input graph are used. Default is False.
|
13666
14015
|
tolerance : float , optional
|
13667
|
-
The desired tolerance.
|
14016
|
+
The desired tolerance. Default is 0.0001.
|
13668
14017
|
silent : bool , optional
|
13669
|
-
If set to True, error and warning messages are suppressed.
|
14018
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13670
14019
|
|
13671
14020
|
Returns
|
13672
14021
|
-------
|
@@ -13768,13 +14117,13 @@ class Graph:
|
|
13768
14117
|
vertexKeys : list or str , optional
|
13769
14118
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13770
14119
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13771
|
-
vertices (within the tolerance) will be used to determine sameness.
|
14120
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13772
14121
|
useCentroid : bool , optional
|
13773
14122
|
This is not used here, but included for API consistency for boolean operations.
|
13774
14123
|
tolerance : float , optional
|
13775
|
-
The desired tolerance.
|
14124
|
+
The desired tolerance. Default is 0.0001.
|
13776
14125
|
silent : bool , optional
|
13777
|
-
If set to True, error and warning messages are suppressed.
|
14126
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13778
14127
|
|
13779
14128
|
Returns
|
13780
14129
|
-------
|
@@ -13847,16 +14196,16 @@ class Graph:
|
|
13847
14196
|
vertexKeys : list or str , optional
|
13848
14197
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13849
14198
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13850
|
-
vertices (within the tolerance) will be used to determine sameness.
|
14199
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13851
14200
|
vertexColorKey : str , optional
|
13852
|
-
The dictionary key that is storing the vertex's color. The final colors will be averaged.
|
14201
|
+
The dictionary key that is storing the vertex's color. The final colors will be averaged. Default is "color".
|
13853
14202
|
useCentroid : bool , optional
|
13854
14203
|
If set to True, the coordinates of identical vertices from each graph are averaged to located the new merged vertex of the resulting graph.
|
13855
|
-
Otherwise, the coordinates of the vertex of the first input graph are used.
|
14204
|
+
Otherwise, the coordinates of the vertex of the first input graph are used. Default is False.
|
13856
14205
|
tolerance : float , optional
|
13857
|
-
The desired tolerance.
|
14206
|
+
The desired tolerance. Default is 0.0001.
|
13858
14207
|
silent : bool , optional
|
13859
|
-
If set to True, error and warning messages are suppressed.
|
14208
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13860
14209
|
|
13861
14210
|
Returns
|
13862
14211
|
-------
|
@@ -13890,13 +14239,13 @@ class Graph:
|
|
13890
14239
|
vertexKeys : list or str , optional
|
13891
14240
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13892
14241
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13893
|
-
vertices (within the tolerance) will be used to determine sameness.
|
14242
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13894
14243
|
useCentroid : bool , optional
|
13895
14244
|
This is not used here, but included for API consistency for boolean operations.
|
13896
14245
|
tolerance : float , optional
|
13897
|
-
The desired tolerance.
|
14246
|
+
The desired tolerance. Default is 0.0001.
|
13898
14247
|
silent : bool , optional
|
13899
|
-
If set to True, error and warning messages are suppressed.
|
14248
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13900
14249
|
|
13901
14250
|
Returns
|
13902
14251
|
-------
|
@@ -13919,6 +14268,172 @@ class Graph:
|
|
13919
14268
|
diffBA = Graph.Difference(graphB, graphA, vertexKeys=vertexKeys, useCentroid=useCentroid, tolerance=tolerance, silent=True)
|
13920
14269
|
return Graph.Union(diffAB, diffBA, vertexKeys=vertexKeys, useCentroid=useCentroid, tolerance=tolerance, silent=True)
|
13921
14270
|
|
14271
|
+
@staticmethod
|
14272
|
+
def WLFeatures(graph, key: str = None, iterations: int = 2, silent: bool = False):
|
14273
|
+
"""
|
14274
|
+
Returns a Weisfeiler-Lehman subtree features for a Graph. See https://en.wikipedia.org/wiki/Weisfeiler_Leman_graph_isomorphism_test
|
14275
|
+
|
14276
|
+
Parameters
|
14277
|
+
----------
|
14278
|
+
graph : topologic_core.Graph
|
14279
|
+
The input graph.
|
14280
|
+
key : str , optional
|
14281
|
+
The vertex key to use as an initial label. Default is None which means the vertex degree is used instead.
|
14282
|
+
iterations : int , optional
|
14283
|
+
The desired number of WL iterations. (non-negative int). Default is 2.
|
14284
|
+
silent : bool, optional
|
14285
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
14286
|
+
|
14287
|
+
Returns
|
14288
|
+
-------
|
14289
|
+
dict
|
14290
|
+
{feature_id: count} where feature_id is an int representing a WL label.
|
14291
|
+
"""
|
14292
|
+
|
14293
|
+
from topologicpy.Topology import Topology
|
14294
|
+
from topologicpy.Dictionary import Dictionary
|
14295
|
+
from collections import defaultdict
|
14296
|
+
|
14297
|
+
def _neighbors_map(graph):
|
14298
|
+
"""
|
14299
|
+
Returns:
|
14300
|
+
vertices: list of vertex objects in a stable order
|
14301
|
+
vidx: dict mapping vertex -> index
|
14302
|
+
nbrs: dict index -> sorted list of neighbor indices
|
14303
|
+
"""
|
14304
|
+
vertices = Graph.Vertices(graph)
|
14305
|
+
vidx = {v: i for i, v in enumerate(vertices)}
|
14306
|
+
nbrs = {}
|
14307
|
+
for v in vertices:
|
14308
|
+
i = vidx[v]
|
14309
|
+
adj = Graph.AdjacentVertices(graph, v) or []
|
14310
|
+
nbrs[i] = sorted(vidx[a] for a in adj if a in vidx and a is not v)
|
14311
|
+
return vertices, vidx, nbrs
|
14312
|
+
|
14313
|
+
def _initial_labels(graph, key=None, default="degree"):
|
14314
|
+
"""
|
14315
|
+
Returns an integer label per node index using either vertex dictionary labels
|
14316
|
+
or a structural default (degree or constant).
|
14317
|
+
"""
|
14318
|
+
vertices, vidx, nbrs = _neighbors_map(graph)
|
14319
|
+
labels = {}
|
14320
|
+
if key:
|
14321
|
+
found_any = False
|
14322
|
+
tmp = {}
|
14323
|
+
for v in vertices:
|
14324
|
+
d = Topology.Dictionary(v)
|
14325
|
+
val = Dictionary.ValueAtKey(d, key)
|
14326
|
+
if val is not None:
|
14327
|
+
found_any = True
|
14328
|
+
tmp[vidx[v]] = str(val) if val is not None else None
|
14329
|
+
if found_any:
|
14330
|
+
# fill missing with a sentinel
|
14331
|
+
for i, val in tmp.items():
|
14332
|
+
labels[i] = val if val is not None else "__MISSING__"
|
14333
|
+
else:
|
14334
|
+
# fall back to structural init if no labels exist
|
14335
|
+
if default == "degree":
|
14336
|
+
labels = {i: str(len(nbrs[i])) for i in nbrs}
|
14337
|
+
else:
|
14338
|
+
labels = {i: "0" for i in nbrs}
|
14339
|
+
else: # Add a vertex degree information.
|
14340
|
+
_ = Graph.DegreeCentrality(graph, key="_dc_")
|
14341
|
+
labels, nbrs = _initial_labels(graph, key="_dc_")
|
14342
|
+
_ = [Topology.SetDictionary(v, Dictionary.RemoveKey(Topology.Dictionary(v), "_dc_")) for v in Graph.Vertices(graph)]
|
14343
|
+
return labels, nbrs
|
14344
|
+
|
14345
|
+
def _canonize_string_labels(str_labels):
|
14346
|
+
"""
|
14347
|
+
Deterministically map arbitrary strings to dense integer ids.
|
14348
|
+
Returns:
|
14349
|
+
int_labels: dict node_index -> int label
|
14350
|
+
vocab: dict string_label -> int id
|
14351
|
+
"""
|
14352
|
+
# stable order by string to keep mapping deterministic across runs
|
14353
|
+
unique = sorted(set(str_labels.values()))
|
14354
|
+
vocab = {lab: k for k, lab in enumerate(unique)}
|
14355
|
+
return {i: vocab[s] for i, s in str_labels.items()}, vocab
|
14356
|
+
|
14357
|
+
from topologicpy.Topology import Topology
|
14358
|
+
|
14359
|
+
if not Topology.IsInstance(graph, "Graph"):
|
14360
|
+
if not silent:
|
14361
|
+
print("Graph.WLFeatures - Error: The input graph parameter is not a valid topologic graph. Returning None.")
|
14362
|
+
return None
|
14363
|
+
|
14364
|
+
str_labels, nbrs = _initial_labels(graph, key=key)
|
14365
|
+
features = defaultdict(int)
|
14366
|
+
|
14367
|
+
# iteration 0
|
14368
|
+
labels, _ = _canonize_string_labels(str_labels)
|
14369
|
+
for lab in labels.values():
|
14370
|
+
features[lab] += 1
|
14371
|
+
|
14372
|
+
# WL iterations
|
14373
|
+
cur = labels
|
14374
|
+
for _ in range(iterations):
|
14375
|
+
new_str = {}
|
14376
|
+
for i in nbrs:
|
14377
|
+
neigh = [cur[j] for j in nbrs[i]]
|
14378
|
+
neigh.sort()
|
14379
|
+
new_str[i] = f"{cur[i]}|{','.join(map(str, neigh))}"
|
14380
|
+
cur, _ = _canonize_string_labels(new_str)
|
14381
|
+
for lab in cur.values():
|
14382
|
+
features[lab] += 1
|
14383
|
+
|
14384
|
+
return dict(features)
|
14385
|
+
|
14386
|
+
@staticmethod
|
14387
|
+
def WLKernel(graphA, graphB, key: str = None, iterations: int = 2, normalize: bool = True, mantissa: int = 6, silent: bool = False):
|
14388
|
+
"""
|
14389
|
+
Returns a cosine-normalized Weisfeiler-Lehman kernel between two graphs. See https://en.wikipedia.org/wiki/Weisfeiler_Leman_graph_isomorphism_test
|
14390
|
+
|
14391
|
+
Parameters
|
14392
|
+
----------
|
14393
|
+
graphA : topologic_core.Graph
|
14394
|
+
The first input graph.
|
14395
|
+
graphB : topologic_core.Graph
|
14396
|
+
The second input graph.
|
14397
|
+
key : str , optional
|
14398
|
+
The vertex key to use as an initial label. Default is None which means the vertex degree is used instead.
|
14399
|
+
iterations : int , optional
|
14400
|
+
The desired number of WL iterations. (non-negative int). Default is 2.
|
14401
|
+
normalize : bool , optional
|
14402
|
+
if set to True, the returned value is normalized between 0 and 1. Default is True.
|
14403
|
+
mantissa : int , optional
|
14404
|
+
The number of decimal places to round the result to. Default is 6.
|
14405
|
+
|
14406
|
+
Returns
|
14407
|
+
-------
|
14408
|
+
float
|
14409
|
+
The cosine-normalized Weisfeiler-Lehman kernel
|
14410
|
+
"""
|
14411
|
+
from topologicpy.Topology import Topology
|
14412
|
+
|
14413
|
+
if not Topology.IsInstance(graphA, "Graph"):
|
14414
|
+
if not silent:
|
14415
|
+
print("Graph.WLFeatures - Error: The input graphA parameter is not a valid topologic graph. Returning None.")
|
14416
|
+
return None
|
14417
|
+
if not Topology.IsInstance(graphB, "Graph"):
|
14418
|
+
if not silent:
|
14419
|
+
print("Graph.WLFeatures - Error: The input graphB parameter is not a valid topologic graph. Returning None.")
|
14420
|
+
return None
|
14421
|
+
f1 = Graph.WLFeatures(graphA, key=key, iterations=iterations)
|
14422
|
+
f2 = Graph.WLFeatures(graphB, key=key, iterations=iterations)
|
14423
|
+
|
14424
|
+
# dot product
|
14425
|
+
keys = set(f1) | set(f2)
|
14426
|
+
dot = sum(f1.get(k, 0) * f2.get(k, 0) for k in keys)
|
14427
|
+
|
14428
|
+
if not normalize:
|
14429
|
+
return round(float(dot), mantissa)
|
14430
|
+
|
14431
|
+
import math
|
14432
|
+
n1 = math.sqrt(sum(v*v for v in f1.values()))
|
14433
|
+
n2 = math.sqrt(sum(v*v for v in f2.values()))
|
14434
|
+
return_value = float(dot) / (n1 * n2) if n1 > 0 and n2 > 0 else 0.0
|
14435
|
+
return round(return_value, mantissa)
|
14436
|
+
|
13922
14437
|
@staticmethod
|
13923
14438
|
def XOR(graphA, graphB, vertexKeys, useCentroid: bool = False, tolerance: float = 0.001, silent: bool = False):
|
13924
14439
|
"""
|
@@ -13933,13 +14448,13 @@ class Graph:
|
|
13933
14448
|
vertexKeys : list or str , optional
|
13934
14449
|
The vertex dictionary key (str) or keys (list of str) to use to determine if two vertices are the same.
|
13935
14450
|
If the vertexKeys are set to None or "loc" or "coord" or "xyz" (case insensitive), the distance between the
|
13936
|
-
vertices (within the tolerance) will be used to determine sameness.
|
14451
|
+
vertices (within the tolerance) will be used to determine sameness. Default is None.
|
13937
14452
|
useCentroid : bool , optional
|
13938
14453
|
This is not used here, but included for API consistency for boolean operations.
|
13939
14454
|
tolerance : float , optional
|
13940
|
-
The desired tolerance.
|
14455
|
+
The desired tolerance. Default is 0.0001.
|
13941
14456
|
silent : bool , optional
|
13942
|
-
If set to True, error and warning messages are suppressed.
|
14457
|
+
If set to True, error and warning messages are suppressed. Default is False.
|
13943
14458
|
|
13944
14459
|
Returns
|
13945
14460
|
-------
|