{
  "slug": "mst-kruskal",
  "title": "Minimum Spanning Tree (Kruskal)",
  "category": "Graphs",
  "difficulty": "hard",
  "complexity": {
    "time": "O(E log E)",
    "space": "O(V)"
  },
  "idea": "Sort every edge by weight and walk the list cheapest-first. Take an edge if it joins two separate components; skip it if both ends are already connected, since that would make a cycle. After V-1 accepted edges everything is joined as cheaply as possible.",
  "code": [
    "sort edges by weight",
    "for each edge (a,b) in order:",
    "    if find(a) != find(b):   # different components",
    "        accept it; union(a,b)",
    "    else: skip — it would close a cycle"
  ],
  "example": {
    "array": []
  },
  "invariant": "Each step is the real data structure at that step — the picture is a pure function of it.",
  "stepCount": 16,
  "steps": [
    {
      "i": 0,
      "op": "graph",
      "caption": "Sort every edge by weight, then walk the list from cheapest to dearest.",
      "note": null,
      "codeLine": 1,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 1,
      "op": "graph",
      "caption": "Consider B–C (weight 1).",
      "note": null,
      "codeLine": 2,
      "stats": null,
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 2,
      "op": "graph",
      "caption": "Different components — take it. Running total 1.",
      "note": null,
      "codeLine": 4,
      "stats": {
        "weight": 1
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "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": "settled"
        },
        {
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 3,
      "op": "graph",
      "caption": "Consider A–C (weight 2).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 1
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "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": "settled"
        },
        {
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 4,
      "op": "graph",
      "caption": "Different components — take it. Running total 3.",
      "note": null,
      "codeLine": 4,
      "stats": {
        "weight": 3
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": null,
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 5,
      "op": "graph",
      "caption": "Consider E–F (weight 3).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 3
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "compare",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 6,
      "op": "graph",
      "caption": "Different components — take it. Running total 6.",
      "note": null,
      "codeLine": 4,
      "stats": {
        "weight": 6
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": null
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 7,
      "op": "graph",
      "caption": "Consider A–B (weight 4).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 6
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 8,
      "op": "graph",
      "caption": "A and B are already connected — skip it, it would close a cycle.",
      "note": null,
      "codeLine": 5,
      "stats": {
        "weight": 6
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": null,
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 9,
      "op": "graph",
      "caption": "Consider B–D (weight 5).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 6
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 10,
      "op": "graph",
      "caption": "Different components — take it. Running total 11.",
      "note": null,
      "codeLine": 4,
      "stats": {
        "weight": 11
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 11,
      "op": "graph",
      "caption": "Consider D–F (weight 6).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 11
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "compare",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "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": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 12,
      "op": "graph",
      "caption": "Different components — take it. Running total 17.",
      "note": null,
      "codeLine": 4,
      "stats": {
        "weight": 17
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": null
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 13,
      "op": "graph",
      "caption": "Consider C–E (weight 8).",
      "note": null,
      "codeLine": 2,
      "stats": {
        "weight": 17
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "compare",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": "active"
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 14,
      "op": "graph",
      "caption": "C and E are already connected — skip it, it would close a cycle.",
      "note": null,
      "codeLine": 5,
      "stats": {
        "weight": 17
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    },
    {
      "i": 15,
      "op": "graph",
      "caption": "Minimum spanning tree complete: 5 edges, total weight 17.",
      "note": null,
      "codeLine": 5,
      "stats": {
        "weight": 17
      },
      "nodes": [
        {
          "id": "A",
          "label": "A",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "B",
          "label": "B",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "C",
          "label": "C",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "D",
          "label": "D",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "E",
          "label": "E",
          "text": null,
          "focus": "settled",
          "badges": null
        },
        {
          "id": "F",
          "label": "F",
          "text": null,
          "focus": "settled",
          "badges": null
        }
      ],
      "edges": [
        {
          "from": "A",
          "to": "B",
          "weight": 4,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "A",
          "to": "C",
          "weight": 2,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "C",
          "weight": 1,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "B",
          "to": "D",
          "weight": 5,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "C",
          "to": "E",
          "weight": 8,
          "directed": false,
          "tone": "discarded"
        },
        {
          "from": "D",
          "to": "F",
          "weight": 6,
          "directed": false,
          "tone": "settled"
        },
        {
          "from": "E",
          "to": "F",
          "weight": 3,
          "directed": false,
          "tone": "settled"
        }
      ],
      "rows": [
        {
          "label": "edges by weight",
          "items": [
            "BC",
            "AC",
            "EF",
            "AB",
            "BD",
            "DF",
            "CE"
          ]
        }
      ]
    }
  ]
}