Several changes in Kruskal alg.
- Input object interface was changed to an STL compatible one.
- template parameters of class KruskalPairVec has been simplified.
- (the most of) the names meet the naming conventions.
- a lot of (but still not enough) documentation has been added.
- class KruskalMapVec has been commented out.
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]);