topologicpy 0.8.33__py3-none-any.whl → 0.8.36__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
topologicpy/Graph.py CHANGED
@@ -303,7 +303,7 @@ class Graph:
303
303
  tolerance : float, optional
304
304
  The desired Tolerance. Not used here but included for API compatibility. Default is 0.0001.
305
305
  silent : bool, optional
306
- If True, suppresses error/warning messages. Default is False.
306
+ If set to True, error and warning messages are suppressed. Default is False.
307
307
 
308
308
  Returns
309
309
  -------
@@ -383,7 +383,7 @@ class Graph:
383
383
  tolerance : float , optional
384
384
  The desired tolerance. The default is 0.0001.
385
385
  silent : bool , optional
386
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
386
+ If set to True, error and warning messages are suppressed. The default is False.
387
387
 
388
388
  Returns
389
389
  -------
@@ -462,7 +462,7 @@ class Graph:
462
462
  tolerance : float , optional
463
463
  The desired tolerance. The default is 0.0001.
464
464
  silent : bool , optional
465
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
465
+ If set to True, error and warning messages are suppressed. The default is False.
466
466
 
467
467
  Returns
468
468
  -------
@@ -497,7 +497,7 @@ class Graph:
497
497
  tolerance : float , optional
498
498
  The desired tolerance. The default is 0.0001.
499
499
  silent : bool , optional
500
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
500
+ If set to True, error and warning messages are suppressed. The default is False.
501
501
 
502
502
  Returns
503
503
  -------
@@ -523,7 +523,7 @@ class Graph:
523
523
  _ = graph.AddVertices(vertices, tolerance) # Hook to Core
524
524
  return graph
525
525
 
526
- def AdjacencyDictionary(graph, vertexLabelKey: str = None, edgeKey: str = "Length", includeWeights: bool = False, reverse: bool = False, mantissa: int = 6):
526
+ def AdjacencyDictionary(graph, vertexLabelKey: str = None, edgeKey: str = "Length", includeWeights: bool = False, mantissa: int = 6):
527
527
  """
528
528
  Returns the adjacency dictionary of the input Graph.
529
529
 
@@ -537,9 +537,7 @@ class Graph:
537
537
  edgeKey : str , optional
538
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. The default is "Length".
539
539
  includeWeights : bool , optional
540
- If set to True, edge weights are included. Otherwise, they are not. The default is False.
541
- reverse : bool , optional
542
- If set to True, the vertices are sorted in reverse order (only if vertexKey is set). Otherwise, they are not. The default is False.
540
+ If set to True, edge weights are included. Otherwise, they are not. The default is False.
543
541
  mantissa : int , optional
544
542
  The desired length of the mantissa. The default is 6.
545
543
 
@@ -578,9 +576,6 @@ class Graph:
578
576
  labels.append(value)
579
577
  vertices = Helper.Sort(vertices, labels)
580
578
  labels.sort()
581
- if reverse == True:
582
- vertices.reverse()
583
- labels.reverse()
584
579
  order = len(vertices)
585
580
  adjDict = {}
586
581
  for i in range(order):
@@ -793,7 +788,7 @@ class Graph:
793
788
  vertex : topologic_core.Vertex
794
789
  the input vertex.
795
790
  silent : bool , optional
796
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
791
+ If set to True, error and warning messages are suppressed. The default is False.
797
792
 
798
793
  Returns
799
794
  -------
@@ -831,7 +826,7 @@ class Graph:
831
826
  tolerance : float , optional
832
827
  The desired tolerance. The default is 0.0001.
833
828
  silent : bool , optional
834
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
829
+ If set to True, error and warning messages are suppressed. The default is False.
835
830
 
836
831
  Returns
837
832
  -------
@@ -889,7 +884,7 @@ class Graph:
889
884
  tolerance : float , optional
890
885
  The desired tolerance. The default is 0.0001.
891
886
  silent : bool , optional
892
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
887
+ If set to True, error and warning messages are suppressed. The default is False.
893
888
 
894
889
  Returns
895
890
  -------
@@ -943,7 +938,7 @@ class Graph:
943
938
  timeLimit : int , optional
944
939
  The time limit in second. The default is 10 seconds.
945
940
  silent : bool , optional
946
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
941
+ If set to True, error and warning messages are suppressed. The default is False.
947
942
 
948
943
  Returns
949
944
  -------
@@ -1567,7 +1562,7 @@ class Graph:
1567
1562
  tolerance : float , optional
1568
1563
  The desired tolerance. The default is 0.0001.
1569
1564
  silent : bool , optional
1570
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1565
+ If set to True, error and warning messages are suppressed. The default is False.
1571
1566
 
1572
1567
  Returns
1573
1568
  -------
@@ -1629,7 +1624,7 @@ class Graph:
1629
1624
  key : str , optional
1630
1625
  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. The default is "bridge".
1631
1626
  silent : bool , optional
1632
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
1627
+ If set to True, error and warning messages are suppressed. The default is False.
1633
1628
 
1634
1629
  Returns
1635
1630
  -------
@@ -2081,7 +2076,7 @@ class Graph:
2081
2076
  tolerance : float , optional
2082
2077
  The desired tolerance. The default is 0.0001.
2083
2078
  silent : bool , optional
2084
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
2079
+ If set to True, error and warning messages are suppressed. The default is False.
2085
2080
 
2086
2081
  Returns
2087
2082
  -------
@@ -4530,7 +4525,7 @@ class Graph:
4530
4525
  maxColors : int , optional
4531
4526
  The desired maximum number of colors to test against. The default is 3.
4532
4527
  silent : bool , optional
4533
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
4528
+ If set to True, error and warning messages are suppressed. The default is False.
4534
4529
 
4535
4530
  Returns
4536
4531
  -------
@@ -4745,7 +4740,7 @@ class Graph:
4745
4740
  mantissa : int , optional
4746
4741
  The desired length of the mantissa. The default is 6.
4747
4742
  silent : bool , optional
4748
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
4743
+ If set to True, error and warning messages are suppressed. The default is False.
4749
4744
 
4750
4745
  Returns
4751
4746
  -------
@@ -5074,7 +5069,7 @@ class Graph:
5074
5069
  tolerance : float , optional
5075
5070
  The desired tolerance. The default is 0.0001.
5076
5071
  silent : bool , optional
5077
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5072
+ If set to True, error and warning messages are suppressed. The default is False.
5078
5073
 
5079
5074
  Returns
5080
5075
  -------
@@ -5150,7 +5145,7 @@ class Graph:
5150
5145
  tolerance : float , optional
5151
5146
  The desired tolerance. The default is 0.0001.
5152
5147
  silent : bool , optional
5153
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5148
+ If set to True, error and warning messages are suppressed. The default is False.
5154
5149
 
5155
5150
  Returns
5156
5151
  -------
@@ -5194,7 +5189,7 @@ class Graph:
5194
5189
  tolerance : float , optional
5195
5190
  The desired tolerance. The default is 0.0001.
5196
5191
  silent : bool , optional
5197
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5192
+ If set to True, error and warning messages are suppressed. The default is False.
5198
5193
 
5199
5194
  Returns
5200
5195
  -------
@@ -5475,7 +5470,7 @@ class Graph:
5475
5470
  tolerance : float , optional
5476
5471
  The desired tolerance. The default is 0.0001.
5477
5472
  silent : bool , optional
5478
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5473
+ If set to True, error and warning messages are suppressed. The default is False.
5479
5474
  Returns
5480
5475
  -------
5481
5476
  topologicpy.Graph
@@ -5502,7 +5497,7 @@ class Graph:
5502
5497
  tolerance : float , optional
5503
5498
  The desired tolerance. The default is 0.0001.
5504
5499
  silent : bool , optional
5505
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5500
+ If set to True, error and warning messages are suppressed. The default is False.
5506
5501
  Returns
5507
5502
  -------
5508
5503
  topologicpy.Graph
@@ -5653,7 +5648,7 @@ class Graph:
5653
5648
  tolerance : float , optional
5654
5649
  The desired tolerance. The default is 0.0001.
5655
5650
  silent : bool , optional
5656
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5651
+ If set to True, error and warning messages are suppressed. The default is False.
5657
5652
 
5658
5653
  Returns
5659
5654
  -------
@@ -5765,7 +5760,7 @@ class Graph:
5765
5760
  key : str , optional
5766
5761
  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. The default is "cut".
5767
5762
  silent : bool , optional
5768
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5763
+ If set to True, error and warning messages are suppressed. The default is False.
5769
5764
 
5770
5765
  Returns
5771
5766
  -------
@@ -5963,7 +5958,7 @@ class Graph:
5963
5958
  tolerance : float , optional
5964
5959
  The desired tolerance. The default is 0.0001.
5965
5960
  silent : bool , optional
5966
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
5961
+ If set to True, error and warning messages are suppressed. The default is False.
5967
5962
 
5968
5963
  Returns
5969
5964
  -------
@@ -7599,7 +7594,7 @@ class Graph:
7599
7594
  mantissa : int , optional
7600
7595
  The desired length of the mantissa. The default is 6.
7601
7596
  silent : bool , optional
7602
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
7597
+ If set to True, error and warning messages are suppressed. The default is False.
7603
7598
 
7604
7599
  Returns
7605
7600
  -------
@@ -7635,7 +7630,7 @@ class Graph:
7635
7630
  tolerance : float , optional
7636
7631
  The desired tolerance. The default is 0.0001.
7637
7632
  silent : bool , optional
7638
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
7633
+ If set to True, error and warning messages are suppressed. The default is False.
7639
7634
 
7640
7635
  Returns
7641
7636
  -------
@@ -7706,7 +7701,7 @@ class Graph:
7706
7701
  maxIterations : int , optional
7707
7702
  This number limits the number of iterations to prevent the function from running indefinitely, particularly for very large or complex graphs.
7708
7703
  silent : bool , optional
7709
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
7704
+ If set to True, error and warning messages are suppressed. The default is False.
7710
7705
 
7711
7706
  Returns
7712
7707
  -------
@@ -7839,7 +7834,7 @@ class Graph:
7839
7834
  tolerance : float , optional
7840
7835
  The desired tolerance. The default is 0.0001.
7841
7836
  silent : bool , optional
7842
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
7837
+ If set to True, error and warning messages are suppressed. The default is False.
7843
7838
 
7844
7839
  Returns
7845
7840
  -------
@@ -9337,7 +9332,7 @@ class Graph:
9337
9332
  vertexB : topologic_core.Vertex
9338
9333
  The second input vertex
9339
9334
  silent : bool , optional
9340
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
9335
+ If set to True, error and warning messages are suppressed. The default is False.
9341
9336
 
9342
9337
  Returns
9343
9338
  -------
@@ -9651,7 +9646,7 @@ class Graph:
9651
9646
  graph : topologic_core.Graph
9652
9647
  The input graph.
9653
9648
  silent : bool , optional
9654
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
9649
+ If set to True, error and warning messages are suppressed. The default is False.
9655
9650
  normalized : bool , optional
9656
9651
  If set to True, the returned Laplacian matrix is normalized. The default is False.
9657
9652
 
@@ -9715,7 +9710,7 @@ class Graph:
9715
9710
  tolerance : float , optional
9716
9711
  The desired tolerance. The default is 0.0001.
9717
9712
  silent : bool , optional
9718
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
9713
+ If set to True, error and warning messages are suppressed. The default is False.
9719
9714
 
9720
9715
  Returns
9721
9716
  -------
@@ -9747,7 +9742,7 @@ class Graph:
9747
9742
  tolerance : float, optional
9748
9743
  The desired tolerance. The default is 0.0001.
9749
9744
  silent : bool , optional
9750
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
9745
+ If set to True, error and warning messages are suppressed. The default is False.
9751
9746
 
9752
9747
  Returns
9753
9748
  -------
@@ -9996,6 +9991,59 @@ class Graph:
9996
9991
  longest_path = Topology.SetDictionary(longest_path, d)
9997
9992
  return longest_path
9998
9993
 
9994
+ @staticmethod
9995
+ def Match(graphA, graphB, vertexKey: str = None, silent: bool = False):
9996
+ """
9997
+ Matches two input graphs using isomorphism coupled with semantic matching.
9998
+
9999
+ Parameters
10000
+ ----------
10001
+ graphA : topologic_core.Graph
10002
+ The first input graph. This should be the smaller sub-graph or a graph isomorphice with the second input graph.
10003
+ graphB : topologic_core.Graph
10004
+ The second input graph.
10005
+ vertexKey : str , optional
10006
+ If set, the dictionaries of the vertices will be searched for this key and their values matched.
10007
+ silent : bool , optional
10008
+ If set to True, error and warning messages are suppressed. The default is False.
10009
+
10010
+ Returns
10011
+ -------
10012
+ list
10013
+ A list of dictionaries that match the vertices of graphA to the vertices of graphB.
10014
+ """
10015
+
10016
+ import networkx as nx
10017
+ from topologicpy.Topology import Topology
10018
+
10019
+ if not Topology.IsInstance(graphA, "graph"):
10020
+ if not silent:
10021
+ print("Graph.Map - Error: The graphA input parameter is not a valid graph. Returning None.")
10022
+ return None
10023
+
10024
+ if not Topology.IsInstance(graphB, "graph"):
10025
+ if not silent:
10026
+ print("Graph.Map - Error: The graphB input parameter is not a valid graph. Returning None.")
10027
+ return None
10028
+
10029
+ nx_ga = Graph.NetworkXGraph(graphA)
10030
+ nx_gb = Graph.NetworkXGraph(graphB)
10031
+
10032
+ def node_match(n1, n2):
10033
+ if vertexKey:
10034
+ return str(n1.get(vertexKey)) == str(n2.get(vertexKey))
10035
+ return True # topology-only match
10036
+
10037
+ matcher = nx.algorithms.isomorphism.GraphMatcher(
10038
+ nx_gb, nx_ga, node_match=node_match if vertexKey else None
10039
+ )
10040
+
10041
+ matches = list(matcher.subgraph_isomorphisms_iter())
10042
+ if not matches and not silent:
10043
+ print("Graph.Match - Warning: No subgraph isomorphisms found.")
10044
+ return matches
10045
+
10046
+
9999
10047
  @staticmethod
10000
10048
  def MaximumDelta(graph):
10001
10049
  """
@@ -10152,7 +10200,7 @@ class Graph:
10152
10200
  tolerance : float , optional
10153
10201
  The desired tolerance. The default is 0.0001.
10154
10202
  silent : bool , optional
10155
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
10203
+ If set to True, error and warning messages are suppressed. The default is False.
10156
10204
 
10157
10205
  Returns
10158
10206
  -------
@@ -10635,7 +10683,7 @@ class Graph:
10635
10683
  tolerance : float , optional
10636
10684
  The desired tolerance. The default is 0.0001.
10637
10685
  silent : bool , optional
10638
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
10686
+ If set to True, error and warning messages are suppressed. The default is False.
10639
10687
 
10640
10688
  Returns
10641
10689
  -------
@@ -10647,6 +10695,7 @@ class Graph:
10647
10695
  from topologicpy.Topology import Topology
10648
10696
  from topologicpy.Dictionary import Dictionary
10649
10697
  import warnings
10698
+ import os
10650
10699
 
10651
10700
  try:
10652
10701
  import networkx as nx
@@ -10672,27 +10721,17 @@ class Graph:
10672
10721
  vertices = Graph.Vertices(graph)
10673
10722
  edges = Graph.Edges(graph)
10674
10723
  mesh_data = Graph.MeshData(graph)
10675
- order = len(vertices)
10676
- nodes = []
10677
- for i in range(order):
10678
- v = vertices[i]
10679
- d = Topology.Dictionary(vertices[i])
10680
- if d:
10681
- keys = Dictionary.Keys(d)
10682
- if not keys:
10683
- keys = []
10684
- values = Dictionary.Values(d)
10685
- if not values:
10686
- values = []
10687
- keys += [xKey, yKey, zKey]
10688
- values += [Vertex.X(v, mantissa=mantissa), Vertex.Y(v, mantissa=mantissa), Vertex.Z(v, mantissa=mantissa)]
10689
- d = Dictionary.ByKeysValues(keys, values)
10690
- pythonD = Dictionary.PythonDictionary(d)
10691
- nodes.append((i, pythonD))
10692
- else:
10693
- nodes.append((i, {"name": str(i)}))
10694
- nxGraph.add_nodes_from(nodes)
10695
10724
 
10725
+ # Add nodes with attributes
10726
+ for i, v in enumerate(vertices):
10727
+ d = Topology.Dictionary(v)
10728
+ pythonD = Dictionary.PythonDictionary(d) if d else {}
10729
+ pythonD[xKey] = Vertex.X(v, mantissa)
10730
+ pythonD[yKey] = Vertex.Y(v, mantissa)
10731
+ pythonD[zKey] = Vertex.Z(v, mantissa)
10732
+ nxGraph.add_node(i, **pythonD)
10733
+
10734
+ # Add edges
10696
10735
  mesh_edges = mesh_data['edges']
10697
10736
  for i, mesh_edge in enumerate(mesh_edges):
10698
10737
  sv_i = mesh_edge[0]
@@ -10700,11 +10739,12 @@ class Graph:
10700
10739
  sv = vertices[sv_i]
10701
10740
  ev = vertices[ev_i]
10702
10741
  edge_length = Vertex.Distance(sv, ev, mantissa=mantissa)
10703
- edge_dict = Topology.Dictionary(edges[i])
10742
+ edge_dict = Topology.Dictionary(edges[i]) if i < len(edges) else None
10704
10743
  edge_attributes = Dictionary.PythonDictionary(edge_dict) if edge_dict else {}
10705
10744
  edge_attributes['length'] = edge_length
10706
10745
  nxGraph.add_edge(sv_i, ev_i, **edge_attributes)
10707
-
10746
+
10747
+ # Reshape it into a 2D spring layout for future display
10708
10748
  pos = nx.spring_layout(nxGraph, k=0.2)
10709
10749
  nx.set_node_attributes(nxGraph, pos, "pos")
10710
10750
  return nxGraph
@@ -10932,7 +10972,7 @@ class Graph:
10932
10972
  tolerance : float , optional
10933
10973
  The desired tolerance. The default is 0.0001.
10934
10974
  silent : bool , optional
10935
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
10975
+ If set to True, error and warning messages are suppressed. The default is False.
10936
10976
 
10937
10977
  Returns
10938
10978
  -------
@@ -11617,7 +11657,7 @@ class Graph:
11617
11657
  tolerance : float , optional
11618
11658
  The desired tolerance. The default is 0.0001.
11619
11659
  silent : bool , optional
11620
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
11660
+ If set to True, error and warning messages are suppressed. The default is False.
11621
11661
 
11622
11662
  Returns
11623
11663
  -------
@@ -11714,7 +11754,7 @@ class Graph:
11714
11754
  tolerance : float , optional
11715
11755
  The desired tolerance. The default is 0.0001.
11716
11756
  silent : bool , optional
11717
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
11757
+ If set to True, error and warning messages are suppressed. The default is False.
11718
11758
 
11719
11759
  Returns
11720
11760
  -------
@@ -12087,7 +12127,7 @@ class Graph:
12087
12127
  tolerance : float , optional
12088
12128
  The desired tolerance. The default is 0.0001.
12089
12129
  silent : bool , optional
12090
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
12130
+ If set to True, error and warning messages are suppressed. The default is False.
12091
12131
 
12092
12132
  Returns
12093
12133
  -------
@@ -12281,7 +12321,7 @@ class Graph:
12281
12321
  mantissa : int , optional
12282
12322
  The desired length of the mantissa. The default is 6.
12283
12323
  silent : bool , optional
12284
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
12324
+ If set to True, error and warning messages are suppressed. The default is False.
12285
12325
 
12286
12326
  Returns
12287
12327
  -------
topologicpy/Helper.py CHANGED
@@ -50,7 +50,7 @@ class Helper:
50
50
  tolerance : float , optional
51
51
  The desired tolerance. The default is 0.0001.
52
52
  silent : bool , optional
53
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
53
+ If set to True, error and warning messages are suppressed. The default is False.
54
54
 
55
55
  Returns
56
56
  -------
@@ -164,7 +164,7 @@ class Helper:
164
164
  keys : str or list or comma-separated str input parameters
165
165
  The key or keys in the topology's dictionary to use for clustering.
166
166
  silent : bool , optional
167
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
167
+ If set to True, error and warning messages are suppressed. The default is False.
168
168
 
169
169
 
170
170
  Returns
@@ -286,6 +286,58 @@ class Helper:
286
286
  flat_list = flat_list + Helper.Flatten(item)
287
287
  return flat_list
288
288
 
289
+ @staticmethod
290
+ def Grow(seed_idx, group_size, adjacency, visited_global):
291
+ """
292
+ Attempts to grow a spatially connected group of a specified size starting from a given seed index.
293
+
294
+ This method uses a breadth-first search strategy to explore neighboring indices from the seed index,
295
+ guided by the provided adjacency dictionary. It avoids reusing indices that are globally visited.
296
+ The growth continues until the desired group size is reached or no further expansion is possible.
297
+
298
+ Parameters
299
+ ----------
300
+ seed_idx : int
301
+ The index from which to start growing the group.
302
+ group_size : int
303
+ The target size of the group to be grown.
304
+ adjacency : dict
305
+ A dictionary mapping each index to a list of adjacent indices. This defines the connectivity.
306
+ visited_global : set
307
+ A set of indices that have already been used in previously grown groups and should be avoided.
308
+
309
+ Returns
310
+ -------
311
+ list[int] or None
312
+ A list of indices representing a connected group of the specified size if successful, otherwise None.
313
+
314
+ Notes
315
+ -----
316
+ This method is intended for internal use in functions that generate connected subgroups
317
+ of spatial elements (e.g., cells) based on adjacency. The result may vary between runs due to random shuffling
318
+ of neighbor order to diversify outputs.
319
+ """
320
+ from collections import deque
321
+ import random
322
+
323
+ group = [seed_idx]
324
+ visited = set(group)
325
+ queue = deque([seed_idx])
326
+
327
+ while queue and len(group) < group_size:
328
+ current = queue.popleft()
329
+ neighbors = adjacency.get(current, [])
330
+ random.shuffle(neighbors)
331
+ for neighbor in neighbors:
332
+ if neighbor not in visited and neighbor not in visited_global:
333
+ group.append(neighbor)
334
+ visited.add(neighbor)
335
+ queue.append(neighbor)
336
+ if len(group) >= group_size:
337
+ break
338
+
339
+ return group if len(group) == group_size else None
340
+
289
341
  @staticmethod
290
342
  def Iterate(listA):
291
343
  """
@@ -412,7 +464,7 @@ class Helper:
412
464
  listA : list
413
465
  The input list.
414
466
  silent : bool , optional
415
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
467
+ If set to True, error and warning messages are suppressed. The default is False.
416
468
 
417
469
  Returns
418
470
  -------
@@ -448,7 +500,7 @@ class Helper:
448
500
  listA : list
449
501
  The input list.
450
502
  silent : bool , optional
451
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
503
+ If set to True, error and warning messages are suppressed. The default is False.
452
504
 
453
505
  Returns
454
506
  -------
topologicpy/Matrix.py CHANGED
@@ -68,7 +68,7 @@ class Matrix:
68
68
  mantissa : int , optional
69
69
  The desired length of the mantissa. The default is 6.
70
70
  silent : bool , optional
71
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
71
+ If set to True, error and warning messages are suppressed. The default is False.
72
72
 
73
73
  Returns
74
74
  -------
@@ -417,7 +417,7 @@ class Matrix:
417
417
  mantissa : int , optional
418
418
  The desired length of the mantissa. The default is 6.
419
419
  silent : bool , optional
420
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
420
+ If set to True, error and warning messages are suppressed. The default is False.
421
421
 
422
422
  Returns
423
423
  -------
@@ -496,7 +496,7 @@ class Matrix:
496
496
  matA : list of list of float
497
497
  The input matrix.
498
498
  silent : bool , optional
499
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
499
+ If set to True, error and warning messages are suppressed. The default is False.
500
500
 
501
501
  Returns
502
502
  -------
topologicpy/Neo4j.py CHANGED
@@ -250,7 +250,7 @@ class Neo4j:
250
250
  tolerance : float , optional
251
251
  The desired tolerance. The default is 0.0001.
252
252
  silent : bool , optional
253
- If set to True, no error and warning messages are printed. Otherwise, they are. The default is False.
253
+ If set to True, error and warning messages are suppressed. The default is False.
254
254
 
255
255
  Returns
256
256
  -------