25 lines
642 B
C++
25 lines
642 B
C++
#include "Graph.h"
|
|
#include <iostream>
|
|
|
|
int main(int argc, char* argv[]) {
|
|
if (argc < 3) return 0;
|
|
|
|
Graph g;
|
|
g.readGraph(argv[1]);
|
|
if (g.size() == 0) return 0;
|
|
|
|
if (!g.isDirected() && g.isWeighted()) {
|
|
g.getSpaingTreeKruscal().writeGraph(argv[2]);
|
|
} else if (g.isDirected() && g.isWeighted()) {
|
|
g.flowDinitz(1, g.size()).writeGraph(argv[2]);
|
|
} else {
|
|
bool circleExist = false;
|
|
int start = g.checkEuler(circleExist);
|
|
if (start != 0) {
|
|
for (int v : g.getEuleranTourEffective()) std::cout << v << ' ';
|
|
std::cout << '\n';
|
|
}
|
|
}
|
|
return 0;
|
|
}
|