I am tempted to do such kind of code, using jGraphT
/*
  interface DirectedGraph<V,E> { ...}
  interface WeightedGraph<V,E> { ...}
*/
public class SteinerTreeCalc  {
    public SteinerTreeCalc( < ??? implements DirectedGraph<V,E>, WeightedGraph<V,E> > graph )  {
     ......
    }
}
I want to create a constructor that ask for an object implementing two interfaces.
Update :
In my goal, there are already chosen classes for Vertex and Edges (V and E), but thanks a lot to people who come up with :
public class SteinerTreeCalc <V, E, T extends DirectedGraph<V, E> & WeightedGraph<V, E>>  
{ 
   ....
}
 
     
     
     
     
     
    