i have a graph file as
3200
12 16
114 61
37 465
.
.
.
and it goes like this.
the first number is vertexNumber other integers represents vertices and we have an edge between them. for example myMatrix[12][16] = 1 and myMatrix[16][12] = 1
i used ifstream to read the graph.txt (ifstream theGraphFile("graph.txt", ios::in);
) and created a bool matrix with a constant size like 10000
my pattern for my purpose is this:
while( getline( theGraphFile, line ) )
{
if (line[1])
continue;
else
{
//parse
//matrix
}
}
so my question: how can i seperate those numbers as "before the space and until the end of the line" format. if my string in nth line is 12 51
i want to use them as matrix indexes like myMatrix[12][51] = 1
Thank you.. :)