Prim's minimal spanning algorithm
Just some points:


Naming:

What does mstv mean? I assumed that ms in mstv stands for minimal spanning, but what is tv then? Television?

Try clearing that up with a more "reasonable" name.
Bad Practices:

This is definitely prone to bugs:


    for (int j = 0; j &lt; gSize; j++)
        if (mstv[j])
            for (int k = 0; k &lt; gSize; k++)
                if (!mstv[k] &amp;&amp; weights[j][k] &lt; minWeight)
                {
                    endVertex = k;
                    startVertex = j;
                    minWeight = weights[j][k];
                 }



Even though there might be no bugs in the code above, accidental mistakes do occur more if you lack braces.

Instead, add the braces, which makes the code both more readable and less error-prone:

for (int j = 0; j &lt; gSize; j++) {
    if (mstv[j]) {
        for (int k = 0; k &lt; gSize; k++) {
            if (!mstv[k] &amp;&amp; weights[j][k] &lt; minWeight) {
                endVertex = k;
                startVertex = j;
                minWeight = weights[j][k];
            }
        }
    }
}


(Note that this is using my coding habits; you may move the braces where you are comfortable with)