Okay, so as ussual I'm having a lot of problems with a code and I need a lot of help along the way, but I'm just going to break it down into simple questions as I go. I am taking data from an input file that is a .txt that I need to form into a graph to perform Dijkstra’s shortest path algoritum on. The input file is formatted as such:
- Vertices:
Location1, Location2, Location3, … ,LocationN
Edges:
(Location1, Location2, IntegerWeightValue)
(Location2, Location3, IntegerWeightValue)
…
(Location1, LocationN, IntegerWeightValue)*
1.) I know I can skip the first line with just a call of "std::getline(fin,tempString);" so that gets me past the line that is just "Vertices:" and the next line is the name of everynode, so I figured I could just take that whole line as a string and the data values already being seperated by camas call something like "enum nodes {permString};" to make them all the name of a node, but I get an error about reallocating permString from data. Followed by another "std::getline(fin,tempString);" to get past "Edges:".
2.) Next I know I can input the whole line one at a time and use the data from make edges, but I'm not sure how to remove the "()" from the outside of the statments and how to go about putting it all in a form that the boost function for Dijkstra’s shortest path algoritum can handle....
I'm acually really lost, I've tried doing all of these things I several diffrent ways, I found a code example that worked online, but I needed to know how large the file was going to be, and the ewxample didn't use input files, and all the other code examples I've found use .gr files... Any help you can throw my way would be awesome.
tl;dr: just wanna list some lines of code:
how to take in (some, stuff, num) and place that data in a graph useable by boost function for Dijkstra’s shortest path algoritum