main.cpp

来自「图的常用算法」· C++ 代码 · 共 28 行

CPP
28
字号
#include <iostream.h>
#include <stdlib.h>
#include "Graph.h"
void main()
{
	Graph<int> G,G1;
	G.ReadGraph("Graph.txt");
	cout<<endl;
	G.PrintEdge();
	cout<<endl;
	cout<<"Neighbors: 0"<<endl;
	cout<<G.GetNeighbors(0)<<endl;
	cout<<"First Neighbor:"<<endl;
	cout<<G.GetFirstNeighbor(0)<<endl;
	cout<<"Next Neighbor:"<<endl;
	cout<<G.GetNextNeighbor(0,1)<<endl;
	cout<<"DFS:"<<endl;
	G.DFS(0);
	cout<<endl;
	cout<<"BFS:"<<endl;
	G.BFS(0);
	cout<<endl;
	G.OutputShortestPath(0,G);
	cout<<endl;
	G1.ReadGraph("Graph1.txt");
	cout<<endl;
	G1.PrintEdge();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?