Skip to content
Snippets Groups Projects
Commit f16596a5 authored by Yassin's avatar Yassin
Browse files

Refactorings Code and Adding Node Filter

parent 1efcfee0
No related branches found
No related tags found
1 merge request!1Adding new methods and the consensual backbone
...@@ -17,7 +17,7 @@ def high_salience_skeleton(data): ...@@ -17,7 +17,7 @@ def high_salience_skeleton(data):
values = {pair: 1 / wes[pair] for pair in wes} values = {pair: 1 / wes[pair] for pair in wes}
nx.set_edge_attributes(graph, values, name='distance') nx.set_edge_attributes(graph, values, name='distance')
nx.set_edge_attributes(graph, 0, name='score') nx.set_edge_attributes(graph, 0, name='salience')
for source in graph.nodes(): for source in graph.nodes():
tree = nx.single_source_dijkstra(graph, source, cutoff=None, weight='distance')[1] tree = nx.single_source_dijkstra(graph, source, cutoff=None, weight='distance')[1]
...@@ -29,9 +29,9 @@ def high_salience_skeleton(data): ...@@ -29,9 +29,9 @@ def high_salience_skeleton(data):
node_tree_scores[(path[i], path[i + 1])] = 1 node_tree_scores[(path[i], path[i + 1])] = 1
for u, v in node_tree_scores: for u, v in node_tree_scores:
graph[u][v]['score'] += 1 graph[u][v]['salience'] += 1
scores = nx.get_edge_attributes(graph, 'score') scores = nx.get_edge_attributes(graph, 'salience')
N = len(graph) N = len(graph)
score_values = dict() score_values = dict()
backbone_edges = dict() backbone_edges = dict()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment