8 template<typename Graph>
9 void LoadGraph(Graph &G, char *filename) {
11 if ((file = fopen(filename, "r")) == NULL) {
12 printf("Could not open %s\n", filename);
16 std::map<int, typename Graph::NodeIt> nmap;
18 while (fgets(line, LINE_LEN, file)) {
21 nmap[atoi(line + 1)] = G.addNode();
26 while (isspace(line[i])) i++;
27 while (isdigit(line[i])) i++;
29 if (nmap.find(n1) == nmap.end()) {
30 nmap[n1] = G.addNode();
32 if (nmap.find(n2) == nmap.end()) {
33 nmap[n2] = G.addNode();
35 G.addEdge(nmap[n1], nmap[n2]);