introduce basic sanity checking of the graph.