[ # Build (line, stop) tuples from each line [ .features[].properties | . as $prop | .ZONES_ARRET[] | { line: $prop.id, stop: . } ] # Group everything by stop and only retrieve lines # This gives us all connected lines on a given stop | group_by(.stop)[] | [ .[].line # Ignore buses acting as tramways | select(startswith("SEM_8") | not) ] # Ignore stops with only one bus line | select(length > 1) # Get all combinations, ignoring edges pointing to themselves | combinations(2) | select(.[0] != .[1]) ] # Remove duplicate edges like A-B and B-A | unique_by(sort)[] # Output as DOT edges | join(" -- ")