#include
#include
//图
#include
#include
using namespace std;
using namespace boost;
//顶点名称
enum { A, B, C, D, E, F };
//顶点个数
#define N 6
const char *name = "ABCDEF";
//无向图
void main1()
{
adjacency_matrix
add_edge(A, B, myg);
add_edge(A, C, myg);
add_edge(A, D, myg);
add_edge(A, E, myg);
add_edge(B, C, myg);
add_edge(F, C, myg);
cout << "顶点" << endl;
print\_vertices(myg, name);
cout << endl;
cout << "边" << endl;
print\_edges(myg, name);
cout << endl;
cout << "关联" << endl;
print\_graph(myg, name);
cout << endl;
cin.get();
}
//有向图
void main2()
{
adjacency_matrix
add_edge(A, B, myg);
add_edge(A, C, myg);
add_edge(A, D, myg);
add_edge(A, E, myg);
add_edge(B, C, myg);
add_edge(F, C, myg);
cout << "顶点" << endl;
print\_vertices(myg, name);
cout << endl;
cout << "边" << endl;
print\_edges(myg, name);
cout << endl;
cout << "关联" << endl;
print\_graph(myg, name);
cout << endl;
cin.get();
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章