07 2017 档案

摘要:Dijkstra算法 又称迪杰斯特拉算法,是一个经典的最短路径算法,主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止,使用了广度优先搜索解决赋权有向图的单源最短路径问题,算法最终得到一个最短路径树。时间复杂度为O(N^2) 执行动画: 实例: 抽象步骤: 1.将起点A放入集合中,A点的权值为 阅读全文

posted @ 2017-07-17 11:20 Wujunde 阅读(134) 评论(0) 推荐(0)

摘要:Kruskal’s algorithm always union the lightest link if two sets haven't been linked Prim’s algorithm maintain a key of each vertex to represent the lig 阅读全文

posted @ 2017-07-13 16:15 Wujunde 阅读(153) 评论(0) 推荐(0)

摘要:拓扑排列可以指明除了循环以外的所有指向,当反过来还有路可以走的话,说明有刚刚没算的循环路线,所以反过来能形成的所有树都是循环 阅读全文

posted @ 2017-07-10 22:13 Wujunde 阅读(296) 评论(0) 推荐(0)

摘要:A topological sortof a dag G is a linear ordering of all its vertices such that if G contains anedge(u,v) then u appears before  in the ordering. (If 阅读全文

posted @ 2017-07-10 21:34 Wujunde 阅读(137) 评论(0) 推荐(0)

摘要:Besides creating a depth-first forest, depth-first search also timestamps each vertex.Each vertex  has two timestamps: the first timestamp :d record 阅读全文

posted @ 2017-07-10 21:16 Wujunde 阅读(323) 评论(0) 推荐(0)

摘要:given a graph G and a distinguished source vertex s, breadth-firstsearch systematically explores the edges of G to “discover” every vertex that isreac 阅读全文

posted @ 2017-07-07 22:04 Wujunde 阅读(165) 评论(0) 推荐(0)

摘要:We can choose between two standard ways to represent a graph as a collection of adjacency lists or as an adjacency matrix. Either way appliesto both d 阅读全文

posted @ 2017-07-07 22:00 Wujunde 阅读(200) 评论(0) 推荐(0)

摘要:MAKE-SET.x/ creates a new set whose only member (and thus representative) is x. Since the sets are disjoint, we require that x not already be in some 阅读全文

posted @ 2017-07-06 16:17 Wujunde 阅读(426) 评论(0) 推荐(0)