{
  "slug": "dijkstra",
  "title": "Dijkstra’s Shortest Path",
  "category": "Graphs",
  "difficulty": "hard",
  "complexity": {
    "time": "O(E log V)",
    "space": "O(V)"
  },
  "idea": "Keep a best-known distance for every node. Repeatedly settle the closest unsettled node — its distance can no longer improve — and relax its edges, lowering neighbours’ distances where a shorter route has been found.",
  "code": [
    "dist[start] = 0, everything else = ∞",
    "while an unsettled node remains:",
    "    cur = the unsettled node with the smallest dist",
    "    settle cur",
    "    for each edge cur-nb: dist[nb] = min(dist[nb], dist[cur] + w)"
  ],
  "example": {
    "array": []
  },
  "invariant": "Each step is the real data structure at that step — the picture is a pure function of it.",
  "stepCount": 15,
  "steps": [
    {
      "i": 0,
      "op": "graph",
      "caption": "Start at A with distance 0; every other node is ∞ — unreachable so far.",
      "note": null,
      "codeLine": 1,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": null,
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": []
        }
      ]
    },
    {
      "i": 1,
      "op": "graph",
      "caption": "A is the closest unsettled node (0) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "B",
          "label": "B",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A"
          ]
        }
      ]
    },
    {
      "i": 2,
      "op": "graph",
      "caption": "A → B costs 4: 0 + 4 = 4 — first route found.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "B",
          "label": "B",
          "text": "4",
          "focus": "write",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A"
          ]
        }
      ]
    },
    {
      "i": 3,
      "op": "graph",
      "caption": "A → C costs 2: 0 + 2 = 2 — first route found.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "B",
          "label": "B",
          "text": "4",
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "write",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A"
          ]
        }
      ]
    },
    {
      "i": 4,
      "op": "graph",
      "caption": "C is the closest unsettled node (2) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "4",
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C"
          ]
        }
      ]
    },
    {
      "i": 5,
      "op": "graph",
      "caption": "C → B costs 1: 2 + 1 = 3 — better than 4.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "write",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C"
          ]
        }
      ]
    },
    {
      "i": 6,
      "op": "graph",
      "caption": "C → E costs 8: 2 + 8 = 10 — first route found.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": "write",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C"
          ]
        }
      ]
    },
    {
      "i": 7,
      "op": "graph",
      "caption": "B is the closest unsettled node (3) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "∞",
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B"
          ]
        }
      ]
    },
    {
      "i": 8,
      "op": "graph",
      "caption": "B → D costs 5: 3 + 5 = 8 — first route found.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "write",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B"
          ]
        }
      ]
    },
    {
      "i": 9,
      "op": "graph",
      "caption": "D is the closest unsettled node (8) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "∞",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D"
          ]
        }
      ]
    },
    {
      "i": 10,
      "op": "graph",
      "caption": "D → F costs 6: 8 + 6 = 14 — first route found.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "14",
          "focus": "write",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D"
          ]
        }
      ]
    },
    {
      "i": 11,
      "op": "graph",
      "caption": "E is the closest unsettled node (10) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "F",
          "label": "F",
          "text": "14",
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D",
            "E"
          ]
        }
      ]
    },
    {
      "i": 12,
      "op": "graph",
      "caption": "E → F costs 3: 10 + 3 = 13 — better than 14.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        },
        {
          "id": "F",
          "label": "F",
          "text": "13",
          "focus": "write",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": "active"
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D",
            "E"
          ]
        }
      ]
    },
    {
      "i": 13,
      "op": "graph",
      "caption": "F is the closest unsettled node (13) — settle it.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "13",
          "focus": "settled",
          "badges": [
            "cur"
          ]
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D",
            "E",
            "F"
          ]
        }
      ]
    },
    {
      "i": 14,
      "op": "graph",
      "caption": "All settled. Shortest distances from A: A=0, B=3, C=2, D=8, E=10, F=13.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": "0",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": "3",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": "2",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": "8",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": "10",
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": "13",
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": null
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": null
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": null
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": null
        }
      ],
      "rows": [
        {
          "label": "settled",
          "items": [
            "A",
            "C",
            "B",
            "D",
            "E",
            "F"
          ]
        }
      ]
    }
  ]
}