1 / 25

15.082 和 6.855J

15.082 和 6.855J. 广度优先搜索. 4. 4. 2. 2. 8. 8. 1. 1. 5. 5. 7. 7. 9. 9. 3. 3. 6. 6. 1. 1. next. 初始化. 1. 1. pred(1) = 0 next := 1 order(next) = 1 LIST:= {1}. 取消在 N 中结点的所有标记 ; 标记结点 s. LIST. 4. 2. 8. 1. 5. 7. 9. 3. 6. 1. next. 在 LIST 中选择结点 i. 1. 1. 1.

quinta
Download Presentation

15.082 和 6.855J

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 15.082 和 6.855J 广度优先搜索 广度优先搜索动画

  2. 4 4 2 2 8 8 1 1 5 5 7 7 9 9 3 3 6 6 1 1 next 初始化 1 1 pred(1) = 0 next := 1order(next) = 1 LIST:= {1} 取消在N中结点的所有标记; 标记结点 s LIST 广度优先搜索动画

  3. 4 2 8 1 5 7 9 3 6 1 next 在LIST 中选择结点 i 1 1 1 在广度优先搜索中,i 是在 LIST 中的第一个结点 LIST 1 广度优先搜索动画

  4. 如果结点 i 和一条可进入弧关联… 2 4 2 2 8 1 1 1 1 5 7 标记结点 j pred(j) := i Next := Next + 1 order(j) := next 把 j添加到 LIST 选择一条可进入弧 (i,j) 9 3 6 LIST 1 2 1 2 next 广度优先搜索动画

  5. 如果结点 i 和一条可进入的弧关联… 2 4 2 2 8 1 1 1 1 5 5 7 3 标记结点 j pred(j) := i Next := Next + 1 order(j) := next 把 j 添加到 LIST 选择一条可进入弧 (i,j) 9 3 6 LIST 1 2 5 2 3 next 广度优先搜索动画

  6. 如果结点 i 和一条可进入的弧关联… 2 4 2 2 8 1 1 1 1 5 5 7 3 Next := Next + 1 order(j) := next 把 j 添加到LIST 标记结点 j pred(j) := i 选择一条可进入弧 (i,j) 9 3 3 6 4 LIST 1 2 5 3 2 4 3 next 广度优先搜索动画

  7. 如果结点 i 和一条可进入的弧关联… 2 4 2 2 8 1 1 1 1 1 5 5 7 3 9 3 3 6 从LIST删除结点i 4 LIST 1 2 5 3 3 4 2 next 广度优先搜索动画

  8. 选择结点 i 2 4 2 2 2 8 1 1 1 1 1 5 5 7 3 9 3 3 6 在LIST上的第一个结点变成了结点 i 4 LIST 1 2 5 3 2 4 3 next 广度优先搜索动画

  9. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 2 2 2 8 1 1 1 5 5 7 3 Next := Next + 1 order(j) := next 把 j添加到 LIST 选择一条可进入弧arc (i,j) 标记结点 j pred(j) := i 9 3 3 6 4 LIST 1 2 5 3 4 4 3 2 5 next 广度优先搜索动画

  10. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 2 2 2 2 8 1 1 1 5 5 7 3 从LIST删除结点 i 9 3 3 6 4 LIST 1 2 5 3 4 3 4 2 5 next 广度优先搜索动画

  11. 选择一个结点 5 2 4 4 2 2 2 8 1 1 1 5 5 5 7 3 在LIST上的第一个结点变成了结点 i 9 3 3 6 4 LIST 1 2 5 3 4 3 4 2 5 next 广度优先搜索动画

  12. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 2 2 2 8 1 1 1 5 5 5 7 3 Next := Next + 1 order(j) := next 把 j 添加到 LIST 标记结点 j pred(j) := i 选择一条可进入弧 (i,j) 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 3 4 6 2 5 next 广度优先搜索动画

  13. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 2 2 2 8 1 1 1 5 5 5 5 7 3 从LIST 中删除结点i 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 6 2 4 3 5 next 广度优先搜索动画

  14. 选择结点 3 5 2 4 4 2 2 2 8 1 1 1 5 5 5 5 7 3 结点3不和任何可进入弧关联 从LIST中删除结点i 9 3 3 3 3 6 6 4 6 LIST 1 2 5 3 4 6 5 6 4 2 3 next 广度优先搜索动画

  15. 选择一个结点 5 2 4 4 4 2 2 8 1 1 1 5 5 7 3 i : = 4 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 3 4 2 5 6 next 广度优先搜索动画

  16. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 4 7 2 2 8 8 1 1 1 5 5 7 3 标记结点 j pred(j) := i Next := Next + 1 order(j) := next 把 j 添加到 LIST 选择一条可进入弧 (i,j) 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 8 3 5 4 7 2 6 next 广度优先搜索动画

  17. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 4 4 7 2 2 8 8 1 1 1 5 5 7 3 从LIST删除结点i 9 3 3 6 6 4 6 LIST 1 2 5 3 4 6 8 7 3 5 4 2 6 next 广度优先搜索动画

  18. 选择结点 i 5 2 4 4 7 2 2 8 8 1 1 1 5 5 7 3 i := 6 9 3 3 6 6 6 4 6 LIST 1 2 5 3 4 6 8 7 2 5 4 3 6 next 广度优先搜索动画

  19. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 Next := Next + 1 order(j) := next 添加j 到LIST中 标记结点 j pred(j) := i 选择一条可进入弧 (i,j) 9 3 3 6 6 6 4 6 LIST 1 2 5 3 4 6 8 7 7 5 4 8 3 2 6 next 广度优先搜索动画

  20. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 Next := Next + 1 order(j) := next 添加j 到LIST中 标记结点 j pred(j) := i 选择一条可进入弧 (i,j) 9 9 3 3 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 5 4 9 3 8 2 7 next 广度优先搜索动画

  21. 如果结点 i 和一条可进入的弧关联… 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 从LIST删除结点i 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 5 4 3 8 2 9 7 next 广度优先搜索动画

  22. 选择结点 8 5 2 4 4 7 2 2 8 8 8 8 1 8 1 1 5 5 7 7 3 结点 8 不和任何可进入弧关联;从LIST中删除它 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 7 5 4 3 8 2 9 6 next 广度优先搜索动画

  23. 选择结点7 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 7 7 3 结点7 不和可进入弧关联;从LIST中删除它 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 6 7 5 4 3 8 2 9 next 广度优先搜索动画

  24. 选择结点 9 5 2 4 4 7 2 2 8 8 1 8 1 1 5 5 7 7 3 结点 9 不和可进入弧关联;从LIST中删除它 9 9 9 9 3 3 6 6 6 6 4 9 6 LIST 1 2 5 3 4 6 8 7 9 9 3 6 7 2 5 4 8 next 广度优先搜索动画

  25. 结束 广度优先搜索动画

More Related