Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllGraphWeights ¶
func AllGraphWeights(wgr EdgeWeightedGraph) []float64
AllGraphWeights returns all edge weights of an edge-weighted graph.
func TotalGraphWeight ¶
func TotalGraphWeight(wgr EdgeWeightedGraph) float64
TotalGraphWeight returns total weight of a grapgrh.
Types ¶
type EdgeWeightedGraph ¶
type EdgeWeightedGraph interface { graph.Graph // AdjacentWeights returns weights of edges adjacent to the vertex. AdjacentWeights(vertexID int) []float64 }
EdgeWeightedGraph is a graph where each edge has an associated weight.
func BuildMinimumSpanningTreeKruskal ¶
func BuildMinimumSpanningTreeKruskal(wgr EdgeWeightedGraph) EdgeWeightedGraph
BuildMinimumSpanningTreeKruskal computes minimum spanning tree using Kruskal's algorithm. https://algs4.cs.princeton.edu/43mst/KruskalMST.java.html
func BuildMinimumSpanningTreePrim ¶
func BuildMinimumSpanningTreePrim(wgr EdgeWeightedGraph) EdgeWeightedGraph
BuildMinimumSpanningTreePrim computes minimum spanning tree using Prim's algorithm. https://algs4.cs.princeton.edu/43mst/PrimMST.java.html
type ImplEdgeWeightedGraph ¶
ImplEdgeWeightedGraph is an implementaion of EdgeWeightedGraph.
func NewImplEdgeWeightedGraph ¶
func NewImplEdgeWeightedGraph( numVertices int, numEdges int, adjacency [][]int, weights [][]float64, ) *ImplEdgeWeightedGraph
NewImplEdgeWeightedGraph creates instance of EdgeWeightedGraph.
func (*ImplEdgeWeightedGraph) AdjacentWeights ¶
func (wgr *ImplEdgeWeightedGraph) AdjacentWeights(vertexID int) []float64
AdjacentWeights returns weights of edges adjacent to the vertex.