Graphs and Relational Learning

Count the network’s connections

BOTIE

Add the entries in each adjacency row.
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

Add one connection to the adjacency matrix. For an undirected graph, change the mirrored entry too. Predict which nodes' neighbour counts will change before checking the output.

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

Add the entries in each adjacency row.

Botie needs each pump's number of neighbours while preserving which adjacency row belongs to which pump.

Add each row of the undirected binary adjacency matrix separately.

Examples and results
Undirected binary adjacency matrix
010
101
010
Required result
  1. 01
  2. 12
  3. 21
Undirected binary adjacency matrix
01
10
Required result
  1. 01
  2. 11
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

For weighted graphs, row sums measure total weight instead of neighbour count. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

A hub connects three instruments

This check uses the pieces from “Count neighbours without merging pump identities”.

BOTIE

Botie records an undirected network of four instruments. The first is connected to each of the others, which have no connections between themselves. Calculate the degree of every node from the adjacency rows.
Undirected binary adjacency matrix
0111
1000
1000
1000

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 would row totals mean if the adjacency entries represented connection weights instead of binary edges?

A graph matrix's entry meaning determines whether its sum measures neighbour count or total connection weight.

For weighted graphs, row sums measure total weight instead of neighbour count.

Work through the Python challenges →
Continue the courseFollowing Probability Through a Network →