From 6206e0e3405b48070b8e04850bcedb588455b0ab Mon Sep 17 00:00:00 2001 From: nongbin Date: Sun, 20 Oct 2024 09:55:52 +0800 Subject: [PATCH] add visualizing graph --- .gitignore | 1 + .idea/.gitignore | 8 ++++ .idea/LightRAG.iml | 12 ++++++ .idea/inspectionProfiles/Project_Default.xml | 38 +++++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++ .idea/misc.xml | 7 ++++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ examples/graph_visual.py | 14 +++++++ requirements.txt | 1 + 10 files changed, 101 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/LightRAG.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 examples/graph_visual.py diff --git a/.gitignore b/.gitignore index 50f384ec..208668c5 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/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/LightRAG.iml b/.idea/LightRAG.iml new file mode 100644 index 00000000..8b8c3954 --- /dev/null +++ b/.idea/LightRAG.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..c41eaf20 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,38 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..676ac0f0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..145d7086 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ 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