summaryrefslogtreecommitdiff
path: root/search/bfs_dfs.ipynb
blob: 149ece6435bdcf15157950d1d59775400c4e4472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3f88440c",
   "metadata": {},
   "source": [
    "## basics"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b7da297b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-07-04T13:12:09.408610Z",
     "start_time": "2023-07-04T13:12:09.390134Z"
    }
   },
   "source": [
    "- 图上的 bfs、dfs,核心是遇到岔路的处理办法:\n",
    "    - bfs,走走走走走,遇到一个分叉的地方(记为 a),沿着岔路口往前走,直到遇到新的岔路的地方(记为b),然后回溯返回到 a,沿着a,的下一个分叉走到新的分叉的位置;"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}