Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

i need 6 3 7 .

Answered: 1 week ago

Question

Is the subject line effective? Why or why not?

Answered: 1 week ago

Question

Does the writer use an emotional appeal or a logical appeal? Why?

Answered: 1 week ago