mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-06-26 22:00:19 +00:00
Revert "Integrated the GraphML Visualizer as an optional component of LightRAG"
This commit is contained in:
parent
0e162b25aa
commit
b2bc7770fd
@ -1058,12 +1058,6 @@ LightRag can be installed with API support to serve a Fast api interface to perf
|
|||||||
|
|
||||||
The documentation can be found [here](lightrag/api/README.md)
|
The documentation can be found [here](lightrag/api/README.md)
|
||||||
|
|
||||||
## Graph viewer
|
|
||||||
LightRag can be installed with Tools support to add extra tools like the graphml 3d visualizer.
|
|
||||||
|
|
||||||
The documentation can be found [here](lightrag/tools/lightrag_visualizer/README.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
|
||||||
<a href="https://star-history.com/#HKUDS/LightRAG&Date">
|
<a href="https://star-history.com/#HKUDS/LightRAG&Date">
|
||||||
|
88
extra/VisualizationTool/README.md
Normal file
88
extra/VisualizationTool/README.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# 3D GraphML Viewer
|
||||||
|
|
||||||
|
An interactive 3D graph visualization tool based on Dear ImGui and ModernGL.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **3D Interactive Visualization**: High-performance 3D graphics rendering using ModernGL
|
||||||
|
- **Multiple Layout Algorithms**: Support for various graph layouts
|
||||||
|
- Spring layout
|
||||||
|
- Circular layout
|
||||||
|
- Shell layout
|
||||||
|
- Random layout
|
||||||
|
- **Community Detection**: Automatic detection and visualization of graph community structures
|
||||||
|
- **Interactive Controls**:
|
||||||
|
- WASD + QE keys for camera movement
|
||||||
|
- Right mouse drag for view angle control
|
||||||
|
- Node selection and highlighting
|
||||||
|
- Adjustable node size and edge width
|
||||||
|
- Configurable label display
|
||||||
|
- Quick navigation between node connections
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- **imgui_bundle**: User interface
|
||||||
|
- **ModernGL**: OpenGL graphics rendering
|
||||||
|
- **NetworkX**: Graph data structures and algorithms
|
||||||
|
- **NumPy**: Numerical computations
|
||||||
|
- **community**: Community detection
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. **Launch the Program**:
|
||||||
|
```bash
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
python graph_visualizer.py
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Load Font**:
|
||||||
|
- Place the font file `font.ttf` in the `assets` directory
|
||||||
|
- Or modify the `CUSTOM_FONT` constant to use a different font file
|
||||||
|
|
||||||
|
3. **Load Graph File**:
|
||||||
|
- Click the "Load GraphML" button in the interface
|
||||||
|
- Select a graph file in GraphML format
|
||||||
|
|
||||||
|
4. **Interactive Controls**:
|
||||||
|
- **Camera Movement**:
|
||||||
|
- W: Move forward
|
||||||
|
- S: Move backward
|
||||||
|
- A: Move left
|
||||||
|
- D: Move right
|
||||||
|
- Q: Move up
|
||||||
|
- E: Move down
|
||||||
|
- **View Control**:
|
||||||
|
- Hold right mouse button and drag to rotate view
|
||||||
|
- **Node Interaction**:
|
||||||
|
- Hover mouse to highlight nodes
|
||||||
|
- Click to select nodes
|
||||||
|
|
||||||
|
5. **Visualization Settings**:
|
||||||
|
- Adjustable via UI control panel:
|
||||||
|
- Layout type
|
||||||
|
- Node size
|
||||||
|
- Edge width
|
||||||
|
- Label visibility
|
||||||
|
- Label size
|
||||||
|
- Background color
|
||||||
|
|
||||||
|
## Customization Options
|
||||||
|
|
||||||
|
- **Node Scaling**: Adjust node size via `node_scale` parameter
|
||||||
|
- **Edge Width**: Modify edge width using `edge_width` parameter
|
||||||
|
- **Label Display**: Toggle label visibility with `show_labels`
|
||||||
|
- **Label Size**: Adjust label size using `label_size`
|
||||||
|
- **Label Color**: Set label color through `label_color`
|
||||||
|
- **View Distance**: Control maximum label display distance with `label_culling_distance`
|
||||||
|
|
||||||
|
## Performance Optimizations
|
||||||
|
|
||||||
|
- Efficient graphics rendering using ModernGL
|
||||||
|
- View distance culling for label display optimization
|
||||||
|
- Community detection algorithms for optimized visualization of large-scale graphs
|
||||||
|
|
||||||
|
## System Requirements
|
||||||
|
|
||||||
|
- Python 3.10+
|
||||||
|
- Graphics card with OpenGL 3.3+ support
|
||||||
|
- Supported Operating Systems: Windows/Linux/MacOS
|
@ -1,6 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
3D GraphML Viewer using Dear ImGui and ModernGL
|
3D GraphML Viewer using Dear ImGui and ModernGL
|
||||||
Author: ParisNeo, ArnoChen
|
Author: LoLLMs, ArnoChen
|
||||||
Description: An interactive 3D GraphML viewer using imgui_bundle and ModernGL
|
Description: An interactive 3D GraphML viewer using imgui_bundle and ModernGL
|
||||||
Version: 2.0
|
Version: 2.0
|
||||||
"""
|
"""
|
||||||
@ -8,18 +8,6 @@ Version: 2.0
|
|||||||
from typing import Optional, Tuple, Dict, List
|
from typing import Optional, Tuple, Dict, List
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
import pipmaster as pm
|
|
||||||
|
|
||||||
# Added automatic libraries install using pipmaster
|
|
||||||
if not pm.is_installed("moderngl"):
|
|
||||||
pm.install("moderngl")
|
|
||||||
if not pm.is_installed("imgui_bundle"):
|
|
||||||
pm.install("imgui_bundle")
|
|
||||||
if not pm.is_installed("pyglm"):
|
|
||||||
pm.install("pyglm")
|
|
||||||
if not pm.is_installed("python-louvain"):
|
|
||||||
pm.install("python-louvain")
|
|
||||||
|
|
||||||
import moderngl
|
import moderngl
|
||||||
from imgui_bundle import imgui, immapp, hello_imgui
|
from imgui_bundle import imgui, immapp, hello_imgui
|
||||||
import community
|
import community
|
@ -1,5 +1,5 @@
|
|||||||
from .lightrag import LightRAG as LightRAG, QueryParam as QueryParam
|
from .lightrag import LightRAG as LightRAG, QueryParam as QueryParam
|
||||||
|
|
||||||
__version__ = "1.1.5"
|
__version__ = "1.1.4"
|
||||||
__author__ = "Zirui Guo"
|
__author__ = "Zirui Guo"
|
||||||
__url__ = "https://github.com/HKUDS/LightRAG"
|
__url__ = "https://github.com/HKUDS/LightRAG"
|
||||||
|
@ -1 +1 @@
|
|||||||
__api_version__ = "1.0.4"
|
__api_version__ = "1.0.3"
|
||||||
|
@ -557,14 +557,7 @@ class DocumentManager:
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
input_dir: str,
|
input_dir: str,
|
||||||
supported_extensions: tuple = (
|
supported_extensions: tuple = (".txt", ".md", ".pdf", ".docx", ".pptx", "xlsx"),
|
||||||
".txt",
|
|
||||||
".md",
|
|
||||||
".pdf",
|
|
||||||
".docx",
|
|
||||||
".pptx",
|
|
||||||
".xlsx",
|
|
||||||
),
|
|
||||||
):
|
):
|
||||||
self.input_dir = Path(input_dir)
|
self.input_dir = Path(input_dir)
|
||||||
self.supported_extensions = supported_extensions
|
self.supported_extensions = supported_extensions
|
||||||
|
@ -1,136 +0,0 @@
|
|||||||
# LightRAG 3D Graph Viewer
|
|
||||||
|
|
||||||
An interactive 3D graph visualization tool included in the LightRAG package for visualizing and analyzing RAG (Retrieval-Augmented Generation) graphs and other graph structures.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Quick Install
|
|
||||||
```bash
|
|
||||||
pip install lightrag-hku[tools] # Install with visualization tool only
|
|
||||||
# or
|
|
||||||
pip install lightrag-hku[api,tools] # Install with both API and visualization tools
|
|
||||||
```
|
|
||||||
|
|
||||||
## Launch the Viewer
|
|
||||||
```bash
|
|
||||||
lightrag-viewer
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- **3D Interactive Visualization**: High-performance 3D graphics rendering using ModernGL
|
|
||||||
- **Multiple Layout Algorithms**: Support for various graph layouts
|
|
||||||
- Spring layout
|
|
||||||
- Circular layout
|
|
||||||
- Shell layout
|
|
||||||
- Random layout
|
|
||||||
- **Community Detection**: Automatic detection and visualization of graph community structures
|
|
||||||
- **Interactive Controls**:
|
|
||||||
- WASD + QE keys for camera movement
|
|
||||||
- Right mouse drag for view angle control
|
|
||||||
- Node selection and highlighting
|
|
||||||
- Adjustable node size and edge width
|
|
||||||
- Configurable label display
|
|
||||||
- Quick navigation between node connections
|
|
||||||
|
|
||||||
## Tech Stack
|
|
||||||
|
|
||||||
- **imgui_bundle**: User interface
|
|
||||||
- **ModernGL**: OpenGL graphics rendering
|
|
||||||
- **NetworkX**: Graph data structures and algorithms
|
|
||||||
- **NumPy**: Numerical computations
|
|
||||||
- **community**: Community detection
|
|
||||||
|
|
||||||
## Interactive Controls
|
|
||||||
|
|
||||||
### Camera Movement
|
|
||||||
- W: Move forward
|
|
||||||
- S: Move backward
|
|
||||||
- A: Move left
|
|
||||||
- D: Move right
|
|
||||||
- Q: Move up
|
|
||||||
- E: Move down
|
|
||||||
|
|
||||||
### View Control
|
|
||||||
- Hold right mouse button and drag to rotate view
|
|
||||||
|
|
||||||
### Node Interaction
|
|
||||||
- Hover mouse to highlight nodes
|
|
||||||
- Click to select nodes
|
|
||||||
|
|
||||||
## Visualization Settings
|
|
||||||
|
|
||||||
Adjustable via UI control panel:
|
|
||||||
- Layout type
|
|
||||||
- Node size
|
|
||||||
- Edge width
|
|
||||||
- Label visibility
|
|
||||||
- Label size
|
|
||||||
- Background color
|
|
||||||
|
|
||||||
## Customization Options
|
|
||||||
|
|
||||||
- **Node Scaling**: Adjust node size via `node_scale` parameter
|
|
||||||
- **Edge Width**: Modify edge width using `edge_width` parameter
|
|
||||||
- **Label Display**: Toggle label visibility with `show_labels`
|
|
||||||
- **Label Size**: Adjust label size using `label_size`
|
|
||||||
- **Label Color**: Set label color through `label_color`
|
|
||||||
- **View Distance**: Control maximum label display distance with `label_culling_distance`
|
|
||||||
|
|
||||||
## System Requirements
|
|
||||||
|
|
||||||
- Python 3.9+
|
|
||||||
- Graphics card with OpenGL 3.3+ support
|
|
||||||
- Supported Operating Systems: Windows/Linux/MacOS
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
1. **Command Not Found**
|
|
||||||
```bash
|
|
||||||
# Make sure you installed with the 'tools' option
|
|
||||||
pip install lightrag-hku[tools]
|
|
||||||
|
|
||||||
# Verify installation
|
|
||||||
pip list | grep lightrag-hku
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **ModernGL Initialization Failed**
|
|
||||||
```bash
|
|
||||||
# Check OpenGL version
|
|
||||||
glxinfo | grep "OpenGL version"
|
|
||||||
|
|
||||||
# Update graphics drivers if needed
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Font Loading Issues**
|
|
||||||
- The required fonts are included in the package
|
|
||||||
- If issues persist, check your graphics drivers
|
|
||||||
|
|
||||||
## Usage with LightRAG
|
|
||||||
|
|
||||||
The viewer is particularly useful for:
|
|
||||||
- Visualizing RAG knowledge graphs
|
|
||||||
- Analyzing document relationships
|
|
||||||
- Exploring semantic connections
|
|
||||||
- Debugging retrieval patterns
|
|
||||||
|
|
||||||
## Performance Optimizations
|
|
||||||
|
|
||||||
- Efficient graphics rendering using ModernGL
|
|
||||||
- View distance culling for label display optimization
|
|
||||||
- Community detection algorithms for optimized visualization of large-scale graphs
|
|
||||||
|
|
||||||
## Support
|
|
||||||
|
|
||||||
- GitHub Issues: [LightRAG Repository](https://github.com/URL-to-lightrag)
|
|
||||||
- Documentation: [LightRAG Docs](https://URL-to-docs)
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This tool is part of LightRAG and is distributed under the MIT License. See `LICENSE` for more information.
|
|
||||||
|
|
||||||
Note: This visualization tool is an optional component of the LightRAG package. Install with the [tools] option to access the viewer functionality.
|
|
12
setup.py
12
setup.py
@ -62,16 +62,6 @@ def read_api_requirements():
|
|||||||
return api_deps
|
return api_deps
|
||||||
|
|
||||||
|
|
||||||
def read_extra_requirements():
|
|
||||||
api_deps = []
|
|
||||||
try:
|
|
||||||
with open("./lightrag/extra/VisualizationTool/requirements.txt") as f:
|
|
||||||
api_deps = [line.strip() for line in f if line.strip()]
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("Warning: API requirements.txt not found.")
|
|
||||||
return api_deps
|
|
||||||
|
|
||||||
|
|
||||||
metadata = retrieve_metadata()
|
metadata = retrieve_metadata()
|
||||||
long_description = read_long_description()
|
long_description = read_long_description()
|
||||||
requirements = read_requirements()
|
requirements = read_requirements()
|
||||||
@ -107,12 +97,10 @@ setuptools.setup(
|
|||||||
},
|
},
|
||||||
extras_require={
|
extras_require={
|
||||||
"api": read_api_requirements(), # API requirements as optional
|
"api": read_api_requirements(), # API requirements as optional
|
||||||
"tools": read_extra_requirements(), # API requirements as optional
|
|
||||||
},
|
},
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"lightrag-server=lightrag.api.lightrag_server:main [api]",
|
"lightrag-server=lightrag.api.lightrag_server:main [api]",
|
||||||
"lightrag-viewer=lightrag.tools.lightrag_visualizer:main [tools]",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user