Update popup
Browse files- network.py +7 -8
network.py
CHANGED
|
@@ -19,16 +19,16 @@ def analysis():
|
|
| 19 |
information = ""
|
| 20 |
for i in inf_labels:
|
| 21 |
if pd.notna(row[i]):
|
| 22 |
-
information+=f"{i
|
| 23 |
G.nodes[row["itemLabel"]]["attr"]=information
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
for x in G.nodes():
|
| 34 |
if "attr" not in G.nodes[x]:
|
|
@@ -64,7 +64,6 @@ def analysis():
|
|
| 64 |
edge["color"] = "blue"
|
| 65 |
edge["width"] = 2 if relationship != "Unknown" else 1
|
| 66 |
|
| 67 |
-
|
| 68 |
html = net.generate_html()
|
| 69 |
#need to remove ' from HTML
|
| 70 |
html = html.replace("'", "\"")
|
|
|
|
| 19 |
information = ""
|
| 20 |
for i in inf_labels:
|
| 21 |
if pd.notna(row[i]):
|
| 22 |
+
information+=f"{i}: {row[i]}\n"
|
| 23 |
G.nodes[row["itemLabel"]]["attr"]=information
|
| 24 |
|
| 25 |
+
for index, row in df.iterrows():
|
| 26 |
+
main_entity = row['itemLabel']
|
| 27 |
+
for relationship in relationship_columns:
|
| 28 |
+
if pd.notna(row[relationship]) and not G.has_edge(main_entity, row[relationship]) and not G.has_edge(row[relationship], main_entity):
|
| 29 |
+
# if pd.notna(row[relationship]):
|
| 30 |
|
| 31 |
+
G.add_edge(row[relationship], main_entity, label=str(relationship)+ "_of")
|
| 32 |
|
| 33 |
for x in G.nodes():
|
| 34 |
if "attr" not in G.nodes[x]:
|
|
|
|
| 64 |
edge["color"] = "blue"
|
| 65 |
edge["width"] = 2 if relationship != "Unknown" else 1
|
| 66 |
|
|
|
|
| 67 |
html = net.generate_html()
|
| 68 |
#need to remove ' from HTML
|
| 69 |
html = html.replace("'", "\"")
|