I wanted to know about the right way to extend the SimpleWeightedGraph from JgraphT library so that I could use a simplified alias and also include additional functionalities as required.
Instead of creating a new graph each time using
SimpleWeightedGraph<Node, DefaultWeightedEdge> graph
= new SimpleWeightedGraph<Node, DefaultWeightedEdge>(DefaultWeightedEdge.class);
I created a class
public class CustomGraph extends SimpleWeightedGraph<Node, DefaultWeightedEdge>{
public CustomGraph(){
super(DefaultWeightedEdge.class);
}
/*Additional custom methods*/
}
So that I can instantiate using
CustomGraph graph = new CustomGraph();
But this doesn't seem to create the object. Am i missing any other constructor for this?
Ok I figured it out. Here is the class with the edgefactory constructors that had to be included.