- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
图的最小生成树(Minimum spanning tree of a graph)
图的最小生成树(Minimum spanning tree of a graph)
# includes stdio.h
# includes stdlib.h
# includes conio.h
# includes string.h
# define ing 9999
int visited [10]; / * 访问标志数组 * /
typedef struct arccell {
int adj; / * 顶点关系类型, 用1表示相邻, 0表示不相邻 * /
} arccell, * * adjmatrix 邻接矩阵; / * * /
typedef struct type {
char date [3]; / * 顶点值 * /
} vertextype;
typedef struct {
vertextype * vexs 顶点向量; / * * /
adjmatrix 邻接矩阵 arcs; / * * /
int vexnum, arcnum 图的顶点数和边数; / * * /
} mgraph;
struct clos {
vertextype adjvex;
int low-cost;
} * closedge; / * 辅助数组, low..为0时就表示已访问过 * /
void initgraph (mgraph * g) / * 初始图 * /
{int i, nu, mu.
printf (\ n输入顶点的个数和 (边) 弧的个数:);
scanf (% d% d nu, mu);
g - arcs = (arccell * *) malloc (nu * sizeof (arccell *));
for (i = 0; i nu; i + +) / * 分配邻接矩阵空间 * /
g - arcs [i] = (arccell *) malloc (nu * sizeof (arccell));
g - vexs = (vertextype *) malloc (nu * sizeof (vertextype)); / * 分配顶点空间 * /
g - vexnum = nu; g - arcnum = mu 图的顶点数和边数; / * * /
}
void insertgraph (mgraph * g, int i, vertextype and 给图顶点向量付值) / * * /
{if (i 0 | | g vexnum) return;
strcpy (g - vexs [] date, e.data);
}
int locate (mgraph g, vertextype v1 确定v1在图顶点中的位置) / * * /
{int i;
for (i = 0; i g.vexnum; i + +)
if (strcmp (v1.data, g.vexs [] date) = = 0) return;
return - 1;
}
void createund (mgraph * g) / * 采用数组 (邻接矩阵) * /
{int i, j, k, p, q, w;
vertextype v1, v2.
p = (int *) malloc (g - vexnum * sizeof (int));
for (i = 0; i 10; i + +) p [i] = 0.
for (i = 0; i g vexnum; + + i) / * 初始邻接表 * /
{for (j = 0 and j g vexnum; + + j) g - arcs [the] [j].adj = ing;}
printf (按顺序输入顶点和它们的权值再顶点: 如s v1 3 v2: \ n);
for (k = 0; k g arcnum; + + k)
{printf (输入第% d 条 (边) 弧: \ n, (k + 1);
scanf (% d% d% d, v1.data, w, v2.data 输入相邻的两个点值和权值); / * * /
the = if (* g, v1); j = if (g, 2); / * 用i 和j来确定它们的位置 * /
g - [the] [j] arcs.adj = w;
g - arcs [j] [i].adj = g - arcs [the] [j].adj 有向图时就不用这个; / * * /
}
}
int minimum (mgraph g, struct clos * closedge 求出辅助数组中除0之外最小权值的顶点位置) / * * /
{int i, min, j, k;
fo
您可能关注的文档
- 古惑仔人物(Crash girl).doc
- 古希腊奥运会起源传说(Ancient Greece Olympic Games origin fable).doc
- 古代一两银子值现在多少钱(How much is the value of one or two silver in ancient times).doc
- 古文奇才自译绿色生活(Translated Title classical Wizard from green life).doc
- 古诗词应用(Ancient poetry application).doc
- 只要开始,永远不晚——图尔库水龙头公司案例读后(As long as it starts, it's never too late - a case study of the Turku faucet company).doc
- 可怕坏习惯 毁坏孩子的未来(Terrible bad habits destroy the child's future).doc
- 可编程序控制器发展和应用(Development and application of programmable logic controller).doc
- 可口可乐从办公室营销转向走动营销(Coca-Cola from office marketing to mobile marketing).doc
- 可编程序控制器的五种标准编程语言(Five standard programming languages for programmable controllers).doc
- 图书馆馆藏借阅情况的数据分析(Data analysis of Library Collection).doc
- 圆明园的论文(Old Summer Palace papers).doc
- 圆的整理复习(Circular collation review).doc
- 圆的复习(Round review).doc
- 圆的认识 习题精选(Circle of knowledge, exercises, selections).doc
- 圆的认识教案(Round cognition lesson plan).doc
- 圆的认识教学设计张彩(Circle of understanding, teaching design, Cai Cai).doc
- 圆锥曲线统一定义的教学设计(Teaching design of unified definition of conic).doc
- 圆锥曲线高考题(Conic section college entrance examination questions).doc
- 圈地运动演绎太阳能热水器产业新牌局(The enclosure movement Interpretation of the new board for solar water heater industry.).doc
文档评论(0)