Question: I need help with reading in a complete undirected graph in c + + . the file given to us represents a complete undirected graph

I need help with reading in a complete undirected graph in c++.
the file given to us represents a complete undirected graph forming a lower trianglular matrix. You should be able to reflect along the diagonal to complete your graph.
Here is my current not working implementation.
vector> graph;
int distance;
while (inputFile >> distance){
vector row;
// Read distances until a zero is encountered
while (distance !=0){
row.push_back(distance);
inputFile >> distance;
}
// Add the row to the graph
graph.push_back(row);
}
Here are a few lines from the 100 node graph
0
30320
25282108050
9962367938245960
20974116268390162209270
410137342689231817105517351680
5411034632223326061763717864491250
90506180333762781240446124784496937472900
10571109469727554895077883284931503568579861520
14412981312298108508778306755370931391821618363584302110

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!