{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Proof\n\nWe use [[Zorn's lemma|04RXTQA5ZA]] to get a maximal acyclic set of edges. For a finite graph, simply take an acyclic edge set of largest size instead.\n\n1. Let $G = (V, E)$. Let $\\mathcal{P}$ be the set of all $F \\subseteq E$ such that the [[subgraph|0P11X5HKAX]] $(V, F)$ is [[acyclic|0XNN9Z8E5A]]. Order $\\mathcal{P}$ by inclusion.\n2. $\\varnothing \\in \\mathcal{P}$, because a [[cycle|07CT9RDY7Q]] has positive length and so uses an edge. So $\\mathcal{P}$ is nonempty.\n3. Let $\\mathcal{K}$ be a nonempty chain in $\\mathcal{P}$, and let $U = \\bigcup \\mathcal{K}$. Suppose $(V, U)$ has a cycle with edges $e_1, \\dots, e_k$.\n4. Each $e_t$ lies in some $F_t \\in \\mathcal{K}$. Since $\\mathcal{K}$ is a chain, the largest of $F_1, \\dots, F_k$ contains all $e_t$.\n5. Then the cycle lies in $(V, F)$ for that $F \\in \\mathcal{P}$, a contradiction. So $U \\in \\mathcal{P}$, and $U$ is an upper bound of $\\mathcal{K}$. The empty chain has the upper bound $\\varnothing$.\n6. By Zorn's lemma, $\\mathcal{P}$ has a maximal element $F$. Let $H = (V, F)$. It is acyclic, and it contains every vertex of $G$.\n7. Suppose $H$ is not connected. Since $V$ is nonempty, there are $u, v \\in V$ such that $v$ is not [[reachable|0J8XE7W68F]] from $u$ in $H$.\n8. Since $G$ is [[connected|0FFAYNMAJZ]], there is a [[walk|0VJZM0F9YM]] $(w_0, \\dots, w_k)$ from $u$ to $v$ in $G$.\n9. If $w_t$ were reachable from $w_{t-1}$ in $H$ for each $t$, then $v$ would be reachable from $u$ in $H$, by transitivity of reachability. So some $t$ has $w_t$ not reachable from $w_{t-1}$ in $H$.\n10. Let $x = w_{t-1}$ and $y = w_t$. Then $xy \\in E$, and $xy \\notin F$, since otherwise $(x, y)$ would be a walk in $H$.\n11. Let $F^+ = F \\cup \\set{xy}$. Suppose $(V, F^+)$ has a cycle $(z_0, \\dots, z_m)$. Since $H$ is acyclic, one of its edges is $xy$, say $xy = z_{s-1} z_s$.\n12. The edges of a cycle are pairwise distinct. So all other edges of the cycle lie in $F$.\n13. Then $(z_s, z_{s+1}, \\dots, z_m, z_1, \\dots, z_{s-1})$ is a walk in $H$ from $z_s$ to $z_{s-1}$, using $z_m = z_0$. For $s = 1$ it is $(z_1, \\dots, z_m)$.\n14. The ends of this walk are $x$ and $y$. Reachability is symmetric, so $y$ is reachable from $x$ in $H$. This contradicts step 9. Hence $F^+ \\in \\mathcal{P}$.\n15. But $F \\subsetneq F^+$, which contradicts the maximality of $F$. So $H$ is connected.\n16. By steps 6 and 15, $H$ is a connected acyclic subgraph of $G$ with all the vertices of $G$. So $H$ is a [[tree|0MJ0JS72DZ]], and it is a [[spanning tree|0FQ5B8S1ZC]] of $G$.\n\n## Idea\n\nKeep as many edges as possible without making a cycle. If the result were disconnected, some edge of $G$ would join two of its pieces. Adding that edge cannot close a cycle, so the set was not as large as possible.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "kind": "proof",
    "msc": [
      "05C05"
    ],
    "name": "Proof that every connected graph has a spanning tree, by a maximal acyclic edge set",
    "proves": "04XPQT2XTC",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Spanning_tree"
      }
    ],
    "tag": "AS2P6GXVPT",
    "uses": [
      "0FFAYNMAJZ",
      "0FQ5B8S1ZC",
      "0MJ0JS72DZ",
      "0XNN9Z8E5A",
      "07CT9RDY7Q",
      "0P11X5HKAX",
      "0J8XE7W68F",
      "0VJZM0F9YM",
      "04RXTQA5ZA"
    ]
  },
  "kind": "proof",
  "link": "https://math2.tamnd.com/node/AS2P6GXVPT/",
  "links": [
    {
      "field": "proves",
      "target": "04XPQT2XTC"
    },
    {
      "field": "uses",
      "target": "0FFAYNMAJZ"
    },
    {
      "field": "uses",
      "target": "0FQ5B8S1ZC"
    },
    {
      "field": "uses",
      "target": "0MJ0JS72DZ"
    },
    {
      "field": "uses",
      "target": "0XNN9Z8E5A"
    },
    {
      "field": "uses",
      "target": "07CT9RDY7Q"
    },
    {
      "field": "uses",
      "target": "0P11X5HKAX"
    },
    {
      "field": "uses",
      "target": "0J8XE7W68F"
    },
    {
      "field": "uses",
      "target": "0VJZM0F9YM"
    },
    {
      "field": "uses",
      "target": "04RXTQA5ZA"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/AS2P6GXVPT.md",
  "msc": [
    "05C05"
  ],
  "name": "Proof that every connected graph has a spanning tree, by a maximal acyclic edge set",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/AS2/AS2P6GXVPT.md",
  "status": null,
  "tag": "AS2P6GXVPT",
  "uri": "m2://AS2P6GXVPT",
  "url": "https://math2.tamnd.com/wiki/proof-that-every-connected-graph-has-a-spanning-tree-by-a-maximal-acyclic-edge-set/",
  "writing": {
    "tag": "AS2P6GXVPT",
    "kind": "proof",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
