链式前向星

 1 struct node
2 {
3 int from,to, next; //next表示下一条边;
4 };
5 node edge [maxm];
6 int ecnt,box[maxn]; //box[]第一个节点;
7 void _make_map(int from,int to)
8 {
9 edge[ecnt].to=to;
10 edge[ecnt].next=box[from];
11 box[from]=ecnt++;
12 }
13 void make_map(int from,int to)
14 {
15 _make_map(from,to);
16 _make_map(to,from);
17 }

  

posted on 2011-08-07 10:54  _Clarence  阅读(145)  评论(0编辑  收藏  举报

导航