add visualizing graph

This commit is contained in:
nongbin
2024-10-20 09:55:52 +08:00
parent eaa7445f10
commit 6206e0e340
10 changed files with 101 additions and 0 deletions

14
examples/graph_visual.py Normal file
View File

@@ -0,0 +1,14 @@
import networkx as nx
from pyvis.network import Network
# Load the GraphML file
G = nx.read_graphml('./dickens/graph_chunk_entity_relation.graphml')
# Create a Pyvis network
net = Network(notebook=True)
# Convert NetworkX graph to Pyvis network
net.from_nx(G)
# Save and display the network
net.show('knowledge_graph.html')