A web application for interactive network visualization powered by LLM (Gemini API). Users can upload GraphML files, visualize networks, and interact with them using natural language.
Get started in 5 minutes! See QUICKSTART.md for detailed setup instructions.
# 1. Set your Gemini API key
export GOOGLE_API_KEY="your-api-key-here"
# 2. Start all services
docker compose up -d
# 3. Open your browser
# Frontend: http://localhost:5173
# API Docs: http://localhost:8000/docs- ๐ User Authentication - Secure login and registration
- ๐ค GraphML Upload - Import network data from GraphML files
- ๐ค LLM-Powered Chat - Natural language interaction using Gemini API
- ๐ Interactive Visualization - Real-time network visualization
- ๐ฏ Smart Analysis - Automatic centrality calculation and visual mapping
- ๐ Real-time Updates - Server-Sent Events for live feedback
- Upload a network: Upload a GraphML file (e.g., social network, citation network)
- Chat with the system:
- "ๅ้ใๅคใไบบใๅคงใใ่กจ็คบใใฆ" (Show people with many friends as larger)
- "ๆฉๆธกใใใใฆใใไบบใๅคงใใ่กจ็คบใใฆ" (Show bridge nodes as larger)
- "ๅฝฑ้ฟๅใฎใใไบบใๅคงใใ่กจ็คบใใฆ" (Show influential people as larger)
- See the results: The visualization updates automatically based on your request
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Frontend โโโโโโถโ Backend โโโโโโถโ NetworkX API โ
โ (React+Vite)โโโโโโโ (FastAPI) โโโโโโโ (FastAPI) โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ PostgreSQL โ
โโโโโโโโโโโโโโโ
โฒ
โ
โโโโโโโโโโโโโโโ
โ Gemini API โ
โโโโโโโโโโโโโโโ
- Frontend: React + Vite, D3.js for visualization
- Backend: FastAPI with Gemini API integration
- NetworkX API: Network analysis and centrality calculations
- Database: PostgreSQL for data persistence
- Quick Start Guide - Get up and running in minutes
- Implementation Guide - Detailed architecture and API documentation
- Specification - Complete system specification (Japanese)
- FastAPI (Python web framework)
- Google GenAI SDK (
google-genai) for Gemini API - SQLAlchemy (ORM)
- PostgreSQL (Database)
- NetworkX (Graph analysis)
- React 18
- Vite (Build tool)
- D3.js (Visualization)
- Zustand (State management)
- Axios (HTTP client)
The system uses Gemini 2.5 Flash with function calling to understand user requests and execute appropriate network analysis tools:
# Example: User says "Show people with many friends as larger"
# LLM automatically:
1. Calls calculate_centrality(network_id, "degree")
2. Calls generate_visualization(node_size_attribute="degree_centrality")
3. Returns a friendly responseAll operations use Server-Sent Events for real-time feedback:
- Upload progress
- LLM thinking process
- Tool execution status
- Visualization updates
Available centrality metrics:
- Degree Centrality: Number of connections
- Betweenness Centrality: Bridge nodes
- Closeness Centrality: Average distance to others
- Eigenvector Centrality: Influence based on connections
python test_complete_flow.py- Start the services:
docker compose up -d - Open http://localhost:5173
- Register/Login
- Create a chat
- Upload a GraphML file from
sample_data/ - Try example queries
The sample_data/ directory contains example networks:
karate_club.graphml- Zachary's Karate Club networkstar_graph.graphml- Simple star topologyrandom_graph.graphml- Random networkdirected_graph.graphml- Directed network example
- Docker and Docker Compose
- Python 3.11+
- Node.js 18+
- Google Gemini API key
Create a .env file:
GOOGLE_API_KEY=your-gemini-api-key
DATABASE_URL=postgresql://postgres:postgres@db:5432/graphvisagent
SECRET_KEY=your-secret-key
NETWORKX_API_URL=http://networkx-api:8001
# Optional: Vertex AI Configuration (overrides GOOGLE_API_KEY)
# VERTEX_PROJECT_ID=your-project-id
# VERTEX_LOCATION=us-central1
# GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/credentials.jsonWith Docker:
docker compose up -dWithout Docker:
# Terminal 1: Backend
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload
# Terminal 2: NetworkX API
cd networkx-api
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8001
# Terminal 3: Frontend
cd frontend
npm install
npm run devPOST /api/auth/register- Register new userPOST /api/auth/token- LoginGET /api/auth/users/me- Get current user
GET /api/chat- List all chatsPOST /api/chat- Create new chatPOST /api/chat/{id}/upload- Upload GraphMLPOST /api/chat/{id}/process- Process messageGET /api/chat/{id}/stream- SSE stream
See IMPLEMENTATION_GUIDE.md for complete API documentation.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
[Add your license here]
- Built with Gemini API
- Network analysis powered by NetworkX
- Visualization using D3.js
For issues or questions:
- Check the Implementation Guide
- Review the Quick Start Guide
- Check the logs:
docker compose logs
Made with โค๏ธ using Gemini API