图功能函数 Graph.h

来源:互联网 发布:如何在淘宝拍照购物 编辑:程序博客网 时间:2024/05/29 17:16
///////////////////////////
//    //
//   图功能函数  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);


}
原创粉丝点击