首页 > 编程语言 > 详细

广度优先搜索算法

时间:2021-02-15 23:01:59      阅读:20      评论:0      收藏:0      [点我收藏+]
 1 #ifndef _VERTEX_H_
 2 #define _VERTEX_H_
 3 #include <ostream>
 4 
 5 enum BFS_VERTEX_COLOR {
 6     WHITE,
 7     GRAY,
 8     BLACK,
 9 };
10 
11 struct Vertex {
12     int index;
13     BFS_VERTEX_COLOR color = WHITE;
14     int d = -1;
15     int pre_index = -1;
16 
17     bool operator==(const Vertex& v) {
18         return index == v.index;
19     }
20 
21     void set(BFS_VERTEX_COLOR color, int d, int pre_index) {
22         this->color = color;
23         this->d = d;
24         this->pre_index = pre_index;
25     }
26 };
27 
28 std::ostream & operator<<(std::ostream & os, const Vertex &v);
29 
30 #endif

 

广度优先搜索算法

原文:https://www.cnblogs.com/ren-yu/p/14403975.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!