Inspect ZRP zones and bordercasts
Print intra-zone tables, trace bordercasts and compare radius costs with reproducible failure checks.

Blueprint Bina: I want you to inspect the failed case and the record that explains the next decision.
Predict the reading, then compare it with the measurement.
Python 3 in your browser (JupyterLite)
Python · no installPrint intra-zone tables, trace bordercasts and compare radius costs with reproducible failure checks.
Open the notebook in your browser and run each Python cell; no install or account is needed.
Three ways to run: use JupyterLite here with no install; run main.py locally from the downloadable lab folder; or open the same notebook in Google Colab.
Steps
Step 1
- Do
- Run python main.py and inspect step 1: freeze the legacy topology.
- You will see
- 15 nodes: three rows x five columns; horizontal and vertical unit links; rows: 0 1 2 3 4 / 5 6 7 8 9 / 10 11 12 13 14. STEP 1 scenario-contract ready
- Why it matters
- The exact legacy adjacency graph has a six-hop diameter. Keeping that separate from its eight-hop emergency example prevents mixing assumed and measured values.

Step 1 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- Run python main.py and inspect step 2: print radius-2 intra-zone tables: nodes 0-7.
- You will see
- node destination:next-hop/hops (self omitted); 0 1:1/1 2:1/2 5:5/1 6:1/2 10:5/2. STEP 2 local tables 0-7 complete
- Why it matters
- IARP stores local next hops and distances. These first eight tables show which destinations are ready without reactive discovery.

Step 2 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Run python main.py and inspect step 3: print radius-2 intra-zone tables: nodes 8-14.
- You will see
- node destination:next-hop/hops (self omitted); 8 2:3/2 3:3/1 4:3/2 6:7/2 7:7/1 9:9/1 12:7/2 13:13/1 14:9/2. STEP 3 local tables 8-14 complete
- Why it matters
- The remaining seven tables complete the network record. Zone-edge membership explains who can receive bordercast queries.

Step 3 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Run python main.py and inspect step 4: follow local lookup and out-of-zone bordercast.
- You will see
- Local 0->6: path=[0, 1, 6] queries=0; origin border query_hops. STEP 4 bordercast measured
- Why it matters
- A local target needs no bordercast. An external target pays query and reply work, and duplicate suppression bounds each query recipient.

Step 4 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- Run python main.py and inspect step 5: compare radius costs on the same workload.
- You will see
- r entries refresh queries query_tx reply total; 1 44 15 13 13 6 34. STEP 5 radii 1,2,3 compared
- Why it matters
- Larger zones trade more proactive refresh and memory for fewer reactive queries. Count hop transmissions as well as border recipients.

Step 5 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- Run python main.py and inspect step 6: detect degeneration and check the legacy arithmetic.
- You will see
- r=10 >= diameter 6; node-0 zone size=15; Node-0 border=[]; reactive queries=0. STEP 6 overlarge zone diagnosed
- Why it matters
- A radius beyond network diameter eliminates the reactive half of ZRP. The supplied overhead arithmetic is illustrative, separate from this run’s packet counts.

Step 6 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- Run python main.py and inspect step 7: validate faults and fresh local tables.
- You will see
- one-hop: forward=[0, 1] reverse=[1, 0] PASS; partition: forward=None reverse=None PASS. STEP 7 fault checks PASS
- Why it matters
- A one-hop oracle, a disconnected graph, asymmetric links and a removed edge test different failure assumptions. Fresh zones must not silently reuse obsolete paths.

Step 7 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 8
- Do
- Run python main.py and inspect step 8: replay 30 edge-loss seeds with matched input.
- You will see
- seeds=42..71; independent edge-loss probability=0.12; Reachable radius-runs=81/90; reachability oracle agrees for all 90. STEP 8 validation PASS
- Why it matters
- Matching edge-loss seeds across radii isolates radius choice. A reachability oracle checks correctness; a physical testbed is needed to measure radio performance.

Step 8 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A sensor network has frequent local traffic and occasional distant messages. Which ZRP feature matches that pattern?
Return to the chapter’s knowledge checkA team enlarges ZRP zones to reduce discovery traffic. Which cost should it expect to review?
Return to the chapter’s knowledge check