title: Minimum Spanning tree from array list
body: <p>I'm wondering if it's possible to find the minimum spanning tree from an ArrayList.</p>
  
  <p>This is what I currently have:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.ArrayList;
  import java.util.Scanner;
  
  
  public class GraphReading 
  {
  public static void main(String[] args) throws FileNotFoundException 
  {
      File f= new File("Bridges.txt");
      Scanner sc= new Scanner(f);
  
      ArrayList &lt; ArrayList&lt;Integer&gt;  &gt;   Vertices = new ArrayList&lt;&gt;();
  
      while(sc.hasNext())
      {
          String Line =     sc.nextLine();
          String numbers[] = Line.split(" ");
  
          ArrayList&lt;Integer&gt;  List = new ArrayList&lt;&gt;();
          for(int i=0;i &lt;  numbers.length ;i++)
          {
                  if(numbers[i].equals("")==false)
                      List.add(  Integer.parseInt( numbers [i]));
          }
          Vertices.add(List);
      }
      printAllvertices(Vertices);
  }
  public static  void printAllvertices(  ArrayList &lt; ArrayList&lt;Integer&gt;  &gt;   Vertices  )
  {
      for(int i=0;i&lt;  Vertices .size();i++)
      {
          System.out.print("Vertice "+i+ " has ");
               ArrayList&lt;Integer&gt;  List =  Vertices.get(i);
               for(int j=0;j&lt;List.size();j++)
               {
                   System.out.print(List.get(j)+" ");
               }
               System.out.println();
  
  
  
  
      }
  
  }
  
  }
  </code></pre>
  
  <p>I was thinking about just finding the minimum number from each of the vertices but I wasn't too sure that would necessarily work the way I wanted it too. </p>