graph

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 3 Imported by: 0

README

graph

graph

TODO

  • Extract Shortest -> Dijkstra shortest func taking graph + other
  • Extract Simplify to func taking graph returning graph

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DijkstraShortest

func DijkstraShortest(g Graph, from, to int) (int, []int)

func RemoveEdge

func RemoveEdge(v *Vertex, edge int)

func Simplify

func Simplify(g Graph)

Types

type Graph

type Graph map[int]*Vertex

func New

func New() Graph

func (*Graph) AddBiEdge

func (g *Graph) AddBiEdge(from, to, cost int)

func (Graph) AddEdge

func (g Graph) AddEdge(from, to, cost int)

func (Graph) String

func (g Graph) String() string

type Vertex

type Vertex struct {
	Neighbours map[int]int
	Order      []int
}

func NewVertex

func NewVertex() *Vertex

func (*Vertex) AddEdge

func (v *Vertex) AddEdge(to, cost int)

func (*Vertex) Sort

func (v *Vertex) Sort()

Jump to

Keyboard shortcuts

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