Spaces:
Runtime error
Runtime error
added sim
Browse files- pages/2_Concepts_comparison.py +19 -20
pages/2_Concepts_comparison.py
CHANGED
@@ -105,26 +105,25 @@ with output_col_1:
|
|
105 |
print(np.round(similarity[0][0], 3))
|
106 |
edges.append((concept_ids[i], concept_ids[j], np.round(similarity[0][0], 3)))
|
107 |
|
108 |
-
# Create an empty graph
|
109 |
-
G = nx.Graph()
|
110 |
-
|
111 |
-
# Add edges with weights to the graph
|
112 |
-
for edge in edges:
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
# Generate network with specific layout settings
|
129 |
net.repulsion(
|
130 |
node_distance=420,
|
|
|
105 |
print(np.round(similarity[0][0], 3))
|
106 |
edges.append((concept_ids[i], concept_ids[j], np.round(similarity[0][0], 3)))
|
107 |
|
108 |
+
# # Create an empty graph
|
109 |
+
# G = nx.Graph()
|
110 |
+
|
111 |
+
# # Add edges with weights to the graph
|
112 |
+
# for edge in edges:
|
113 |
+
# node1, node2, weight = edge
|
114 |
+
# G.add_edge(node1, node2, weight=weight)
|
115 |
+
|
116 |
+
net = Network(height="750px", width="100%",)
|
117 |
+
for e in edges:
|
118 |
+
src = e[0]
|
119 |
+
dst = e[1]
|
120 |
+
w = e[2]
|
121 |
+
|
122 |
+
net.add_node(src, src, title=src)
|
123 |
+
net.add_node(dst, dst, title=dst)
|
124 |
+
net.add_edge(src, dst, value=w, title=src + ' to ' + dst + ' similarity ' +str(w))
|
125 |
+
print(net)
|
126 |
+
|
|
|
127 |
# Generate network with specific layout settings
|
128 |
net.repulsion(
|
129 |
node_distance=420,
|