示例#1
0
//Function use: 选择创建各类图
Status CreateGraph(MGraph *pG)
{
	int nSel;
	printf("请输入图的类型:(0:有向图 1:有向网 2.无向图 3.无向网:");
	scanf("%d", &nSel);
	switch (nSel)
	{
		case 0:
			CreateDG(pG);
			break;
		case 1:
			CreateDN(pG);
			break;
		case 2:
			CreateAG(pG);
			break;
		case 3:
			CreateAN(pG);
			break;
		default:
			printf("输入有误!\n");
			return ERROR;
	}

	return OK;
}
示例#2
0
Status CreateGraph(MGraph *G){
	int kind;
	printf("输入图种类\n");
	scanf("%d", &kind);
	(*G).kind = (GraphKind)kind;
	switch((*G).kind){
		case  DG: return CreateDG(&*G);
		case  DN: return CreateDN(*G);
		case UDG: return CreateUDG(&*G);
		case UDN: return CreateUDN(&*G);
		default: return ERROR;
	}
}
void CreateGraph(MGraph &G)
{
	printf("请输入图G的类型(有向图:0 有向网:1 无向图:2 无向网:3):");
	scanf("%d", &G.kind);
	switch (G.kind) {
	case  DG: CreateDG(G);
		break;
	case  DN: CreateDN(G);
		break;
	case UDG: CreateUDG(G);
		break;
	case UDN: CreateUDN(G);
	}
}
/*
* @description:创建图,包括有向图,无向图,有向网,无向网
*/
Status CreateGraph(MGraph *G) {
	printf("please enter the kind of the graph(DG:0,DN:1,UDG:2,UDN:3):");
	scanf("%d",&(*G).kind);

	switch((*G).kind) {
		case UDG:
			return CreateUDG(G);
			break;
		case DG:
			return CreateDG(G);
		case UDN:
			return CreateUDN(G);
			break;
		case DN:
			return CreateDN(G);
			break;
		default:
			return ERROR;
	}
}