title: Prim MST with Adjacency Matrix as parameter
body: <p>I'm working with Prim MST in C and the function takes an adjacency matrix. Given the weight of course in <code>A[i][j]</code>.</p>
  
  <p>Suppose I have a predecessor array that tracks down the minimum edges i Have found so far.
  <code>predecessor[u]=v</code> {this is also the final MST}</p>
  
  <p>Now I want to modify the current <code>A[i][j]</code> matrix and change the weights to 1. 
  That is when the edges (indexes) also existed in the predecessor array.
  Otherwise I change it to zero.</p>
  
  <p>How would I do it? Here's my solution:</p>
  
  <pre><code>for (x....)
     for (y...)
        if (x!=y &amp;&amp; (p[x]==y || p[y]==x))
           set to 1
        else
           set to 0
  </code></pre>