Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated functions #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions matchmsextras/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def erode_clusters(graph_main, max_cluster_size=100, keep_weights_above=0.8):
links_removed = []

# Split graph into separate clusters
graphs = list(nx.connected_component_subgraphs(graph_main))
graphs = [graph_main.subgraph(c) for c in nx.connected_components(graph_main)]

for graph in graphs:
cluster_size = len(graph.nodes)
Expand All @@ -380,7 +380,7 @@ def erode_clusters(graph_main, max_cluster_size=100, keep_weights_above=0.8):

# If link removal caused split of cluster:
if not nx.is_connected(graph):
subgraphs = list(nx.connected_component_subgraphs(graph))
subgraphs = [graph.subgraph(c) for c in nx.connected_components(graph)]
print("Getting from cluster with", len(graph.nodes),
"nodes, to clusters with",
[len(x.nodes) for x in subgraphs], "nodes.")
Expand Down Expand Up @@ -450,7 +450,7 @@ def split_cluster(graph_main,
"""

# Split graph into separate clusters
graphs = list(nx.connected_component_subgraphs(graph_main))
graphs = [graph_main.subgraph(c) for c in nx.connected_components(graph_main)]

links_removed = []
for i, graph in enumerate(graphs):
Expand Down Expand Up @@ -503,9 +503,7 @@ def split_cluster(graph_main,
pair[m * 2], pair[m * 2 + 1])

# Check if created subclustes are big enough:
subgraphs = list(
nx.connected_component_subgraphs(
new_graph_testing))
subgraphs = [new_graph_testing.subgraph(c) for c in nx.connected_components(new_graph_testing)]
min_size_after_cutting.append(
min([len(x.nodes) for x in subgraphs]))

Expand All @@ -531,8 +529,7 @@ def split_cluster(graph_main,
# Remove edge from main graph:
graph_main.remove_edge(pair[m * 2], pair[m * 2 + 1])
links_removed.append((pair[m * 2], pair[m * 2 + 1]))
subgraphs = list(
nx.connected_component_subgraphs(new_graph_testing))
subgraphs = [new_graph_testing.subgraph(c) for c in nx.connected_components(new_graph_testing)]

if int(pairs.shape[1] / 2) > 1:
print("Removed", int(pairs.shape[1] / 2), "edges:",
Expand Down Expand Up @@ -588,7 +585,7 @@ def refine_network(graph_main,
-------
"""
# Split graph into separate clusters
graphs = list(nx.connected_component_subgraphs(graph_main))
graphs = [graph_main.subgraph(c) for c in nx.connected_components(graph_main)]

links_removed = []
links_added = []
Expand All @@ -610,7 +607,7 @@ def refine_network(graph_main,
links_removed.extend(links)

# Split updated graph into separate clusters
graphs = list(nx.connected_component_subgraphs(graph_main))
graphs = [graph_main.subgraph(c) for c in nx.connected_components(graph_main)]
cluster_max = np.max([len(x.nodes) for x in graphs])
counter += 1

Expand Down Expand Up @@ -664,7 +661,7 @@ def evaluate_clusters(graph_main, m_sim_ref):
"""

# Split graph into separate clusters
graphs = list(nx.connected_component_subgraphs(graph_main))
graphs = [graph_main.subgraph(c) for c in nx.connected_components(graph_main)]

num_nodes = []
num_edges = []
Expand Down
Loading