图(常见的用法).h(国外英文资料).doc

  1. 1、本文档共31页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
图(常见的用法).h(国外英文资料)

图(常见的用法).h(国外英文资料) # # ifndef TU_H # define TU_H H # include queue. H # include stack. # include iostream Using namespace STD. / / typedef int DataType. The / / queue.h header file is already defined Pound sign define INT_MAX 9999 Typedef struct JuZhen { Int * index; DataType * val. / / dynamically assign the size of the adjacency matrix } JuZhen; / / class / / the depth, breadth, and topological sort of the diagram / / the shortest path algorithm for the web, Dijkstra, Floyd / / minimum spanning tree prim, kruskal Class Tu { Public: Tu (); Void ShenSou (); Void shensou (int); Void GuangSou (); Void TuoPuSort (); Void Floyd (); Void Dijkstra (); Void Prim (); Void Kruskal (); ~ Tu (); Private: JuZhen T; Int N; / / the number of the number of points is initialized in the constructor Int n; / / the number of edges Int choose; / / 1, which is shown in figure 2, not to figure 3, to network 4, not to the net }; Tu:, Tu () { Int I, j, k, weight; Cout Cin choose; The number of vertices in the cout ; Cin N. The number of edges of cout (undirected graph in half) : Cin n. (int *) calloc (N, sizeof (int)); / / callloc defaults to 0 malloc, which is a random number DataType * (DataType *) calloc (N * N, sizeof (DataType)); (k = 0;) / / the initial value INT_MAX means not negative or not? If (choose = = 1 | | choose = = 2) / / { Cout \ n; (k = 0; k n; k + +) { Cin I j; T.v. If (choose = = 2) T.v. } } If (choose = = 3 | | choose = = 4) / / net { Cout \ n ; / / memset (T.v, Infinite, N * N); This not line? (k = 0; k n; k + +) { Cin I , , weight; T.v. If (choose = = 4) T.v. } } } Tu: : ~ Tu () { Free (T.i ndex); / / be sure to release the space otherwise the computer is easy to get Free (T.v al); } Void Tu: : the depth of the deep preference search recursion function in shensou (int I) / / graph { Int j; (1) Cout For (j = 0; j N; j + +) { If (T.v.) { Shensou (j);/ / look for the way of recursion }

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档