Spanning Tree Enumerator
Spanning Tree Enumerator calculates the number of spanning trees in a complete graph \\( K_n \\) using Cayley’s formula. Enter the number of vertices \\( n \\) (e.g., 4). The calculator computes the number of spanning trees (\\( n^{n-2} \\)), shows steps with MathJax, and visualizes a sample spanning tree for \\( K_n \\) using p5.js.
Spanning Tree Enumerator
This calculator computes the number of spanning trees in a complete graph \\( K_n \\) with \\( n \\) vertices using Cayley’s formula: \\( n^{n-2} \\). Input a positive integer \\( n \geq 2 \\). The calculator provides the exact count, displays computational steps with MathJax, and visualizes a randomly generated spanning tree for \\( K_n \\) using p5.js. A spanning tree is a subgraph that is a tree (connected, no cycles) and includes all vertices.
Example 1: Small Graph
Input: \\( n=3 \\).
Result: Number of spanning trees = \\( 3^{3-2} = 3 \\).
Meaning: \\( K_3 \\) (triangle) has 3 spanning trees, each a path of length 2.
Example 2: Complete Graph
Input: \\( n=4 \\).
Result: Number of spanning trees = \\( 4^{4-2} = 16 \\).
Meaning: \\( K_4 \\) has 16 unique spanning trees.
Example 3: Larger Graph
Input: \\( n=5 \\).
Result: Number of spanning trees = \\( 5^{5-2} = 125 \\).
Meaning: \\( K_5 \\) has 125 spanning trees.