Graph Databases

Follow the dependency in the requested direction

BOTIE

Read graph relationships and retain DEPENDS_ON records. Inspect each source and target before selecting the requested asset.
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

Read graph relationships and retain DEPENDS_ON records. Inspect each source and target before selecting the requested asset.

Botie needs what this pump requires, not everything connected to it.

Inspect the component calculation
Choose a relationship type(
  Relationships: Read graph relationships(
    Graph: Equipment graph
  )
  Relationship type: DEPENDS_ON
)
Examples and results
Equipment 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"
    }
  ]
}
Required result
[
  {
    "id": "d1",
    "source": "P7",
    "target": "S1",
    "type": "DEPENDS_ON"
  },
  {
    "id": "d2",
    "source": "P8",
    "target": "P7",
    "type": "DEPENDS_ON"
  }
]
Equipment 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"
    }
  ]
}
Required result
[
  {
    "id": "d1",
    "source": "P7",
    "target": "S1",
    "type": "DEPENDS_ON"
  },
  {
    "id": "d2",
    "source": "P8",
    "target": "P7",
    "type": "DEPENDS_ON"
  }
]
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.

A second dependency arrives beside a repeated record

This check uses the pieces from “Answer the outgoing one-hop question”.

BOTIE

Pump R1 now depends on both S4 and S2. A second edge repeats S4, R8 depends on R1, and a NEAR edge points to S9. Predict the distinct, sorted resources that R1 directly requires.
Equipment graph
The nodes and directed relationships in this value.Records: R1; Asset. R8; Asset. S4; Asset. S2; Asset. S9; Asset. Relationships: R1 to S4: DEPENDS_ON. R1 to S2: DEPENDS_ON. R1 to S4: DEPENDS_ON. R8 to R1: DEPENDS_ON. R1 to S9: NEAR. Full records and relationships are also listed below the diagram.R1 to S4: DEPENDS_ONDEPENDS_ONDEPENDS_ONR1 to S2: DEPENDS_ONDEPENDS_ONDEPENDS_ONR1 to S4: DEPENDS_ONDEPENDS_ONDEPENDS_ONR8 to R1: DEPENDS_ONDEPENDS_ONDEPENDS_ONR1 to S9: NEARNEARNEARR1R1AssetAssetR8R8AssetAssetS4S4AssetAssetS2S2AssetAssetS9S9AssetAsset
Nodes and properties (5)
  • R1 · Asset
  • R8 · Asset
  • S4 · Asset
  • S2 · Asset
  • S9 · Asset
  • R1 to S4: DEPENDS_ON
  • R1 to S2: DEPENDS_ON
  • R1 to S4: DEPENDS_ON
  • R8 to R1: DEPENDS_ON
  • R1 to S9: NEAR
Inspect the node and relationship records
{
  "nodes": [
    {
      "id": "R1",
      "kind": "Asset"
    },
    {
      "id": "R8",
      "kind": "Asset"
    },
    {
      "id": "S4",
      "kind": "Asset"
    },
    {
      "id": "S2",
      "kind": "Asset"
    },
    {
      "id": "S9",
      "kind": "Asset"
    }
  ],
  "edges": [
    {
      "id": "d1",
      "source": "R1",
      "target": "S4",
      "type": "DEPENDS_ON"
    },
    {
      "id": "d2",
      "source": "R1",
      "target": "S2",
      "type": "DEPENDS_ON"
    },
    {
      "id": "repeat",
      "source": "R1",
      "target": "S4",
      "type": "DEPENDS_ON"
    },
    {
      "id": "incoming",
      "source": "R8",
      "target": "R1",
      "type": "DEPENDS_ON"
    },
    {
      "id": "nearby",
      "source": "R1",
      "target": "S9",
      "type": "NEAR"
    }
  ]
}
Starting asset ID
R1

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 exact question would reversing the endpoint match answer?

State the relationship meaning and direction before expanding a graph.

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 courseAre These Two Pumps Actually the Same Pump? →