• The logic is that I made a void function to find start and endpoint of each lines.

    But the way isn't correct because for the line 'E', the link to go to the node 7 is broken, so it's need to be switched, so the node 7 will have electricity.

    The sort order is topological, but I can't find a query to obtain "broken" lines to which prevent to have a working network.

    Regards