ludusc commited on
Commit
10930fc
1 Parent(s): 17c9a9e
Files changed (1) hide show
  1. 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
- node1, node2, weight = edge
114
- G.add_edge(node1, node2, weight=weight)
115
-
116
-
117
- # Initiate PyVis network object
118
- net = Network(
119
- height='400px',
120
- width='100%',
121
- bgcolor='#222222',
122
- font_color='white'
123
- )
124
-
125
- # Take Networkx graph and translate it to a PyVis graph format
126
- net.from_nx(G)
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,