// Weight return the weight value of the minimum spanning tree
Weight return the weight value of the minimum spanning tree
// Weight return the weight value of the minimum spanning tree
func (m MinSpanningTree) Weight() (weightedgraph.Weight, error) {
	var totalWeight weightedgraph.Weight
	for _, v := range m.edges {
		w, err := m.g.Weight(v.From, v.To)
		if err != nil {
			return 0, err
		}
		totalWeight += w
	}
	return totalWeight, nil
}
func ( m MinSpanningTree ) Weight ( ) ( weightedgraph . Weight , error ) { var totalWeight weightedgraph . Weight for _ , v := range m . edges { w , err := m . g . Weight ( v . From , v . To ) if err != nil { return 0 , err } totalWeight += w } return totalWeight , nil }
Weight return the weight value of the minimum spanning tree
Weight return the weight value of the minimum spanning tree