src/main/java/org/jboss/util/graph/Graph.java
public boolean addEdge(Vertex<T> from, Vertex<T> to, int cost)
      throws IllegalArgumentException
   {
      if( verticies.containsValue(from) == false )
         throw new IllegalArgumentException("from is not in graph");
      if( verticies.containsValue(to) == false )
         throw new IllegalArgumentException("to is not in graph");

      Edge<T> e = new Edge<T>(from, to, cost);
      if (from.findEdge(to) != null)
         return false;
      else
      {
         from.addEdge(e);
         to.addEdge(e);
         edges.add(e);
         return true;
      }
   }
public boolean addEdge(Vertex<T> from, Vertex<T> to, int cost)
      throws IllegalArgumentException
   {
      if( verticies.containsValue(from) == false )
         throw new IllegalArgumentException("from is not in graph");
      if( verticies.containsValue(to) == false )
         throw new IllegalArgumentException("to is not in graph");

      Edge<T> e = new Edge<T>(from, to, cost);
      if (from.findEdge(to) != null)
         return false;
      else
      {
         from.addEdge(e);
         to.addEdge(e);
         edges.add(e);
         return true;
      }
   }
Insert a directed, weighted Edge<T> into the graph.

@param from - the Edge<T> starting vertex
@param to - the Edge<T> ending vertex
@param cost - the Edge<T> weight/cost
@return true if the Edge<T> was added, false if from already has this Edge<T>
@throws IllegalArgumentException if from/to are not verticies in
the graph