struct E{ int to,next,w; };Edge[maxn]; int tot,head[maxn]; void add(int u,int v,int w){ tot++; Edge[tot].to=v; Edge[tot].w=w; Edge[tot].next=head[u]; head[u]=tot; }
遍历以s为起点的边。
for(int i=head[s]; i!=0; i=edge[i].next)