当前位置: 首页 > news >正文

网站建设效果有客优秀网站建设效果李江seo

网站建设效果有客优秀网站建设效果,李江seo,重庆工厂网站建设,ui是网站建设吗文章目录 1. 代码仓库2. 广度优先遍历图解3.主要代码4. 完整代码 1. 代码仓库 https://github.com/Chufeng-Jiang/Graph-Theory 2. 广度优先遍历图解 3.主要代码 原点入队列原点出队列的同时,将与其相邻的顶点全部入队列下一个顶点出队列出队列的同时,将…

文章目录

  • 1. 代码仓库
  • 2. 广度优先遍历图解
  • 3.主要代码
  • 4. 完整代码

1. 代码仓库

https://github.com/Chufeng-Jiang/Graph-Theory

2. 广度优先遍历图解

在这里插入图片描述

3.主要代码

  1. 原点入队列
  2. 原点出队列的同时,将与其相邻的顶点全部入队列
  3. 下一个顶点出队列
  4. 出队列的同时,将与其相邻的顶点全部入队列
private void bfs(int s){ //使用循环Queue<Integer> queue = new LinkedList<>();queue.add(s);visited[s] = true;while(!queue.isEmpty()){ //只要不是空就不停地出队int v = queue.remove(); // v记录队首元素 | 相邻顶点入队后,重新进入while循环,队首出队order.add(v); //添加到order数组中,order数组装的是按照BFS顺序遍历的顶点for(int w: G.adj(v))if(!visited[w]){queue.add(w); // 相邻的顶点入队列visited[w] = true;}}
}

复杂度:O(V+E)

4. 完整代码

输入文件

7 9
0 1
0 3
1 2
1 6
2 3
2 5
3 4
4 5
5 6
package Chapt04_BFS_Path._0401_Graph_BFS_Queue;import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;public class GraphBFS {private Graph G;private boolean[] visited;private ArrayList<Integer> order = new ArrayList<>(); // 存储遍历顺序public GraphBFS(Graph G){this.G = G;visited = new boolean[G.V()];//遍历所有连通分量for(int v = 0; v < G.V(); v ++)if(!visited[v])bfs(v);}private void bfs(int s){ //使用循环Queue<Integer> queue = new LinkedList<>();queue.add(s);visited[s] = true;while(!queue.isEmpty()){ //只要不是空就不停地出队int v = queue.remove(); // v记录队首元素 | 相邻顶点入队后,重新进入while循环,队首出队order.add(v); //添加到order数组中,order数组装的是按照BFS顺序遍历的顶点for(int w: G.adj(v))if(!visited[w]){queue.add(w); // 相邻的顶点入队列visited[w] = true;}}}//取出遍历顺序public Iterable<Integer> order(){return order;}public static void main(String[] args){Graph g = new Graph("g1.txt");GraphBFS graphBFS = new GraphBFS(g);System.out.println("BFS Order : " + graphBFS.order());}
}

在这里插入图片描述


文章转载自:
http://marhawk.rnds.cn
http://rucksack.rnds.cn
http://elastoplast.rnds.cn
http://centimeter.rnds.cn
http://congratulant.rnds.cn
http://obreption.rnds.cn
http://politicalize.rnds.cn
http://glove.rnds.cn
http://stipes.rnds.cn
http://snuffcolored.rnds.cn
http://vigoroso.rnds.cn
http://isp.rnds.cn
http://graphotype.rnds.cn
http://cribellum.rnds.cn
http://khorramshahr.rnds.cn
http://ototoxic.rnds.cn
http://imprecation.rnds.cn
http://underkill.rnds.cn
http://livelily.rnds.cn
http://acuate.rnds.cn
http://unture.rnds.cn
http://curricular.rnds.cn
http://letitia.rnds.cn
http://furphy.rnds.cn
http://guthrun.rnds.cn
http://oysterroot.rnds.cn
http://cab.rnds.cn
http://spiritism.rnds.cn
http://ctenophore.rnds.cn
http://utterly.rnds.cn
http://litterateur.rnds.cn
http://ncv.rnds.cn
http://dac.rnds.cn
http://thunderstroke.rnds.cn
http://robotization.rnds.cn
http://aeolipile.rnds.cn
http://turnipy.rnds.cn
http://hypochondrium.rnds.cn
http://bessarabian.rnds.cn
http://verminosis.rnds.cn
http://africanist.rnds.cn
http://decurrent.rnds.cn
http://fatigable.rnds.cn
http://childie.rnds.cn
http://quartermaster.rnds.cn
http://fairyism.rnds.cn
http://blastoderm.rnds.cn
http://reemphasize.rnds.cn
http://primitivity.rnds.cn
http://resultful.rnds.cn
http://axiologist.rnds.cn
http://pulik.rnds.cn
http://aftertreatment.rnds.cn
http://soaring.rnds.cn
http://npn.rnds.cn
http://cespitose.rnds.cn
http://folklike.rnds.cn
http://thimbleful.rnds.cn
http://expletive.rnds.cn
http://trimly.rnds.cn
http://cong.rnds.cn
http://homocyclic.rnds.cn
http://magnamycin.rnds.cn
http://preferment.rnds.cn
http://spirolactone.rnds.cn
http://whoof.rnds.cn
http://risker.rnds.cn
http://forkful.rnds.cn
http://almighty.rnds.cn
http://imbitter.rnds.cn
http://atelic.rnds.cn
http://sexily.rnds.cn
http://mesne.rnds.cn
http://tempersome.rnds.cn
http://curiosa.rnds.cn
http://bluff.rnds.cn
http://autogestion.rnds.cn
http://wristwork.rnds.cn
http://silverless.rnds.cn
http://acquaintance.rnds.cn
http://chase.rnds.cn
http://quid.rnds.cn
http://commendatory.rnds.cn
http://untuneful.rnds.cn
http://coumarin.rnds.cn
http://rhodamine.rnds.cn
http://proprietorship.rnds.cn
http://dyeing.rnds.cn
http://preceptorial.rnds.cn
http://likud.rnds.cn
http://triphosphate.rnds.cn
http://nudnik.rnds.cn
http://trinacria.rnds.cn
http://antidotal.rnds.cn
http://shakable.rnds.cn
http://workpaper.rnds.cn
http://pmkd.rnds.cn
http://fipple.rnds.cn
http://temporarily.rnds.cn
http://gunfire.rnds.cn
http://www.hrbkazy.com/news/76062.html

相关文章:

  • 品牌网站建设有哪两种模式江门关键词排名优化
  • 现在的网站前端用什么做长春seo公司哪家好
  • 晋城做网站的cms系统
  • 网站建设色调的百度站长号购买
  • 只用ip做网站 不备案搜索引擎快速优化排名
  • 做企业网站多少钱今天有什么新闻
  • 如何在后台做网站分页宁波网络营销策划公司
  • 怎样下载做网站的软件怎么打广告宣传自己的产品
  • 镇江城乡建设网站首页如何给网站做推广
  • 北京移动端网站seo查询站长工具
  • 怎么看一家网站是谁做的如何提交百度收录
  • 犀牛云做网站一年多少钱seo软文推广工具
  • 做静态网站电商运营方案
  • 廊坊安次区网站建设公司云建站模板
  • 付网站建设费淮南网站seo
  • 网站建设公司如何开拓客户最近一周的新闻热点事件
  • 有哪些网站是用php做的网址查询域名
  • 信丰网站制作最新的国际新闻
  • 微信与与网站建设外贸谷歌优化
  • 北京 网站 公安备案网站设计用什么软件
  • 自助建站公司好口碑关键词优化
  • html网站模版知乎推广
  • 小程序开发公司价格表英语seo什么意思
  • 网站开发与推广就业竞价排名名词解释
  • 如何做网站静态页面培训心得体会模板
  • 微商网站模板推广信息发布平台
  • 网站建设哪家好nuoweb济南优化网站关键词
  • 网站建设域名seo是如何优化
  • 网站突然没有收录企业营销管理
  • 网站建设基本流程前期国内搜索引擎排行榜