关于spfa,我想知道邻接链表的详解

学术版

https://malash.me/200910/linked-forward-star/ 慢慢研究吧,没人能帮你,坚持硬着头皮看一个小时你应该会有收获的
by xfydemx @ 2018-03-16 14:19:30


链式前向星? 我表示用着很舒服 然而不清楚原理=-=
by VenusM1nT @ 2018-03-16 15:09:32


``` int head[Maxn],tot; struct edge {int u,v,w,last;} E[Maxn]; inline void add(int a,int b,int c){ E[++tot].u=a,E[tot].v=b,E[tot].w=c,E[tot].last=head[a],head[a]=tot; E[++tot].u=b,E[tot].v=a,E[tot].w=c,E[tot].last=head[b],head[b]=tot; } head[i]: 以i为起点的最后一条边 tot: 边的编号 结构体E中的一些变量: E[i].u: 第i条边的起点 E[i].v: 第i条边的终点 E[i].w: 第i条边的边权 E[i].last: 和第i条边同起点的上一条边的编号 ```
by 凌幽 @ 2018-03-16 15:46:05


|