📄 test.cpp
字号:
/*****************************************
* file: test.cpp
* author:
* data : 15:00 2006-11-15
* copyright: free software & hardware
* to-do: the implamtation of the graph and it's method
*****************************************/
#include <stdio.h>
#include "graph.h"
int main()
{
int len;
graph g;
init_graph(&g);
read_graph(&g);
print_graph(&g);
if(is_connected(&g)){
printf("g is connected\n");
} else {
printf("g is not connected\n");
}
if(is_tree(&g)){
printf("g is tree\n");
} else {
printf("g is not tree \n");
}
if(has_cycle(&g,1)){
printf("g has cycle\n");
} else {
printf("g has no cycle\n");
}
int a,b;
while(1){
printf("\nenter two number (-1 for quit):");
scanf("%d",&a);
if(a == -1) break;
scanf("%d",&b);
if(b == -1) break;
if(a >= g.size || b >= g.size){
printf("the number must be smaller than the size of the graph!");
continue;
}
printf("the shortest path between %d and %d is:",a,b);
len = shortest_path(&g,a,b);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -