if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
algorithm = new BellmanFordShortestPathAlgorithm((DirectedGraph) gc.getModel().getGraphVisible(), sourceNode);
} else {
algorithm = new DijkstraShortestPathAlgorithm(gc.getModel().getGraphVisible(), sourceNode);
}
algorithm.compute();
double distance;
if ((distance = algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) {
targetNode.getNodeData().setColor(colorArray[0], colorArray[1], colorArray[2]);
VizController.getInstance().selectNode(targetNode);