Hello,

I am trying to learn how to use the JGrapht API and a sample program on the web has the following line on how to create a SimpleGraph:

 SimpleGraph graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);

The above line is clear execpt for the "DefaultEdge.class" in the parenthesis. What's the significance of adding this line in a ".java" file. I have never seen that before. I will be grateful for any help.

Thank you!

I think it gives it the type of edge to use in the graph. In this example it gives it the DefaultEdge code instance by accessing DefaultEdge.class which is basically a class instance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.