当前位置: 首页 > 文档资料 > 算法珠玑 >

graph/README

优质
小牛编辑
131浏览
2023-12-01

图节点定义

无向图的节点定义如下:

// 无向图的节点
class UndirectedGraphNode {
    int label;
    ArrayList<UndirectedGraphNode> neighbors;
    UndirectedGraphNode(int x) { label = x;}
};
// 无向图的节点
struct UndirectedGraphNode {
    int label;
    vector<UndirectedGraphNode *> neighbors;
    UndirectedGraphNode(int x) : label(x) {};
};