Subject: Re: Proposal: NetworkX Backbone Extraction Subpackage
Hi Brian,
Thank you for sharing your proposal and reference implementation—this looks very promising. A few thoughts based on your questions:
Inclusion in NetworkX vs standalone: Backbone extraction fits well within NetworkX. It’s a common operation and having it natively improves accessibility and reproducibility.
Number of methods: For an NXEP, starting with a core set of 4–5 methods is ideal:
Statistical: disparity_filter, noise_corrected_backbone
Structural: mst, metric_backbone
Optional: salience_backbone
Scoring → filtering pattern: This is sensible. A few tips:
Input graphs should not be mutated
Standardize edge attributes, e.g., score_*, pvalue_*
Provide clear examples for filtering
Here’s a minimal workflow illustrating your proposed API:
Python id="8jwoei"
Copy code
import networkx as nx
from networkx.algorithms.backbone import (
disparity_filter, threshold_filter, mst, backbone_similarity
)
# Create a small weighted graph
G = nx.Graph()
G.add_edge("A", "B", weight=5)
G.add_edge("A", "C", weight=3)
G.add_edge("B", "C", weight=2)
G.add_edge("B", "D", weight=4)
G.add_edge("C", "D", weight=1)
# Step 1: Compute significance scores
G_scored = disparity_filter(G, weight="weight")
# Step 2: Filter edges by threshold
H_backbone = threshold_filter(G_scored, attribute="pvalue_disparity", threshold=0.05)
# Step 3: Compute a structural backbone
H_mst = mst(G, weight="weight")
# Step 4: Compare backbones
sim = backbone_similarity(H_backbone, H_mst)
print(f"Backbone similarity: {sim:.2f}")
This pattern clearly separates scoring from filtering, while also allowing fixed-backbone methods to return subgraphs directly.
Overall, I think the proposal is strong and ready for NXEP submission, especially if you start with this minimal core set of methods.
Best regards,
Mubarek
GitHub: mubarek57�