云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 最小生成树MFC实现

最小生成树MFC实现

  • 62 次阅读
  • 3 次下载
  • 2026/1/10 14:28:55

#include \#include \#include \#include \#include \

//#define INFINITY INT_MAX #define MAX_VERTEX_NUM 20 #define OVERFLOW -1 typedef int VRType;

typedef char VertexType; typedef int GraphKind; typedef int InfoType;

typedef struct ArcCell{ int adj; //char *info;

}ArcCell, AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; typedef struct{ char vexs[MAX_VERTEX_NUM]; AdjMatrix arcs; int vexnum,arcnum; }MGraph;

struct {

char adjvex; VRType lowcost;

}closedge[MAX_VERTEX_NUM];

int GetVexNum(CString &A)

{//统计结点的个数 int i=0; while(i

char* GetVexs(CString &A) {//返回结点数组 char* p=(char*)malloc(sizeof(char)); char Array[MAX_VERTEX_NUM]=\ p=Array;

int i=0 , j=0;

while(i

if(A.GetAt(i)==13) break;//当是回车时 if(A.GetAt(i)=='0') {i++;continue;}//当是0时 Array[j] = A.GetAt(i); i++; j++; } else i++; } return p; }

char** GetArcs(CString &A)

{//获得的是含权的邻接矩阵 int m=0 , n=0, i=0,j=0, k=0; char **p; p=(char**)malloc(MAX_VERTEX_NUM*sizeof(char*)); for(i=0;i

else {++m;n=0;i+=5;flag=0;} } for(int c=0;c

int minimum() { int MinCost=100,MinNum=0; for( int j=0; j<5 ;j++) if(closedge[j].lowcost>0&& closedge[j].lowcost

struct student//用来存储边 { char top; char base; };

struct student closed[MAX_VERTEX_NUM]; int flag=0;

void MiniSpanTree_PRIM(MGraph G, VertexType u) {

int i=0,j=0,k=0,n=0,m=0,g=0,h=0; k=0; for(j=0;j

closed[flag].base= G.vexs[k]; flag++; closedge[k].lowcost=0; for(j=0;j

int Check_Arcs(MGraph G) { for(int i=0;i

int Check_Num(MGraph G,CString A) { if(((G.vexnum+1)*2+1)*G.vexnum-2==A.GetLength()) return 1; else return 0; }

void CGraphgDlg::OnShow_Tree() { UpdateData(true); MGraph G; //char* p=(char*)malloc(sizeof(char)); char *p = GetVexs(m_Input); int i=0; for( i=0 ; i

搜索更多关于: 最小生成树MFC实现 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

#include \#include \#include \#include \#include \//#define INFINITY INT_MAX #define MAX_VERTEX_NUM 20 #define OVERFLOW -1 typedef int VRType; typedef char VertexType; typedef int GraphKind; typedef int InfoType; typedef struct ArcCell{ int adj; //char *info; }ArcCell, AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; typedef struct{ char vexs[MAX_VERTEX_NUM]; Ad

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com