title: find minimum spanning tree using depth first search in C
body: <p>I'm trying to implement an algorithm in c which finds MST using DFS. I've already found the DFS algortihm and i understand it pretty well. I also know that i should follow these steps to achieve my purpose :</p>
  
  <p>1 Run DFS till you find an edge going backwards or DFS stopped. If stopped return G.</p>
  
  <p>2 On the circle that is constructed by the backwards going edge find the heaviest edge and remove it from G.</p>
  
  <p>3 Return to 1.</p>
  
  <p>Here is the DFS code :</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void DFS(int);
  int G[10][10],visited[10],n;    //n is no of vertices and graph is sorted in array G[10][10]
  void main()
  {
      int i,j;
  
  printf("Enter number of vertices:");
  scanf("%d",&amp;n);
  
      //read the adjecency matrix
      printf("\nEnter adjecency matrix of the graph:");
      for(i=0;i&lt;n;i++)
          for(j=0;j&lt;n;j++)
              fscanf("%d",&amp;G[i][j]);
  
      //visited is initialized to zero
      for(i=0;i&lt;n;i++)
          visited[i]=0;
  
      DFS(0);
  }
  void DFS(int i)
  {
      int j;
  printf("\n%d",i);
  visited[i]=1; // éviter cycle
  for(j=0;j&lt;n;j++)
      if(!visited[j]&amp;&amp;G[i][j]==1)
          DFS(j);
  }
  </code></pre>
  
  <p>I need your help to implement the full algorithm or at least some advices. That would be much appreciated. Thank's in advance.</p>