main
HuangHai 1 day ago
parent ceaf14de29
commit c18828eca2

@ -15,7 +15,6 @@ G = nx.read_graphml("../Topic/ChuZhongShuXue/graph_chunk_entity_relation.graphml
# Create a Pyvis network
net = Network(height="100vh", notebook=True)
# Convert NetworkX graph to Pyvis network
net.from_nx(G)
@ -31,15 +30,14 @@ for edge in net.edges:
if "description" in edge:
edge["title"] = edge["description"]
# cdn.jsdelivr.net --> fastly.jsdelivr.net
html_path = "knowledge_graph.html"
# Save and display the network
net.show(html_path)
# Replace CDN URL from cdn.jsdelivr.net to fastly.jsdelivr.net
with open(html_path, 'r', encoding='utf-8') as f:
content = f.read()
content = content.replace("cdn.jsdelivr.net", "fastly.jsdelivr.net")
with open(html_path, 'w', encoding='utf-8') as f:
f.write(content)
f.write(content)
net.show(html_path)

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save