An interactive 3D knowledge graph visualization tool that analyzes document relationships using AI-powered semantic analysis. Upload multiple documents and discover connections, shared themes, and conceptual relationships visualized in an immersive 3D graph.
- Force-directed graph layout with optimized node spacing
- Hover interactions - nodes scale up and glow when hovered
- Click to focus - smooth camera animation zooms to selected nodes
- Orbit controls - rotate and zoom around focused nodes
- Auto-rotate mode - automated graph rotation for presentations
- OpenAI GPT-4o-mini integration for intelligent document analysis
- Dynamic theme extraction - no predefined categories, analyzes ANY content
- Semantic similarity using OpenAI embeddings (text-embedding-3-small)
- Relationship detection - automatically finds conceptual connections
- AI Chatbot - ask questions about your document relationships
- Optimized storage system - O(1) lookups with bidirectional indexing
- Theme hierarchies - identifies main themes and subthemes
- Connection strength scoring - quantifies relationship strength
- Shared theme analysis - finds documents with common concepts
- Real-time search - filter nodes by document or theme names
- Dark theme with glassmorphism effects
- Responsive sidebar with custom scrollbars
- Live processing progress indicators
- Detailed node information overlays
- Hover tooltips for quick node identification
- Modern web browser (Chrome, Firefox, Edge, Safari)
- OpenAI API key
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/document-knowledge-graph.git cd document-knowledge-graph -
Configure your API key
Edit
config.jsand add your OpenAI API key:window.CONFIG = { OPENAI_API_KEY: "your-api-key-here", };
-
Open the application
Simply open
enhanced-analyzer.htmlin your web browser!No build process required - this is a pure client-side application.
- Click "Choose Files" button
- Select multiple text files (.txt)
- Files are loaded instantly in the browser
- Click "Analyze Documents" button
- AI analyzes themes, definitions, and relationships
- Progress updates show analysis stages
- Hover over nodes to see quick info
- Click nodes to focus and view details
- Drag to rotate around focused node
- Scroll to zoom in/out
- ๐ Reset button returns to overview
- Use search bar to find specific documents/themes
- Click search results to focus on nodes
- Ask questions about your documents
- Example: "What themes do these documents share?"
- AI has full context of your graph analysis
| Action | Control |
|---|---|
| Rotate camera | Drag with mouse |
| Zoom in/out | Scroll wheel |
| Select node | Click node |
| Reset view | ๐ button |
| Toggle auto-rotate | ๐ button |
| Manual zoom | โ โ buttons |
Optimized data structure for O(1) lookups:
- Bidirectional Maps for themes โ documents
- Efficient relationship queries
- Memory-optimized storage
AI-powered semantic analysis:
- OpenAI embeddings integration
- Cosine similarity calculations
- Conceptual connection detection
Structured LLM prompts for:
- Theme extraction (no predefined categories)
- Definition identification
- Relationship analysis
Main orchestrator that:
- Processes documents through AI pipeline
- Builds optimized graph structure
- Generates analysis reports
React + Three.js frontend:
- 3D graph visualization
- Interactive UI components
- Real-time state management
Edit the config object in enhanced-analyzer.html (lines 476-483):
{
minThemeConfidence: 0.7, // Minimum confidence for theme extraction
maxThemesPerDocument: 8, // Maximum themes per document
semanticSimilarityThreshold: 0.7, // Threshold for semantic connections
connectionStrengthThreshold: 0.4, // Minimum connection strength
enableSemanticAnalysis: true, // Enable embeddings analysis
enableHierarchicalThemes: true // Enable theme hierarchies
}document-knowledge-graph/
โโโ enhanced-analyzer.html # Main application (React + Three.js)
โโโ config.js # API key configuration
โโโ theme-storage-system.js # Optimized storage data structure
โโโ semantic-analyzer.js # AI semantic analysis engine
โโโ enhanced-prompts.js # LLM prompt templates
โโโ document-connection-analyzer.js # Main analysis orchestrator
โโโ GRAPH_CONTROLS_GUIDE.md # User control guide
โโโ README.md # This file
โโโ test files/ # Sample documents for testing
โโโ beyblades.txt
โโโ climate_change_and_fish_migration_patterns.txt
โโโ Energy_Analytics_and_Grid_Optimization.txt
โโโ Marine_Biodiversity_and_Coral_Reef_Fish.txt
โโโ Solar_Forecasting_Trends.txt
โโโ sustainable_fisheries_and_ocean_conservation.txt
โโโ Wind_Integration_Challenges.txt
- Research Analysis - Find connections between academic papers
- Content Organization - Understand relationships in documentation
- Knowledge Discovery - Uncover hidden themes across documents
- Literature Review - Visualize research landscapes
- Documentation Management - Organize technical documentation
- Creative Writing - Track themes and character relationships
Contributions are welcome! Please feel free to submit a Pull Request.
- Adjust LLM prompt for better responses
- Improve theme extraction accuracy
- Better handling of edge cases
- More nuanced relationship detection
- Fix UI
- Improve responsive design for mobile
- Better error message styling
- Enhanced loading states
- Accessibility improvements (ARIA labels, keyboard navigation)
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI - GPT-4o-mini and text-embedding-3-small APIs
- Three.js - 3D graphics library
- React - UI framework
For questions or issues, please open an issue on GitHub.
Built with โค๏ธ using React, Three.js, and OpenAI