浙江大学数据结构(小白—邻接矩阵表示的图—建立图)

    xiaoxiao2022-06-27  146

     

    MGraph BuildGraph() { MGraph Graph; Edge E; Vertex V; int Nv,i; scanf("%d",&Nv); Graph=CreateGraph(Nv); scanf("%d",&Graph->Ne); if (Graph->Ne!=0) { E=(Edge)malloc(sizeof(struct ENode)); for (i=0;i<Graph->Ne;i++) { scanf("%d %d %d",&E->v1,&E->v2,&E->v3); InsertEdge(Graph,E); } } // 如果顶点有数据 for (V=0;V<Graph->Nv;i++) scanf("%c",Graph->Data[V]); return Graph; }

     


    最新回复(0)