Refactored the sparse path check out of the graph database.