[关闭]
@w1024020103 2017-05-11T19:23:17.000000Z 字数 564 阅读 482

Lec 28 Graph Traversals

CS61B


DepthFirstPaths Implementation

1.JPG-81.9kB

Recursive Implementation

2.JPG-84.1kB

Graph Problems

3.JPG-55.2kB

General Graph Traversals

Graph Traversals

4.JPG-87.7kB

level order traversal quiz
5.JPG-60.5kB

DFS postorder quiz
6.JPG-60.2kB

Traversals and Graph Problems

7.JPG-75.8kB

Topological Sorting

从Indegree = 0的vertices出发(就是没有指向这个Node即箭头的Node),做DFS,记录DFS postorder到一个List里,最后取这个List的reverse:

8.JPG-58.1kB

topological sorting最后的结果,看起来所有的箭头都往右边指:
9.JPG-61.6kB

Topological Sort Implementation

10.JPG-95.8kB

Graph problems runtime

11.JPG-52.3kB

12.JPG-51.3kB

Finding the “Level-Order”

13.JPG-78.3kB

BreadthFirstPaths Implementation

14.JPG-82.1kB

runtime

15.JPG-73.7kB

Think about:
16.JPG-44.3kB

BreadthFirstPaths Demo

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注