如何遍历邻接列表

时间:2016-06-27 09:54:23

标签: c++ c algorithm traversal adjacency-list

这是adjList的结构

typedef struct _node
{
    int weight;
    int label;
    struct _node *next;
} EdgeNode;
typedef struct _vnode
{
    int id;
    EdgeNode *firstedge;
} VertexNode;
typedef VertexNode AdjList[MAX];

图形无环路,输入是入度为零的节点 如何遍历(输出)该图的所有路径?

例如,adjList是
1→2→3
2→4
3→4

输出是
path_1:1-> 2-> 4
path_2:1-> 3-> 4

0 个答案:

没有答案