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

Updating HSS

parent 9a59b4f2
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,22 @@ def high_salience_skeleton(data): ...@@ -36,6 +36,22 @@ def high_salience_skeleton(data):
scores= nx.get_edge_attributes(graph, 'score') scores= nx.get_edge_attributes(graph, 'score')
N = len(graph) N = len(graph)
values = {pair:scores[pair]/N for pair in scores} score_values = dict()
nx.set_edge_attributes(graph, values, name='score') backbone_edges = dict()
for pair in scores:
score_values[pair] = scores[pair]/N
if scores[pair]/N > 0.8:
backbone_edges[pair] = True
else:
backbone_edges[pair] = False
# score_values = {pair:scores[pair]/N for pair in scores}
nx.set_edge_attributes(graph, score_values, name='score')
nx.set_edge_attributes(graph, backbone_edges, name='high_salience_skeleton')
# for u,v in graph.edges():
# if graph[u][v]['score']>=0.8:
# graph[u][v]['high_salience_skeleton'] = True
# else:
# graph[u][v]['high_salience_skeleton'] = False
return Backbone(graph, name="High Salience Skeleton Filter", column="high_salience_skeleton", ascending=False, filters=[boolean_filter, threshold_filter, fraction_filter]) return Backbone(graph, name="High Salience Skeleton Filter", column="high_salience_skeleton", ascending=False, filters=[boolean_filter, threshold_filter, fraction_filter])
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