implemented reachability q in cypher