An interactive graph visualization program that allows you to create and manage nodes and connections between nodes on a map with Dijkstra pathfinding algorithm.
- Pin Node: Create named nodes to mark important locations (start/end points)
- Default Node: Create regular nodes as intermediate vertices
- Connect Nodes: Connect two nodes with edges (lines) and distance weights
- Remove Node: Delete unwanted nodes
- Dijkstra: Find the shortest path between two nodes
- Export/Import: Save and load graph configurations in JSON format
- Background Map: Support for various background map images
- Python 3.x
- tkinter (usually included with Python)
- Pillow (PIL) for image processing
pip install Pillow-
Run the Program
python map_demo.py
-
Creating Nodes
- Click the Pin Node button to create a named node (click on canvas, input name when prompted)
- Click the Default Node button to create a regular node (click directly on canvas)
-
Connecting Nodes
- Click the Connect Nodes button
- Click the first node, then click the second node
- Input the weight/distance between nodes when prompted
-
Finding the Shortest Path
- Click the Djikstra button
- Select the start node and destination node
- The shortest path will be displayed on the canvas
-
Removing Nodes
- Click the Remove Node button
- Click the node you want to delete
-
Save & Load
- Export: Save the graph to a new JSON file
- Import: Load a graph from an existing JSON file
map_demo.py- Main programconfig.json- Default node data for general mapconfig_map_ITS.json- Node data specific to ITS mapconfig_map_JakartaBandung.json- Node data specific to Jakarta-Bandung mapimg/- Folder containing background map images
- Default mode: Click to view node information
- LMB (Left Mouse Button): Use according to the selected mode
