diff --git a/.gitignore b/.gitignore index 50f384ec..edfbfbfc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__ dickens/ book.txt lightrag-dev/ +.idea/ \ No newline at end of file diff --git a/examples/graph_visual.py b/examples/graph_visual.py new file mode 100644 index 00000000..72c72bad --- /dev/null +++ b/examples/graph_visual.py @@ -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') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index d5479dab..9cc5b7e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ tiktoken torch transformers xxhash +pyvis \ No newline at end of file