risk-network 0.0.14b1__py3-none-any.whl → 0.0.14b2__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.
- risk/__init__.py +1 -1
- risk/_network/_io.py +9 -15
- {risk_network-0.0.14b1.dist-info → risk_network-0.0.14b2.dist-info}/METADATA +1 -1
- {risk_network-0.0.14b1.dist-info → risk_network-0.0.14b2.dist-info}/RECORD +7 -7
- {risk_network-0.0.14b1.dist-info → risk_network-0.0.14b2.dist-info}/WHEEL +0 -0
- {risk_network-0.0.14b1.dist-info → risk_network-0.0.14b2.dist-info}/licenses/LICENSE +0 -0
- {risk_network-0.0.14b1.dist-info → risk_network-0.0.14b2.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/_network/_io.py
CHANGED
@@ -164,7 +164,7 @@ class NetworkIO:
|
|
164
164
|
Args:
|
165
165
|
compute_sphere (bool, optional): Whether to map nodes to a sphere. Defaults to True.
|
166
166
|
surface_depth (float, optional): Surface depth for the sphere. Defaults to 0.0.
|
167
|
-
min_edges_per_node (int, optional): Minimum number of edges per node. Defaults to 0.
|
167
|
+
min_edges_per_node (int, optional): Minimum number of edges per node (k-core threshold). Defaults to 0.
|
168
168
|
"""
|
169
169
|
self.compute_sphere = compute_sphere
|
170
170
|
self.surface_depth = surface_depth
|
@@ -440,20 +440,14 @@ class NetworkIO:
|
|
440
440
|
num_initial_edges = G.number_of_edges()
|
441
441
|
# Remove self-loops to ensure correct edge count
|
442
442
|
G.remove_edges_from(nx.selfloop_edges(G))
|
443
|
-
#
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
break # Exit loop if no nodes meet the condition
|
452
|
-
G.remove_nodes_from(nodes_to_remove)
|
453
|
-
|
454
|
-
# Remove isolated nodes
|
455
|
-
isolates = list(nx.isolates(G))
|
456
|
-
G.remove_nodes_from(isolates)
|
443
|
+
# Apply canonical node k-core pruning if requested
|
444
|
+
if self.min_edges_per_node > 0:
|
445
|
+
# networkx.k_core returns a subgraph; to preserve in-place behavior, copy back
|
446
|
+
core = nx.k_core(G, k=self.min_edges_per_node)
|
447
|
+
# Rebuild G in-place to keep external references valid
|
448
|
+
G.clear()
|
449
|
+
G.add_nodes_from(core.nodes(data=True))
|
450
|
+
G.add_edges_from(core.edges(data=True))
|
457
451
|
|
458
452
|
# Log the number of nodes and edges before and after cleaning
|
459
453
|
num_final_nodes = G.number_of_nodes()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=Kit6ilMaj_3F16dnLJ_Dd7fE5jeZGmNqur97zzK7CRI,143
|
2
2
|
risk/_risk.py,sha256=VULCdM41BlWKM1ou4Qc579ffZ9dMZkfhAwKYgbaEeKM,1054
|
3
3
|
risk/_annotation/__init__.py,sha256=zr7w1DHkmvrkKFGKdPhrcvZHV-xsfd5TZOaWtFiP4Dc,164
|
4
4
|
risk/_annotation/_annotation.py,sha256=03vcnkdi4HGH5UUyokUyOdyyjXOLoKSmLFuK7VAl41c,15174
|
@@ -18,7 +18,7 @@ risk/_neighborhoods/_stats/_permutation/__init__.py,sha256=nfTaW29CK8OZCdFnpMVlH
|
|
18
18
|
risk/_neighborhoods/_stats/_permutation/_permutation.py,sha256=e5qVuYWGhiAn5Jv8VILk-WYMOO4km48cGdRYTOl355M,10661
|
19
19
|
risk/_neighborhoods/_stats/_permutation/_test_functions.py,sha256=lGI_MkdbW4UHI0jWN_T1OattRjXrq_qmzAmOfels670,3165
|
20
20
|
risk/_network/__init__.py,sha256=YrAMfhL0CMWQb3sY-mn1VxK44zZAWeFAvHrBONH9I-A,127
|
21
|
-
risk/_network/_io.py,sha256=
|
21
|
+
risk/_network/_io.py,sha256=wmokwNViz24Gv6o3OFRTYHftYYz4sN64VigGrdEGzy8,28057
|
22
22
|
risk/_network/_graph/__init__.py,sha256=SFgxgxUiZK4vvw6bdQ04DSMXEr8xjMaQV-Wne6wAIqM,104
|
23
23
|
risk/_network/_graph/_api.py,sha256=sp3_mLJDP_xQexYBjyM17iyzLb2oGmiC050kcw-jVho,8474
|
24
24
|
risk/_network/_graph/_graph.py,sha256=x2EWT_ZVwxh7m9a01yG4WMdmAxBxiaxX3CvkqP9QAXE,12486
|
@@ -34,8 +34,8 @@ risk/_network/_plotter/_plotter.py,sha256=F2hw-spUdsXjvuG36o0YFR3Pnd-CZOHYUq4vW0
|
|
34
34
|
risk/_network/_plotter/_utils/__init__.py,sha256=JXgjKiBWvXx0X2IeFnrOh5YZQGQoELbhJZ0Zh2mFEOo,211
|
35
35
|
risk/_network/_plotter/_utils/_colors.py,sha256=JCliSvz8_-TsjilaRHSEsqdXFBUYlzhXKOSRGdCm9Kw,19177
|
36
36
|
risk/_network/_plotter/_utils/_layout.py,sha256=GyGLc2U1WWUVL1Te9uPi_CLqlW_E4TImXRAL5TeA5D8,3633
|
37
|
-
risk_network-0.0.
|
38
|
-
risk_network-0.0.
|
39
|
-
risk_network-0.0.
|
40
|
-
risk_network-0.0.
|
41
|
-
risk_network-0.0.
|
37
|
+
risk_network-0.0.14b2.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
38
|
+
risk_network-0.0.14b2.dist-info/METADATA,sha256=8Ymwky3eLiYB9OMO0kVzfF40uvnD3uFCBmY7q6pfitI,6853
|
39
|
+
risk_network-0.0.14b2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
40
|
+
risk_network-0.0.14b2.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
41
|
+
risk_network-0.0.14b2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|