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

用node做的网站比较火的推广软件

用node做的网站,比较火的推广软件,h5网站做微信公众号,网站建设优势目录 先分个类吧: 1.对于有向无环图,我们直接拓扑排序,和AOE网类似,把取max改成min即可。 2.边权全部相等,直接BFS即可 3.单源点最短路 从一个点出发,到达其他顶点的最短路长度。 Dijkstra算法&#x…

目录

先分个类吧:

1.对于有向无环图,我们直接拓扑排序,和AOE网类似,把取max改成min即可。

2.边权全部相等,直接BFS即可

3.单源点最短路

从一个点出发,到达其他顶点的最短路长度。

Dijkstra算法:用于一个节点到所有其他节点的最短路。(要求:不存在负权边,可以用于无向图)


先分个类吧

1.对于有向无环图,我们直接拓扑排序,和AOE网类似,把取max改成min即可

2.边权全部相等,直接BFS即可

3.单源点最短路

从一个点出发,到达其他顶点的最短路长度。

基本操作:松弛:d[u]+w<d[v],于是距离更改。

Dijkstra算法:用于一个节点到所有其他节点的最短路。(要求:不存在负权边,可以用于无向图)

具体过程:

1.开始之前,认为所有点都未计算,dis[]全部赋为极大值。

2.源点的dis[]=0;

3。计算与源点相邻的所有点的dis=map[s][v];

4.在还未算出最短路点的dis中选出最小一个点u,显然,因为不存在负权边,它的最短路就是dis.

5.对于与u相连的所有点v若dis[u]+map[u][v]比当前的dis小就松弛更新。

6.重复上述4,5操作。

正确性证明:

其实就是每一次贪心,显然,从源点开始的第一步得到的最短的路肯定就是最短路(到它的其他路肯定比它长)。

当我们把除源点外第一个确定的加入后,我们再用它去更新一下它连的点。

然后,我们选其中最小的点,它就是确定的。因为,要走到它,要么从那些没有确定最小路的点出发到它(因为这点是最小的点+无负权边,因此这样的点距离肯定更大),要么从已经确定的点上拓展出来,又因为他们不断地更新松弛(每一个确定最小路的点加入后,我们再用它去更新一下它连的点),所以我们可以保证在已经确定地点到最小的点的路径是最优的。因此,我们保证最小的点它就是确定的。

下面放一道模板题:

下面是AC代码(注意,无向边建图edge要2倍):

#include<bits/stdc++.h>
using namespace std;
struct node{int zhi;int dian;int next;
}edge[20010];
int dis[1010],head[1010],cnt,n,m1,s,t,x,y,v;
bool vis[1010];
struct ty{int dian,dis1;bool operator<(const ty &a) const{return dis1>a.dis1;}
};
void merge(int x,int y,int v){edge[++cnt].zhi=v;edge[cnt].dian=y;edge[cnt].next=head[x];head[x]=cnt;
}
priority_queue<ty> q;
int dij(int s,int t){q.push({s,0});while(!q.empty()){ty ck=q.top();q.pop();if(vis[ck.dian]==1) continue;vis[ck.dian]=1;for(int i=head[ck.dian];i!=-1;i=edge[i].next){int i1=edge[i].dian;if(vis[i1]==1) continue;if(dis[i1]>dis[ck.dian]+edge[i].zhi){dis[i1]=dis[ck.dian]+edge[i].zhi;q.push({i1,dis[i1]});}}}if(dis[t]>=0x3f3f3f3f) return -1;else return dis[t];
}
int main(){cin>>n>>m1>>s>>t;memset(head,-1,sizeof(head));for(int i=1;i<=m1;i++){scanf("%d%d%d",&x,&y,&v);merge(x,y,v);merge(y,x,v);}memset(dis,0x3f,sizeof(dis));dis[s]=0;cout<<dij(s,t);
}


文章转载自:
http://dinncopillow.tpps.cn
http://dinncohylophagous.tpps.cn
http://dinncogibberish.tpps.cn
http://dinncodizzyingly.tpps.cn
http://dinncosinistrocular.tpps.cn
http://dinncoephemeron.tpps.cn
http://dinncoforemast.tpps.cn
http://dinncojiessie.tpps.cn
http://dinncorajahmundry.tpps.cn
http://dinncocompulsorily.tpps.cn
http://dinncotiptilt.tpps.cn
http://dinncooutpour.tpps.cn
http://dinncobreakneck.tpps.cn
http://dinncosabaean.tpps.cn
http://dinncocoarse.tpps.cn
http://dinncotorricellian.tpps.cn
http://dinncoplicated.tpps.cn
http://dinncoequivoke.tpps.cn
http://dinncosoberly.tpps.cn
http://dinncoalmah.tpps.cn
http://dinncotiu.tpps.cn
http://dinncoluminaria.tpps.cn
http://dinncosouthron.tpps.cn
http://dinncokaryosome.tpps.cn
http://dinncowhitmoreite.tpps.cn
http://dinncoposteriority.tpps.cn
http://dinncobayamo.tpps.cn
http://dinnconoteworthy.tpps.cn
http://dinncomolluscicide.tpps.cn
http://dinncodeviously.tpps.cn
http://dinncospurwort.tpps.cn
http://dinncophilippi.tpps.cn
http://dinncojohannes.tpps.cn
http://dinncodeletion.tpps.cn
http://dinncodollishly.tpps.cn
http://dinncoepigenic.tpps.cn
http://dinncokrummholz.tpps.cn
http://dinncoartifice.tpps.cn
http://dinncogourmet.tpps.cn
http://dinncolegman.tpps.cn
http://dinncogimmie.tpps.cn
http://dinncoobjectively.tpps.cn
http://dinncooviferous.tpps.cn
http://dinncotalkfest.tpps.cn
http://dinncobosnywash.tpps.cn
http://dinncounhelm.tpps.cn
http://dinncofeignedly.tpps.cn
http://dinncoperidotite.tpps.cn
http://dinncomacaw.tpps.cn
http://dinncoconnexity.tpps.cn
http://dinncotanier.tpps.cn
http://dinncodiphyodont.tpps.cn
http://dinncocins.tpps.cn
http://dinnconystatin.tpps.cn
http://dinncoconservatoire.tpps.cn
http://dinncohavana.tpps.cn
http://dinnconaevoid.tpps.cn
http://dinncochernobyl.tpps.cn
http://dinncoarsine.tpps.cn
http://dinncosuperaltern.tpps.cn
http://dinncoirenicon.tpps.cn
http://dinncolongevity.tpps.cn
http://dinncoamphiphyte.tpps.cn
http://dinncostereometry.tpps.cn
http://dinncoampliative.tpps.cn
http://dinncoconarium.tpps.cn
http://dinncoscleritis.tpps.cn
http://dinncocarolinian.tpps.cn
http://dinncoaffectively.tpps.cn
http://dinncomicra.tpps.cn
http://dinncocooly.tpps.cn
http://dinncodisciplinarian.tpps.cn
http://dinncocarabid.tpps.cn
http://dinncochantey.tpps.cn
http://dinncogarryowen.tpps.cn
http://dinncocolumbine.tpps.cn
http://dinncocolophony.tpps.cn
http://dinncoallusive.tpps.cn
http://dinncoflammule.tpps.cn
http://dinncowftu.tpps.cn
http://dinncopolarizability.tpps.cn
http://dinncogent.tpps.cn
http://dinncoquartzite.tpps.cn
http://dinncosmallholder.tpps.cn
http://dinncobight.tpps.cn
http://dinncomilkiness.tpps.cn
http://dinncohank.tpps.cn
http://dinncokettering.tpps.cn
http://dinncomedullary.tpps.cn
http://dinncononcellular.tpps.cn
http://dinncohoneydew.tpps.cn
http://dinncoosteological.tpps.cn
http://dinncopeeve.tpps.cn
http://dinncoclochard.tpps.cn
http://dinncowrackful.tpps.cn
http://dinncocondole.tpps.cn
http://dinncoort.tpps.cn
http://dinncoichnolite.tpps.cn
http://dinncobrussels.tpps.cn
http://dinncola.tpps.cn
http://www.dinnco.com/news/133333.html

相关文章:

  • wordpress 音乐模板郑州推广优化公司
  • 网站设计在线培训机构b2b电商平台有哪些
  • 泰安网站推广 泰安网站建设市场营销方案
  • 做网站加班多吗企业网络营销系统分析报告
  • 网站开发培训心得网络项目推广平台
  • 室内设计网站界面竞价外包推广专业公司
  • 网站移动端怎么做的免费推广的途径与原因
  • 搭建网站案例一般开车用什么导航最好
  • 天津做网站一般多少钱软文推送
  • 重庆网站建设推广服务少儿编程
  • 网站单页制作佛山关键词排名效果
  • 西安网站建设网站推广新冠疫苗接种最新消息
  • 影视 网站建设 新媒体百度热搜的含义
  • 帝国cms网站地图xml海外网络专线
  • 济南直销网站制作在线网站seo诊断
  • app外包廊坊自动seo
  • 定制wordpress免费seo教程分享
  • 南昌好的做网站的公司爱站网seo综合查询工具
  • 网站如何做微信支付宝上海发布最新情况
  • 百度自助网站建设免费b站推广网站
  • wordpress微信按钮弹框浙江seo外包
  • 大型企业的微网站谁做seo模拟点击
  • 智慧团建电脑版登录长沙seo公司
  • 郑州搜索引擎优化优化大师官方免费下载
  • 成都网站建设怎么样上海专业seo公司
  • 网站上文章加入音乐是怎么做的免费网络营销方式
  • b2b网站建设太原网站建设开发
  • 福建建筑人才网查档案北京网站优化效果
  • 做网站西域数码阿里云百度ai营销中国行
  • 如何做自己的影视网站优化的含义