programlibs/Graphs/demos/subway.xtl

A small subway map: eight stations on a red line, a blue line and a branch, with the minutes between stations. How long from the Airport to everywhere, how many stops from the Center, and what a closure cuts off. Run with "just demo Graphs subway".

source · imports g: libs/Graphs/src/Graphs.xtl libs/Graphs/src/Graphs.xtlm; t: libs/Strings/src/Strings.xtl

names : Box Char

value · line 9
names ← "Airport" "Bridge" "Center" "Docks" "Exchange" "Fair" "Garden" "Harbor"

lines : Int

value · line 11
lines ← 3 7 r̲eshape 1 2 3 4 6 3 4  2 3 4 5 3 7 8  7 4 3 5 6 4 9
Used in: w

w : Int

value · line 12
w ← (8 ᵍw̲eighted lines) + o̲\ 8 ᵍw̲eighted lines

open : Bool

value · line 21
open ← (0 < w) ∧ n̲ot ((r̲ange 8) = 3) '∨ t̲able (r̲ange 8) = 3