Graph Databases

Compare two explicit candidate-access strategies

BOTIE

Choose DEPENDS_ON edges and count the teaching loop’s full scans for distinct starts. Keep the definition of this count visible.
Ready to test
0 passed · 0 failed · 2 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Choose DEPENDS_ON edges and count the teaching loop’s full scans for distinct starts. Keep the definition of this count visible.

A tiny answer can hide a scan of unrelated relationships.

Inspect the component calculation
Count full-scan candidate checks(
  Relationships: Choose a relationship type(
    Relationships: Read graph relationships(
      Graph: Maintenance dependency graph
    )
    Relationship type: DEPENDS_ON
  )
  Starting IDs: Requested starting IDs
)
Examples and results
Maintenance dependency graph
The nodes and directed relationships in this value.Records: P7; Asset. S1; Asset. P8; Asset. Relationships: P7 to S1: DEPENDS_ON. P8 to P7: DEPENDS_ON. Full records and relationships are also listed below the diagram.P7 to S1: DEPENDS_ONDEPENDS_ONDEPENDS_ONP8 to P7: DEPENDS_ONDEPENDS_ONDEPENDS_ONP7P7AssetAssetS1S1AssetAssetP8P8AssetAsset
Nodes and properties (3)
  • P7 · Asset
  • S1 · Asset
  • P8 · Asset
  • P7 to S1: DEPENDS_ON
  • P8 to P7: DEPENDS_ON
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "P7",
      "kind": "Asset"
    },
    {
      "id": "S1",
      "kind": "Asset"
    },
    {
      "id": "P8",
      "kind": "Asset"
    }
  ],
  "edges": [
    {
      "id": "d1",
      "source": "P7",
      "target": "S1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "d2",
      "source": "P8",
      "target": "P7",
      "type": "DEPENDS_ON"
    }
  ]
}
Requested starting IDs
  1. 0P7
Required result
2
Maintenance dependency graph
The nodes and directed relationships in this value.Records: P7; Asset. S1; Asset. P8; Asset. Relationships: P7 to S1: DEPENDS_ON. P8 to P7: DEPENDS_ON. Full records and relationships are also listed below the diagram.P7 to S1: DEPENDS_ONDEPENDS_ONDEPENDS_ONP8 to P7: DEPENDS_ONDEPENDS_ONDEPENDS_ONP7P7AssetAssetS1S1AssetAssetP8P8AssetAsset
Nodes and properties (3)
  • P7 · Asset
  • S1 · Asset
  • P8 · Asset
  • P7 to S1: DEPENDS_ON
  • P8 to P7: DEPENDS_ON
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "P7",
      "kind": "Asset"
    },
    {
      "id": "S1",
      "kind": "Asset"
    },
    {
      "id": "P8",
      "kind": "Asset"
    }
  ],
  "edges": [
    {
      "id": "d1",
      "source": "P7",
      "target": "S1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "d2",
      "source": "P8",
      "target": "P7",
      "type": "DEPENDS_ON"
    }
  ]
}
Requested starting IDs
  1. 0P7
  2. 1P8
Required result
4
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

These components operate on the supplied records in your browser. They do not run a graph database or interpret Cypher. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.

An isolated starting asset still costs a scan

This check uses the pieces from “Compare outgoing adjacency candidates”.

BOTIE

There are five DEPENDS_ON edges: two leave R1, one leaves R2 and two leave R3. The request contains R1, isolated R4 and R1 again. One additional NEAR edge leaves R4. Predict full-scan candidate checks first and outgoing-adjacency candidates second after selecting the dependency type.
Maintenance dependency graph
The nodes and directed relationships in this value.Records: R1; Asset. R2; Asset. R3; Asset. R4; Asset. S1; Asset. S2; Asset. Relationships: R1 to S1: DEPENDS_ON. R1 to S2: DEPENDS_ON. R2 to S1: DEPENDS_ON. R3 to S1: DEPENDS_ON. R3 to S2: DEPENDS_ON. R4 to S2: NEAR. Full records and relationships are also listed below the diagram.R1 to S1: DEPENDS_ONDEPENDS_ONDEPENDS_ONR1 to S2: DEPENDS_ONDEPENDS_ONDEPENDS_ONR2 to S1: DEPENDS_ONDEPENDS_ONDEPENDS_ONR3 to S1: DEPENDS_ONDEPENDS_ONDEPENDS_ONR3 to S2: DEPENDS_ONDEPENDS_ONDEPENDS_ONR4 to S2: NEARNEARNEARR1R1AssetAssetR2R2AssetAssetR3R3AssetAssetR4R4AssetAssetS1S1AssetAssetS2S2AssetAsset
Nodes and properties (6)
  • R1 · Asset
  • R2 · Asset
  • R3 · Asset
  • R4 · Asset
  • S1 · Asset
  • S2 · Asset
  • R1 to S1: DEPENDS_ON
  • R1 to S2: DEPENDS_ON
  • R2 to S1: DEPENDS_ON
  • R3 to S1: DEPENDS_ON
  • R3 to S2: DEPENDS_ON
  • R4 to S2: NEAR
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "R1",
      "kind": "Asset"
    },
    {
      "id": "R2",
      "kind": "Asset"
    },
    {
      "id": "R3",
      "kind": "Asset"
    },
    {
      "id": "R4",
      "kind": "Asset"
    },
    {
      "id": "S1",
      "kind": "Asset"
    },
    {
      "id": "S2",
      "kind": "Asset"
    }
  ],
  "edges": [
    {
      "id": "a",
      "source": "R1",
      "target": "S1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "b",
      "source": "R1",
      "target": "S2",
      "type": "DEPENDS_ON"
    },
    {
      "id": "c",
      "source": "R2",
      "target": "S1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "d",
      "source": "R3",
      "target": "S1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "e",
      "source": "R3",
      "target": "S2",
      "type": "DEPENDS_ON"
    },
    {
      "id": "near",
      "source": "R4",
      "target": "S2",
      "type": "NEAR"
    }
  ]
}
Requested starting IDs
  1. 0R1
  2. 1R4
  3. 2R1

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

What work is excluded from these counters, and what would you measure in a real query plan?

Keep operation counts, plan statistics and latency measurements distinct.

These components operate on the supplied records in your browser. They do not run a graph database or interpret Cypher.

Work through the Python challenges →
Continue the courseCan Two Teams Describe the Same Resource? →