E=new Edge;
E->value=w;
E->adjvertex=j-1;
E->nextarc=adjlist[i-1].firstarc;
adjlist[i-1].firstarc=E;
E=new Edge;
E->value=w;
E->adjvertex=i-1;
E->nextarc=adjlist[j-1].firstarc;
adjlist[j-1].firstarc=E;
}
}
template<class T>
void Graph<T>::creatGraphH(T a[],int n,int e){
Edge *E;
vertexNum=n;
arcNum=e;
for (int i=0;i<vertexNum;i++)
{
adjlist[i].vex=a[i];
adjlist[i].firstarc=NULL;
}
int j,w;
for (int k=0;k<arcNum;k++)
{
cout<<"请输入第"<<k+1<<"条弧的信息(格式为:起点
";
cin>>i>>j>>w;
E=new Edge;
E->value=w;
E->adjvertex=j-1;
E->nextarc=adjlist[i-1].firstarc;
adjlist[i-1].firstarc=E;
}
}
template<class T>
void Graph<T>::printGraph(){
for (int i=0;i<vertexNum;i++)
{
Edge *p;
cout<<i<<" ";
p=adjlist[i].firstarc;
while(p)
{ 终点 权值)