0

I currently have a program that can take a text file and inport the data that I need (names or locations as well as the distances between them) and I need to take that data and for a graph in boost so that I can do one of three things, use Dijkstra’s to find the shortest path between two nodes, use a minimum spanning tree to figure out the shortest way to connect every node, and how to visit every node only once on the shortest path.

I import the data as follows:

```
std::getline(fin, tempString); //Location1, Location2, ...
std::stringstream tempSS(tempString);
while (std::getline(tempSS,tempName1, ',')){
//replace with what I need to do with the vertex names
std::cout << "got name: " << tempName1 << std::endl;
}
```

gives we the locations names one at a time.

```
while (std::getline(fin,tempString)){ // (Location1, Location2, 6)
//remove parentheses
tempString.erase( tempString.begin(), tempString.begin() + tempString.find('(') + 1 );
tempString.erase( tempString.begin() + tempString.find(')'), tempString.end() );
std::stringstream temp_ss(tempString);
std::getline(temp_ss, tempName1, ',');
std::getline(temp_ss, tempName2, ',');
```

gives me the data for the edges of the graph.

what I don't know is how to take those loops and use the data to form a graph in boost that can handle the algorithms I need to use. any help would be greatly loved.