Last active
December 10, 2015 00:19
-
-
Save Bekt/4350540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://coolcodebro.blogspot.com/2012/12/find-out-whether-there-is-route-between.html | |
boolean isRoute(Vertex source, Vertex target) { | |
if(source == null) | |
return false; | |
if(source.equals(target)) | |
return true; | |
source.visited = true; | |
for (Edge edge : source.adj) { | |
if(!edge.target.visited) { | |
if(isRoute(edge.target, target)) | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment