solve an exception issue, see document for details
works for small graph, but with problem for larger graph
works for small graph, but with problem for larger graph