FDSRashid commited on
Commit
8d42c3d
·
1 Parent(s): 5999cc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -51,20 +51,11 @@ def network_visualizer(city, year, num_nodes):
51
  attribute_value = row['Hadiths']
52
  edge_color = value_to_hex(attribute_value)
53
  hadith_count = teacher_hadiths[teacher_hadiths['Teacher'] == source]['Hadiths'].to_list()[0]
54
- if source not in node_roles or node_roles[source] == "target":
55
- node_roles[source] = "source"
56
- node_colors[source] = value_to_hex(hadith_count)
57
- net.add_node(source, color=value_to_hex(hadith_count), font={'size': 30, 'color': 'orange'}, label=f"{source}\nHadiths: {hadith_count}")
58
-
59
- if target not in node_roles or node_roles[target] == "target":
60
- node_roles[target] = "target"
61
- node_colors[target] = value_to_hex(attribute_value)
62
- net.add_node(target, color=value_to_hex(attribute_value), font={'size': 20, 'color': 'red'}, label=f"{target}")
63
  edge_color = value_to_hex(attribute_value)
64
  net.add_edge(source, target, color=edge_color, value=attribute_value)
65
- #net.add_node(source, color=value_to_hex(hadith_count), font = {'size':30, 'color': 'orange'})
66
- #net.add_node(target, color=value_to_hex(attribute_value) , font = {'size': 20, 'color': 'red'})
67
- #net.add_edge(source, target, color=edge_color, value=attribute_value)
68
 
69
 
70
  net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)
 
51
  attribute_value = row['Hadiths']
52
  edge_color = value_to_hex(attribute_value)
53
  hadith_count = teacher_hadiths[teacher_hadiths['Teacher'] == source]['Hadiths'].to_list()[0]
 
 
 
 
 
 
 
 
 
54
  edge_color = value_to_hex(attribute_value)
55
  net.add_edge(source, target, color=edge_color, value=attribute_value)
56
+ net.add_node(source, color=value_to_hex(hadith_count), font = {'size':30, 'color': 'orange'}, label = f"Hadiths: {hadith_count}")
57
+ net.add_node(target, color=value_to_hex(attribute_value) , font = {'size': 20, 'color': 'red'}, label = f"Hadith from Teacher: {attribute_value}")
58
+ net.add_edge(source, target, color=edge_color, value=attribute_value)
59
 
60
 
61
  net.barnes_hut(gravity=-5000, central_gravity=0.3, spring_length=200)