FDSRashid commited on
Commit
dfadc0a
·
1 Parent(s): be9688d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -34,14 +34,16 @@ def splitIsnad(dataframe):
34
 
35
  def network_visualizer(city, year, num_nodes):
36
  edge_15 = splitIsnad(subsetEdges(city, year))[['Teacher', 'Student', 'Hadiths']].groupby(['Teacher', 'Student']).sum().reset_index().sample(num_nodes)
 
37
  net = Network()
38
  for _, row in edge_15.iterrows():
39
  source = row['Teacher']
40
  target = row['Student']
41
  attribute_value = row['Hadiths']
42
  edge_color = value_to_hex(attribute_value)
 
43
 
44
- net.add_node(source, color=value_to_hex(attribute_value), font = {'size':30, 'color': 'orange'})
45
  net.add_node(target, color=value_to_hex(attribute_value) , font = {'size': 20, 'color': 'red'})
46
  net.add_edge(source, target, color=edge_color, value=attribute_value)
47
 
 
34
 
35
  def network_visualizer(city, year, num_nodes):
36
  edge_15 = splitIsnad(subsetEdges(city, year))[['Teacher', 'Student', 'Hadiths']].groupby(['Teacher', 'Student']).sum().reset_index().sample(num_nodes)
37
+ teacher_hadiths = edge_15[['Teacher', 'Hadiths']].groupby('Teacher').sum().reset_index()
38
  net = Network()
39
  for _, row in edge_15.iterrows():
40
  source = row['Teacher']
41
  target = row['Student']
42
  attribute_value = row['Hadiths']
43
  edge_color = value_to_hex(attribute_value)
44
+ hadith_count = teacher_hadiths[teacher_hadiths['Teacher'] == source]['Hadiths'].to_list()[0]
45
 
46
+ net.add_node(source, color=value_to_hex(hadith_count), font = {'size':30, 'color': 'orange'})
47
  net.add_node(target, color=value_to_hex(attribute_value) , font = {'size': 20, 'color': 'red'})
48
  net.add_edge(source, target, color=edge_color, value=attribute_value)
49