Build your own knowledge graph database
Does it scale? + the RDF road not taken·12 min

Bacon number ≤ 2 (variable-length finale)

0 / 1
# grade this stage (from your course directory)
npx theinference test --stage bacon-number-two --watch

The variable-length finale: everyone within 2 ACTED_IN hops of Kevin Bacon — the literal "Bacon number ≤ 2" set. This exercises the var-length executor (*1..2) you wired up, with relationship isomorphism keeping the paths honest. Same engine, one new query.

Your task

Run the var-length query

A [:ACTED_IN*1..2]-(p:Person) pattern reaches every person within one or two ACTED_IN hops of Bacon (1 hop lands on movies, 2 hops on co-stars), with DISTINCT collapsing repeats and ORDER BY name fixing the order.

bash
your_program.sh query {fixture}/fixtures/data/nodes.json {fixture}/fixtures/data/relationships.json "MATCH (bacon:Person {name:'Kevin Bacon'})-[:ACTED_IN*1..2]-(p:Person) WHERE p.name <> 'Kevin Bacon' RETURN DISTINCT p.name AS name ORDER BY name"
# -> the 15 people with Bacon number 1
It should match the co-star set

Because every 2-hop ACTED_IN path from Bacon goes Person→Movie→Person, the *1..2 result (filtered to :Person) is exactly the 15 co-stars from the capstone. If they differ, your var-length walk is either dropping the :Person label filter or leaking a reused relationship.

How it's graded

Process mode, stdout_json_match (ordered, ORDER BY name). The var-length match must enforce relationship isomorphism so the path can't bounce back over the same ACTED_IN edge — otherwise Kevin re-enters the result and the count is wrong.