模板:链式前向星

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)
posted @ 2020-08-18 14:51  一个经常掉线的人  阅读(70)  评论(0)    收藏  举报