void PrintPath(int record[], int ed) {
if (record[ed] != ed) {
PrintPath(record, record[ed]);
cout << " -> ";
}
cout << ed;
}
void PrintAllPathHelper(const MGraph& G, int st, int ed, int record[]) {
if (ed == st) {
PrintPath(record, ed);
}
for (int i = 1; i < G.numVertexes; i++) {
if (G.arc[st][i] > 0 && record[i] == -1) {
record[i] = st;
PrintAllPathHelper(G, i, ed, record);
record[i] = -1;
}
}
}
void PrintAllPath(const MGraph& G, int st, int ed) {
int record[MAXVEX];
for (int i = 1; i < G.numVertexes; i++) {
record[i] = -1;
}
record[st] = st;
PrintAllPathHelper(G, st, ed, record);
}