Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,14 +31,14 @@ def network_visualizer(city, year):
|
|
| 31 |
edge_15 = splitIsnad(subsetEdges(city, year)).sample(300)
|
| 32 |
nt = Network()
|
| 33 |
for _, row in edge_15.iterrows():
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
|
| 44 |
net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)
|
|
|
|
| 31 |
edge_15 = splitIsnad(subsetEdges(city, year)).sample(300)
|
| 32 |
nt = Network()
|
| 33 |
for _, row in edge_15.iterrows():
|
| 34 |
+
source = row['Teacher']
|
| 35 |
+
target = row['Student']
|
| 36 |
+
attribute_value = row['Hadiths']
|
| 37 |
+
edge_color = value_to_hex(attribute_value)
|
| 38 |
+
|
| 39 |
+
net.add_node(source, color=value_to_hex(attribute_value), font = {'size':30, 'color': 'orange'})
|
| 40 |
+
net.add_node(target, color=value_to_hex(attribute_value) , font = {'size': 20, 'color': 'red'})
|
| 41 |
+
net.add_edge(source, target, color=edge_color, value=attribute_value)
|
| 42 |
|
| 43 |
|
| 44 |
net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)
|