Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Integrated the GraphML Visualizer as an optional component of… #705

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

## 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

<a href="https://star-history.com/#HKUDS/LightRAG&Date">
Expand Down
88 changes: 88 additions & 0 deletions extra/VisualizationTool/README.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
"""
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
Version: 2.0
"""

from typing import Optional, Tuple, Dict, List
import numpy as np
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
from imgui_bundle import imgui, immapp, hello_imgui
import community
Expand Down
2 changes: 1 addition & 1 deletion lightrag/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .lightrag import LightRAG as LightRAG, QueryParam as QueryParam

__version__ = "1.1.5"
__version__ = "1.1.4"
__author__ = "Zirui Guo"
__url__ = "https://github.com/HKUDS/LightRAG"
2 changes: 1 addition & 1 deletion lightrag/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__api_version__ = "1.0.4"
__api_version__ = "1.0.3"
9 changes: 1 addition & 8 deletions lightrag/api/lightrag_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,14 +557,7 @@ class DocumentManager:
def __init__(
self,
input_dir: str,
supported_extensions: tuple = (
".txt",
".md",
".pdf",
".docx",
".pptx",
".xlsx",
),
supported_extensions: tuple = (".txt", ".md", ".pdf", ".docx", ".pptx", "xlsx"),
):
self.input_dir = Path(input_dir)
self.supported_extensions = supported_extensions
Expand Down
Empty file removed lightrag/tools/__init__.py
Empty file.
136 changes: 0 additions & 136 deletions lightrag/tools/lightrag_visualizer/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ def read_api_requirements():
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()
long_description = read_long_description()
requirements = read_requirements()
Expand Down Expand Up @@ -107,12 +97,10 @@ def read_extra_requirements():
},
extras_require={
"api": read_api_requirements(), # API requirements as optional
"tools": read_extra_requirements(), # API requirements as optional
},
entry_points={
"console_scripts": [
"lightrag-server=lightrag.api.lightrag_server:main [api]",
"lightrag-viewer=lightrag.tools.lightrag_visualizer:main [tools]",
],
},
)