# 第 12 章 量子图算法 代码演示 > 主站教程:[chenzhaoyun.com/quantum-tutorial/ch12-quantum-graphs/](https://chenzhaoyun.com/quantum-tutorial/ch12-quantum-graphs/) 图算法的复杂度高度依赖输入 oracle:邻接矩阵允许任意边查询,邻接表按顶点枚举邻居,已知图加未知顶点标记又是 graph collision 模型。本章分别建立这些成本口径,再推导连通性、生成树、子图、量子行走和电阻算法。 **3 个 demo(点击查看)**: ### 1. 01 Graph Walk ![01_graph_walk.png](01_graph_walk.png) **K3 上 4 步离散时间带硬币量子行走(CSWAP)+ 经典随机行走对照(L1 距离 0.498)** ```bash python demos/ch12-quantum-graphs/01_graph_walk.py ``` ### 2. 02 Welded Tree ![02_welded_tree.png](02_welded_tree.png) **14 顶点 n=2 焊接树 + 经典 vs 连续时间量子行走 P(EXIT) 对比(量子峰值 0.946)** ```bash python demos/ch12-quantum-graphs/02_welded_tree.py ``` ### 3. 03 Spatial Search ![03_spatial_search.png](03_spatial_search.png) **C4 上 Childs-Goldstone 空间搜索 Rabi 振荡(γ=1/√2, T* = π√N/2)** ```bash python demos/ch12-quantum-graphs/03_spatial_search.py ``` --- [← 演示总索引](../index.md) · [→ 主页](../../tutorial/index.md)