How S1 is built and tested

Author

Mohamed Gharbia

Published

October 15, 2026

Blueprint

flowchart TB
  IN1[/"City street lines<br/>whole island"/]:::data
  IN2[/"Study area outline"/]:::data
  CFG[/"Road-class rules<br/>ends within 0.5 m meet"/]:::rule
  COR[/"My decisions<br/>and their evidence"/]:::rule

  IN1 --> S1["READ<br/>every street line"]:::step
  IN2 --> S1
  S1 --> S2["SELECT<br/>keep a segment if its<br/>halfway point is inside"]:::step
  S2 --> S2b["DECISIONS<br/>add paths and assumed links,<br/>take in Robert-Bourassa"]:::step
  COR --> S2b
  S2b --> S2c["EDGE<br/>outside streets that touch<br/>the area"]:::step
  S2c --> S2d["NUMBER<br/>later pieces last"]:::step
  S2d --> S3["JOIN ENDS<br/>ends closer than 0.5 m<br/>become one junction"]:::step
  S3 --> S4["KINDS<br/>gates, exits, dead ends,<br/>junctions"]:::step
  CFG --> S5
  S4 --> S5["PERMISSIONS<br/>walk? drive? which way?"]:::step
  S5 --> OUT1[/"Segments"/]:::out
  S5 --> OUT2[/"Junctions"/]:::out
  OUT1 --> T["TESTS<br/>T1 to T7"]:::test
  OUT2 --> T
  T --> V["SHEETS"]:::test
  V --> W["LAB"]:::test

  classDef data fill:none,stroke:#8a8a8a,color:#e6e6e6
  classDef rule fill:none,stroke:#8a8a8a,stroke-dasharray:4 3,color:#a6a6a6
  classDef step fill:none,stroke:#e6e6e6,color:#e6e6e6
  classDef out fill:none,stroke:#e6e6e6,stroke-width:2px,color:#ffffff
  classDef test fill:none,stroke:#fe83cc,color:#fe83cc

Rules I assumed

The city publishes what each class of road is. Who may use it is my decision, so I wrote it down.

Road class (city’s name) Walk Drive How sure
Local street yes yes safe
Pedestrian way yes no safe
Business place yes no unsure in general; confirmed for Rue Smith (C02)
Collector and arterial yes yes safe
Highway no yes safe
Projected street no no removed, since it is not built yet

Which way cars may go comes from the city’s own one-way code for each street. Source for the road classes: Ville de Montréal, Géobase, réseau routier (Resources).

The edge

People and cars come and go across the boundary, so S1 keeps the edge and treats it by the same rules as the inside, for walkers and for the direction of cars. The tests, and later the agents, treat the rest of the city as reachable from the exits. S3 reads the signs on the edge too, so a junction on the boundary sees every street that meets it. Later systems decide what to do with the edge: S4 puts no buildings there, and S9 measures inside the boundary only.

Numbering

Pieces from decisions taken after the October rebuild are numbered after everything else, the edge included. Confirming or rejecting one of them then never changes another id.

Joining an added path

Each end of an added path joins whatever is nearest within 25 m: a junction, or a street that gets cut at that spot. A junction wins when it is at most 5 m further away. A street dead end within 25 m of the middle of a path is joined to it too, which is how the Allées reach the canal. A decision taken from a photo may instead name the street to join, and reach up to 60 m.

Two ideas behind it

To decide whether a point lies inside the study area, imagine a line going right from it and count how many times it crosses the outline. An odd count means inside. The method is called ray casting, and S1 applies it to the halfway point of each segment.

Start at one junction and take every allowed move, then every move from each place you reached, and so on. The method is called breadth-first search, and each round is one step. The reach view in the Lab plays it round by round.

Tests

Seven checks

Each test asks one question about the network. When the answer is wrong, the test names what failed and where.

Question Answer
T1 Does every segment have a length and two different ends? yes
T2 Can a pedestrian reach every junction? yes
T3 Where are the dead ends? 2, at Rue Dalhousie (C03) and the east end of Rue des Bassins (C09), both confirmed
T4 Can a car get from anywhere to anywhere, obeying one-way streets? yes
T5 Can every segment be traced to its source? yes
T6 Is every street cut at every junction? yes
T7 Do any lines cross without a junction? only the overpass of Autoroute 10 over Rue de la Commune, confirmed (C01)

T2 and T4 treat the city as connected beyond the exits. T5 matters for later systems, because they join their data to S1 through the city’s ids. The Lab shows the latest results.

Reach, in the Lab

T2 and T4 ask the question for every junction at once. To watch one case, open the Lab at Rue Peel and Rue Wellington (J080) and press play. Each step goes one junction further. You can switch between on foot and by car, and choose whether the city beyond the exits counts. Clicking any other junction starts from there.

From J080, the walker reaches all 212 walkable segments in 18 steps. The car reaches 181 of 182 drivable segments without leaving the area. The last one, Boulevard Georges-Vanier (white dashed), can only be reached by leaving Griffintown and coming back in. The cause lies in where the boundary is drawn; the data is fine.

Steps count junctions. Distances in metres are in the route tool on S1 Streets, and time comes later, when S9 gives its imagined walkers and cars a speed.