邻接表(模板)

邻接表

struct Edge{
    int to,next;   //to表示点,next表示边
};edge[505];
void add_edge(int bg,int ed){
    cnt++;
    edge[cnt].to=ed;
    edge[cnt].next=head[bg];
    head[bg]=cnt;
}
原文地址:https://www.cnblogs.com/sdfzsyq/p/9677255.html