Utilities to build, edit, visualize, and interact with a Midgard travel graph.
createGraph.py— produces a sample graph (graph.json). Use--outor--extend existing.jsonto write/merge.graph_editor.py— GUI editor for nodes/edges (ports, route types, distances, allowed modes). Load/save JSON.visualize_graph.py— renders a PNG of the graph. Requirespip install matplotlib networkx.travel_gui.py— interactive travel day tracker with shortest-path roadmap and time estimates.map_graph_builder.py— click on a map image to place nodes and connect edges; distances are computed from pixel distance times a scale you set.
- Generate the sample graph (or extend an existing one):
python3 createGraph.py --out graph.json
python3 createGraph.py --extend graph.json --out graph.json # merge defaults into an existing file
- Edit the map (nodes/edges) with the guided GUI:
python3 graph_editor.py --graph graph.json
- Nodes: set
IDandHas port. - Edges: pick endpoints, mark undirected, choose one or more route types, distance (km), and allowed travel modes.
- Visualize the map (PNG):
pip install matplotlib networkx # first time
python3 visualize_graph.py --graph graph.json --out graph.png
- Plan and track a trip interactively:
python3 travel_gui.py --graph graph.json
- Choose start/destination, click “Start Trip”.
- The “Route plan” pane shows the shortest path and estimated time (based on current mode).
- In a city, choose a route and click “Start Selected Route”.
- Each day, pick mode + hours and click “Travel Day” to update distance covered/remaining and the log.
- Build a graph by clicking on a map image:
python3 map_graph_builder.py --image Alba.jpg --scale 0.5 --graph graph.json
- Click “Add nodes” mode to place cities/landmarks.
- Switch to “Connect nodes” and click two nodes to add an edge; distance is pixel_distance * scale.
- Update the scale (units per pixel) and hit “Recalc Distances” to refresh edge lengths; save to JSON.
- Alba: 1.038
- New Feature request: sail-along-the-shore for safer sea travel.