
Kruskal's algorithm: greedy on the cycle matroid
Source:R/matroid_optimisation_native.R
morie_minimum_spanning_tree.RdA disconnected graph has no spanning TREE, so connected is reported
and the result is a spanning forest. Returning its weight as though
it were a tree's would be quietly wrong.
Examples
K4E <- list(c(1, 2), c(2, 3), c(3, 4), c(4, 1), c(1, 3))
morie_minimum_spanning_tree(K4E, 4, c(4, 1, 3, 2, 5))
#> $weight
#> [1] 6
#>
#> $tree_edges
#> [1] 2 4 3
#>
#> $connected
#> [1] TRUE
#>
#> $n_components
#> [1] 1
#>
#> $n_edges_chosen
#> [1] 3
#>
#> $expected_tree_edges
#> [1] 3
#>
#> $n
#> [1] 4
#>
#> $warnings
#> character(0)
#>
#> $method
#> [1] "Kruskal's algorithm = greedy on the cycle matroid"
#>