#!/usr/bin/env -S node --experimental-json-modules import network from "../src/tam/network.json"; console.log("digraph {"); console.log("graph[layout=fdp, outputorder=nodesfirst]"); for (const [stopId, stop] of Object.entries(network.stops)) { console.log(`${stopId}[label="${stop.properties.name}"]`); } const junctions = new Set(); for (const [beginId, begin] of Object.entries(network.navigation)) { if (!(beginId in network.stops)) { junctions.add(beginId); } for (const endId in begin) { if (!(endId in network.stops)) { junctions.add(endId); } } } for (const junction of junctions) { console.log(`${junction}[label="", shape=point]`); } for (const [beginId, begin] of Object.entries(network.navigation)) { for (const [endId, end] of Object.entries(begin)) { const len = end.properties.length; console.log(`${beginId} -> ${endId}[len=${len}]`); } } console.log("}");