team.bernard - Sunday, October 22, 2017 5:41 AM
The logic is pretty simple for such a DAG (Directed Acyclic Graph). The FROM node column should be unique. Any non-unique value is a candidate for possibly being an error.
You should also add a self-referencing FK stipulating that no TO node can exist unless it first exists as a FROM node. That also means that you're listing your nodes backwards if the source of electricity starts at node 1.
To wit, the nodes should be listed as follows as FROM/TO because node 1 is the source of power and should be the root of the tree.
1,NULL
4,1
2,4
5,4
3,5
6,5
7,6
--Jeff Moden
Change is inevitable... Change for the better is not.