1
0

00-最短路-01-零权反例.svg 1.4 KB

123456789
  1. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 780 280" role="img" aria-labelledby="title desc">
  2. <title id="title">普通 BFS 在零权边上的反例</title><desc id="desc">S 到 A 有权一的直边,S 到 B 到 A 两条零权边总权零。</desc>
  3. <style>text{font-family:system-ui,sans-serif;fill:#172033}.edge{stroke:#64748b;stroke-width:5;fill:none}.zero{stroke:#16a34a;stroke-width:6;fill:none}.node{fill:#fff;stroke:#2563eb;stroke-width:4}.note{font-size:19px}.label{font-size:25px;font-weight:700}</style>
  4. <text x="28" y="33" class="note">一条边不一定比两条边便宜:BFS 最小化的是边数,不是权和。</text>
  5. <path class="edge" d="M135 145 L610 145" marker-end="url(#g)"/><path class="zero" d="M135 145 L360 65 L610 145" marker-end="url(#g)"/>
  6. <circle class="node" cx="135" cy="145" r="30"/><circle class="node" cx="360" cy="65" r="30"/><circle class="node" cx="610" cy="145" r="30"/><text class="label" x="126" y="154">S</text><text class="label" x="351" y="74">B</text><text class="label" x="601" y="154">A</text>
  7. <text x="370" y="132" class="note">权 1</text><text x="220" y="84" class="note" fill="#15803d">权 0</text><text x="484" y="84" class="note" fill="#15803d">权 0</text><text x="230" y="246" class="note">S→A:1;S→B→A:0。</text>
  8. <defs><marker id="g" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0 L10 5 L0 10z" fill="#475569"/></marker></defs>
  9. </svg>