kruskals

package module
v0.0.0-...-a585973 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2019 License: MIT Imports: 2 Imported by: 7 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build Status Coverage Status Go Report Card GoDoc MIT licensed

kruskals

Kruskal's algorithm is a minimum-spanning-tree algorithm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleWeightedEdge

type SimpleWeightedEdge struct {
	F, T, W int
}

SimpleWeightedEdge is a simple implementation of the interface. Initialize with 'F' (From), 'T' (To), 'W' (Weight).

func (SimpleWeightedEdge) From

func (s SimpleWeightedEdge) From() int

From returns the integer identifier of the first vertex.

func (SimpleWeightedEdge) To

func (s SimpleWeightedEdge) To() int

To returns the integer identifier of the second vertex.

func (SimpleWeightedEdge) Weight

func (s SimpleWeightedEdge) Weight() int

Weight returns the integer identifier of the weight/cost.

type WeightedEdge

type WeightedEdge interface {
	// From returns the integer identifier of the first vertex.
	From() int
	// To returns the integer identifier of the second vertex.
	To() int
	// Weight returns the integer identifier of the weight/cost.
	Weight() int
}

WeightedEdge is an undirected edge between vertices and a weight.

func MinimumSpanningTree

func MinimumSpanningTree(edges []WeightedEdge) []WeightedEdge

MinimumSpanningTree returns the fewest edges to span across the graph with the minimum cost based on weights.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL