From cdcb8a924a1f5ef29a03638d32cc311ebecccce2 Mon Sep 17 00:00:00 2001
From: Yassin <aliyassin4@hotmail.com>
Date: Sun, 7 May 2023 05:36:31 +0200
Subject: [PATCH] Updating HSS

---
 netbone/structural/high_salience_skeleton.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/netbone/structural/high_salience_skeleton.py b/netbone/structural/high_salience_skeleton.py
index c49039b..9309e77 100644
--- a/netbone/structural/high_salience_skeleton.py
+++ b/netbone/structural/high_salience_skeleton.py
@@ -36,6 +36,22 @@ def high_salience_skeleton(data):
 
     scores= nx.get_edge_attributes(graph, 'score')
     N = len(graph)
-    values = {pair:scores[pair]/N for pair in scores}
-    nx.set_edge_attributes(graph, values, name='score')
+    score_values = dict()
+    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])
-- 
GitLab