ewdigraph

package
v0.0.0-...-118f76d Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDigraphWeights

func AllDigraphWeights(wdgr ewgraph.EdgeWeightedGraph) []float64

AllDigraphWeights returns all edges of an edge-weighted digraph.

func TotalDigraphWeight

func TotalDigraphWeight(wdgr ewgraph.EdgeWeightedGraph) float64

TotalDigraphWeight returns total weight of a digraph.

Types

type ShortestPaths

type ShortestPaths struct {
	// contains filtered or unexported fields
}

ShortestPaths is a collection of paths from the source vertex to other vertices.

func FindShortedPathsBellmanFord

func FindShortedPathsBellmanFord(wdgr ewgraph.EdgeWeightedGraph, vertexID int) (ShortestPaths, []int)

FindShortedPathsBellmanFord returns shortest paths from a vertex. https://algs4.cs.princeton.edu/44sp/BellmanFordSP.java.html

func FindShortedPathsDijkstra

func FindShortedPathsDijkstra(wdgr ewgraph.EdgeWeightedGraph, vertexID int) ShortestPaths

FindShortedPathsDijkstra returns shortest paths from a vertex. https://algs4.cs.princeton.edu/44sp/DijkstraSP.java.html

func (ShortestPaths) HasPathTo

func (paths ShortestPaths) HasPathTo(vertexID int) bool

HasPathTo tells if a vertex is connected with source vertex.

func (ShortestPaths) PathTo

func (paths ShortestPaths) PathTo(vertexID int) ([]int, float64)

PathTo returns path from source vertex to a vertex.

func (ShortestPaths) SourceVertex

func (paths ShortestPaths) SourceVertex() int

SourceVertex gets source vertex.

func (ShortestPaths) VertexCount

func (paths ShortestPaths) VertexCount() int

VertexCount gets number of vertices connected with source vertex.

Jump to

Keyboard shortcuts

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