Find all paths from one node to another in an undi

2019-09-17 22:40发布

问题:

So I have a graph in the form of an adjacency list, structured as in the code below. Given this form of a data structure, I was wondering how it would be possible to go about finding and printing all the possible paths from a given node to another node. I'm aware I might have to used stacks to perform a DFS or queues to perform BFS, which I know how to do, but am confused by how to find all the possible paths

typedef struct graph {
    int n, maxn;
    Vertex** vertices;
}Graph;

typedef struct vertex {
    char* label;
    Edge* first_edge;
}Vertex;

typedef struct edge {
    int u, v;
    int weight;
    Edge* next_edge;
}Edge ;