Update app.py
Browse files
app.py
CHANGED
@@ -99,7 +99,7 @@ def lookup_hadith(taraf_hadith, hadith_lookup):
|
|
99 |
hadith_lookup (defaultdict): A defaultdict containing the hadith data.
|
100 |
|
101 |
Returns:
|
102 |
-
list: A list of unique
|
103 |
"""
|
104 |
# Ensure taraf_hadith is always a list
|
105 |
if isinstance(taraf_hadith, str):
|
@@ -350,12 +350,8 @@ def visualize_narrator_taraf(taraf_num, narrator, yaxis):
|
|
350 |
matns_with_narrator.append(taraf_hadith[idx])
|
351 |
for node in (n for n, d in G1.out_degree() if d == 0):
|
352 |
end_node.setdefault(node, []).append(str(idx))
|
353 |
-
|
354 |
-
# Update the graph
|
355 |
-
list_of_lists = [hadith_lookup[i] for i in matns_with_narrator]
|
356 |
-
flattened = list(set([elem for sublist in list_of_lists for elem in sublist]))
|
357 |
|
358 |
-
isnad_hadith = isnad_info.iloc[
|
359 |
G = nx.from_pandas_edgelist(isnad_hadith, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
|
360 |
isnad_pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
361 |
|
|
|
99 |
hadith_lookup (defaultdict): A defaultdict containing the hadith data.
|
100 |
|
101 |
Returns:
|
102 |
+
list: A list of the unique indices for isnad_info. so which edges for that matn
|
103 |
"""
|
104 |
# Ensure taraf_hadith is always a list
|
105 |
if isinstance(taraf_hadith, str):
|
|
|
350 |
matns_with_narrator.append(taraf_hadith[idx])
|
351 |
for node in (n for n, d in G1.out_degree() if d == 0):
|
352 |
end_node.setdefault(node, []).append(str(idx))
|
|
|
|
|
|
|
|
|
353 |
|
354 |
+
isnad_hadith = isnad_info.iloc[lookup_hadith(matns_with_narrator, HADITH_LOOKUP)][['Source', 'Destination']]
|
355 |
G = nx.from_pandas_edgelist(isnad_hadith, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
|
356 |
isnad_pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
357 |
|