///////////////////////////
// //
// 图功能函数 Graph.h //
// //
//////////////////////////
#include"Graph.h"
template<class NameType,class DisType>
void Graph_Creat(Graph<NameType,DisType> &GraphOPP)
{
GraphOPP.Creat();
}
template<class NameType,class DisType>
void Graph_DFS(Graph<NameType,DisType> &GraphOPP)
{
GraphOPP.DFS();
}
template<class NameType,class DisType>
void Graph_BFS(Graph<NameType,DisType> &GraphOPP)
{
GraphOPP.BFS();
}
template<class NameType,class DisType>
void Graph_PRINT(Graph<NameType,DisType> &GraphOPP)
{
GraphOPP.PrintNode();
}
void GRAPH()
{
Graph<char,int> GraphOPP;
do
{
cout<<"图的操作: "<<endl
<<" 1) 建立图"<<endl
<<" 2) 图的深度优先搜索"<<endl
<<" 3) 图的广度优先搜索"<<endl
<<" 4) 打印图中各结点"<<endl
<<" X) 退出排序操作"<<endl;
int item;
cin>>item;
switch(item)
{
case 1: Graph_Creat(GraphOPP); break;
case 2: Graph_DFS(GraphOPP); break;
case 3: Graph_BFS(GraphOPP); break;
case 4: Graph_PRINT(GraphOPP); break;
default: return ;
}
}while(true);
}