Visualize any algorithm problem instantly using the power of Generative AI. ๐ชโจ
VishvaRoop is a next-generation education tool that transforms static algorithm problems into dynamic, step-by-step visualizations. By combining Large Language Models (Gemini/Ollama) with a robust "Entity-Action" architecture, it understands complex problem statements and renders semantic animations. ๐ฌ
- ๐ Universal Visualization: Currently supports 4 data structures: Arrays, Stacks, Queues, and BST. We are actively working on adding more!
- ๐ง AI-Driven Core: Leverages Google Gemini โจ and Ollama ๐ฆ to parse problems and generate deterministic execution steps.
- ๐๏ธ Entity-Action Architecture: A novel approach that normalizes LLM output into verifiable actions (Create, Select, Move, Highlight) for consistent rendering.
- ๐ก๏ธ Adaptive Fallbacks: Built-in deterministic executors ensure visualization continuity even if the AI output is imperfect.
- โฏ๏ธ Interactive Playback: Full control with Play/Pause, Step Forward/Back.
- ๐ Rich Data Structures: Visualizes Arrays, Binary Trees, Stacks, Queues (MVP Phase).
- ๐จ Modern UI: A sleek, dark-themed experience built with React and Tailwind CSS.
- Framework: React โ๏ธ + Vite โก
- Styling: Tailwind CSS ๐จ
- Animations: Anime.js ๐ฅ
- Icons: Lucide React ๐๏ธ
- State/Networking: Axios ๐ก
- Runtime: Node.js ๐ข & Express ๐
- AI Integration:
- Google Gemini (Cloud) โจ
- Ollama (Local LLM) ๐ฆ
- Architecture: Service-Controller pattern with Custom Normalizers ๐
- โจ๏ธ Input: User inputs a problem statement (e.g., "Find the maximum subarray sum").
- ๐ Analysis: The LLM Service (Gemini/Ollama) analyzes the problem type and generates a logical plan.
- ๐ Normalization: The Universal Normalizer converts raw AI output into a strictly structured JSON of Entities and Actions.
- โ๏ธ Execution: The Executor Engine runs the logic (with deterministic fallbacks).
- ๐จ Rendering: The Frontend VisualCanvas interprets the frames and manages state transitions using Anime.js.
- Arrays - Linear data structure with indexing support
- Binary Search Trees (BST) - Hierarchical structure with ordered nodes
- Stacks - LIFO (Last In, First Out) operations
- Queues - FIFO (First In, First Out) operations
- Sorting Algorithms: Bubble Sort, Selection Sort, Insertion Sort, Quick Sort, Merge Sort
- Searching Algorithms: Binary Search, Linear Search
- Tree Traversals: Inorder, Preorder, Postorder, Level-order (BFS)
- Tree Operations: Insert, Remove, Search in BST
- Stack Operations: Push, Pop, Peek, Valid Parentheses
- Queue Operations: Enqueue, Dequeue, BFS Traversal
- Array Algorithms: Two Sum, Three Sum, Sliding Window, Two Pointer Problems
- Dynamic Programming: Work In Progress! ๐ง
- Graph Algorithms: Work In Progress! ๐ง
Classifies an algorithm problem and generates visualization frames.
Request Body:
{
"problemStatement": "string"
}Response:
{
"structures": [
{
"id": "string",
"type": "string",
"label": "string",
"data": "array"
}
],
"frames": [
{
"id": "string",
"title": "string",
"description": "string",
"entities": [
{
"id": "string",
"type": "string",
"data": "array",
"meta": "object"
}
],
"actions": [
{
"type": "string",
"target": "string",
"indices": "array",
"value": "any"
}
],
"variables": "object"
}
],
"intent": {
"domain": "string",
"algorithm": "string",
"source": "string"
}
}Health check endpoint to verify server status.
Response:
{
"status": "OK",
"timestamp": "ISO date string"
}- Node.js (v18 or higher) ๐ข
- npm or yarn ๐ฆ
- (Optional) Ollama ๐ฆ installed locally for offline AI support.
-
Clone the repository ๐ฏ
git clone https://github.com/PatilSharvil/AI-Problem-Visualizer.git cd AI-Problem-Visualizer -
Install Backend Dependencies ๐ ๏ธ
cd backend npm install -
Install Frontend Dependencies ๐
cd ../frontend npm install
Create a .env file in the backend/ directory:
# Server Port
PORT=5000
# AI Provider Configuration (Choose 'gemini' or 'ollama')
LLM_PROVIDER=gemini
# If using Gemini โจ
GEMINI_API_KEY=your_gemini_api_key_here
# If using Ollama ๐ฆ
OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=qwen2.5-coder:7b-instruct
# Enable/disable executors (default: true)
ENABLE_EXECUTORS=true
# Local model flag (set to true if using Ollama)
LOCAL_MODEL=falseBackend: ๐
cd backend
npm run dev
# Server running on http://localhost:5000Frontend: ๐ฅ๏ธ
cd frontend
npm run dev
# App running on http://localhost:5173Currently, the project doesn't have automated tests set up, but we recommend manual testing of new features.
The project follows standard JavaScript/React formatting conventions. Use your IDE's formatter for consistency.
| Variable | Description | Required |
|---|---|---|
PORT |
Backend server port | Yes |
LLM_PROVIDER |
AI provider ('gemini' or 'ollama') | Yes |
GEMINI_API_KEY |
Google Gemini API key (if using gemini) | Conditional |
OLLAMA_URL |
Ollama server URL | Conditional |
OLLAMA_MODEL |
Ollama model name | Conditional |
LOCAL_MODEL |
Flag to enable local model mode | No (defaults to false) |
ENABLE_EXECUTORS |
Enable deterministic fallback executors | No (defaults to true) |
- Enable detailed logging: Add
console.logstatements in the backend controllers to trace the flow - Check network tab: Monitor API requests in browser DevTools to see request/response details
- Verify data format: Ensure the backend is returning properly formatted frames that the frontend expects
- Test with simple problems: Start with basic problems like "binary search for 5 in [1,2,3,4,5,6,7]" to verify functionality
Try these sample problems to see the visualizations in action:
"Binary search for 5 in [1,2,3,4,5,6,7]""Linear search for 3 in [10,20,30,40,5,50]"
"Sort array [64,34,25,12,22,11,90] using bubble sort""Sort [5,2,4,6,1,3] using insertion sort"
"Insert 4,2,6,1,3,5,7 into BST and then search for 5""Inorder traversal of BST [4,2,6,1,3,5,7]""Preorder traversal of BST [4,2,6,1,3,5,7]"
"Validate parentheses in string '()[]{}'""Reverse string 'hello' using stack"
"Level order traversal of BST [4,2,6,1,3,5,7]"
- Response Times: API calls typically take 2-5 seconds depending on the complexity of the problem and the selected AI provider
- Rate Limits: When using cloud providers, be aware of API rate limits
- Local Models: Ollama provides faster response times but requires more local resources
- Complexity: More complex algorithms with many steps will generate more frames and take longer to process
We welcome contributions to VishvaRoop! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
A: Currently, VishvaRoop supports problems involving Arrays, Binary Search Trees, Stacks, and Queues. This includes sorting, searching, traversal, and basic operations on these data structures.
A: Yes! By configuring the system to use Ollama with a local LLM, you can run VishvaRoop completely offline.
A: VishvaRoop uses a combination of AI and deterministic executors to ensure accuracy. The system has fallback mechanisms to maintain correctness even when AI output is imperfect.
A: If you use cloud providers like Google Gemini, your problem statement is sent to their servers. For complete privacy, use the local Ollama option.
A: Absolutely! The entity-action architecture is designed to be extensible. You can add new visualization components and corresponding executors.
VishvaRoop/
โโโ backend/ โ๏ธ
โ โโโ src/
โ โ โโโ controllers/ # Request handlers ๐น๏ธ
โ โ โโโ services/ # LLM Adapter, Executors, Normalizer ๐ง
โ โ โโโ schemas/ # Validation schemas ๐ก๏ธ
โ โ โโโ routes/ # API Endpoints ๐ฃ๏ธ
โ โโโ server.js # Entry point ๐ช
โ
โโโ frontend/ ๐จ
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ entities/ # Visualizers (Array, Tree, Graph...) ๐
โ โ โ โโโ ...
โ โ โโโ pages/ # Landing, VisualizerPage ๐
โ โ โโโ App.jsx
โ โโโ index.html
โโโ README.md
- Limited Data Structures: Currently supports only Arrays, BSTs, Stacks, and Queues
- AI Dependency: Quality of visualizations depends on AI model's understanding
- Complex Problem Parsing: Very complex or ambiguous problem statements may not be interpreted correctly
- Performance: Complex algorithms may take longer to generate visualizations
- Language Support: Optimized for English problem statements
- ๐ Expanded Graph algorithms (Dijkstra, Bellman-Ford, etc).
- ๐๏ธ Expanded Data structures (Linked List, Graph, Matrix, etc).
- ๐งฉ Expanded Algorithms (Sorting, Searching, Graph Traversal, etc).
- ๐ค Betterment in deterministic engine.
- ๐ฑ Mobile-responsive improvements
- ๐จ Customizable visualization themes
- ๐ค Export visualizations as images/videos
- ๐ Multi-language support for problem statements
โThe future of engineering belongs to those who help others understand.โ