7 Star 32 Fork 21

空無一悟 / algorithms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Main.java 932 Bytes
一键复制 编辑 原始数据 按行查看 历史
空無一悟 提交于 2021-09-22 23:47 . init
/***********************************************************
* @Description : 测试BFS
* @author : 梁山广(Laing Shan Guang)
* @date : 2019-08-09 08:35
* @email : liangshanguang2@gmail.com
***********************************************************/
package Chapter05BreadthFirstTraversal.Section2GraphBFS;
import Chapter02GraphExpress.Graph;
import Chapter02GraphExpress.ReadGraph;
public class Main {
public static void main(String[] args) {
String filePath = "src/main/java/Chapter05BreadthFirstTraversal/Section2GraphBFS/graph.txt";
Graph graph = new Graph(false);
ReadGraph.init(graph, filePath);
GraphBFS graphBFS = new GraphBFS(graph);
System.out.println("广度优先遍历顺序结果是:" + graphBFS.getOrderList());
}
}
/**
* 输出结果是:
* 顶点数V = 7, 边数E = 7
* 广度优先遍历顺序结果是:[0, 1, 2, 3, 4, 6, 5]
*/
1
https://gitee.com/lsgwr/algorithms.git
git@gitee.com:lsgwr/algorithms.git
lsgwr
algorithms
algorithms
master

搜索帮助