title: Create graph using Jgraph
body: <p>I want to create a graph using Jgraph, and later use that graph to find the minimum spanning Tree. </p>
  
  <p>How to create a graph using Jgraph?.</p>
  
  <hr>
  
  <p>this is what I have implemented.  Can you please tell me how to use kruskals algorithm from the package. I googled it, but couldn't find any information on it.</p>
  
  <pre><code>import org.jgrapht.*;
  import org.jgrapht.graph.*;
  
  public class MyGraph {
      UndirectedGraph&lt;String, DefaultEdge&gt; g = new SimpleGraph&lt;String, DefaultEdge&gt;     (DefaultEdge.class);
  
      public void addVertex(String name)  {
          // name=new String();
          g.addVertex(name);
      }
  
      public void addEdge(String v1,String v2) {
          g.addEdge(v1, v2);
      }
  
      public UndirectedGraph&lt;String, DefaultEdge&gt; getGraph() {
          return g;
      }
  }
  </code></pre>