Need help with minimum spanning tree

I need to start program that counts from top branch wich is: 1, this program counts from 0, could anyone help? Here is the code:
#include <iostream>
#include <climits>
#define V 7

using namespace std;


class Graph
{
private:
int parent[V], dist[V];
bool mark[V];
int src = 1;
int i, v, count;
public:
int graph[V][V] =
{
{0, 2, 0, 1, 4, 0, 0},
{2, 0, 0, 3, 1, 0, 0},
{4, 0, 0, 2, 2, 5, 0},
{1, 3, 2, 0, 7, 8, 4},
{0, 10, 7, 7, 0, 0, 6},
{0, 8, 5, 8, 0, 0, 1},
{4, 0, 0, 4, 6, 1, 0}
};
int minDist();
void MST();
void printMST();
};
int main()
{
Graph G;
G.MST();
G.printMST();
return 0;
}
int Graph::minDist()
{
int min = INT_MAX, min_index;

for(int v=0; v<V; v++)
if(!mark[v] && dist[v]<min)
{
min = dist[v];
min_index = v;
}
return min_index;
}

void Graph::MST()
{
for(i=0; i<V; i++)
{
dist[i] = INT_MAX;
mark[i] = false;
}

dist[0] = 0;
parent[0] = -1;

for(count=0; count<V-1; count++)
{
int u = minDist();
mark[u] = true;

for(v=0; v<V; v++)

if(graph[u][v] && mark[v] == false && graph[u][v] < dist[v])
parent[v] = u, dist[v] = graph[u][v];
}
}
void Graph::printMST()
{
cout << "\n Dijkstros - Primo algoritmas\n";
cout << "\"Minimalaus dengianciojo medzio radimas\"\n\n";
cout << "\tBriauna Atstumas\n\n";
for(i=1; i<V; i++)
cout << "\t " << parent[i] << " - " << i << "\t " << graph[i][parent[i]] << "\n";
}
I'm confused. It sounds to me like you are having trouble because your nodes are numbered from zero, and your output lists a node as 0, 1, 2, etc instead of 1, 2, 3, etc. Is that it?
Topic archived. No new replies allowed.