邻接表构造函数算法ALGraph_常用构造函数方法
邻接表构造函数算法ALGraph由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“常用构造函数方法”。
template
ALGraph::ALGraph(T a[ ], int n, int e){
vertexNum=n;arcNum=e;
for(i=0;i
adjlist[i].vertex=a[i];
adjlist[i].firstedge=NULL;}
for(k=0;k
cin>>i>>j;//输入边所依附的两个顶点的序号s=new ArcNode;s->adjvex=j;//生成一个边表结点->next=adjlist[i].firstedge;//将结点s插入到结点i的边表的表头
adjlist[i].firstedge=s;
}
}
《邻接表构造函数算法ALGraph.docx》
将本文的Word文档下载,方便收藏和打印
推荐度:
点击下载文档
[其他范文]热门文章