assertion to check that each node is connected to the graph