예제 #1
0
 DefaultWeightedEdge addEdge(final Spot source, final Spot target, final double weight) {
   if (!graph.containsVertex(source)) {
     graph.addVertex(source);
   }
   if (!graph.containsVertex(target)) {
     graph.addVertex(target);
   }
   final DefaultWeightedEdge edge = graph.addEdge(source, target);
   graph.setEdgeWeight(edge, weight);
   return edge;
 }
예제 #2
0
 /** @see Graph#edgesOf(Object) */
 public Set<DefaultWeightedEdge> edgesOf(final Spot spot) {
   if (graph.containsVertex(spot)) {
     return graph.edgesOf(spot);
   } else {
     return Collections.emptySet();
   }
 }