algorithm

package
v0.0.0-...-abed7bd Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2015 License: BSD-3-Clause Imports: 4 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Choose

func Choose(_a interface{}, chooser interface{})

// Given a pointer to a slice and a Chooser, type as the input // slice that contains only those elements of the input slice for which // choose() returns true. The elements of the returned slice will be in the // same order that they were in in the input slice.

func Dijkstra

func Dijkstra(g Graph, src []int, dst []int) (float64, []int)

func Map2

func Map2(_in interface{}, _out interface{}, mapper interface{})

func ReachableDestinations

func ReachableDestinations(g Graph, src []int, dst []int) []int

Returns a list of all elements in dst that can be reached by some element in src.

func ReachableWithinBounds

func ReachableWithinBounds(g Graph, src []int, min, max float64) []int

Returns the list of vertices whose shortest path from the sources are of length that satisfies min <= length <= max

func ReachableWithinLimit

func ReachableWithinLimit(g Graph, src []int, limit float64) []int

Returns the list of vertices that can be reached from the vertices in src with total path weight <= limit.

func TopoSort

func TopoSort(dag DiGraph) []int

Given an acyclic DiGraph returns an ordering of the vertices such that no vertex occurs later in the ordering that one of its successors nil will be returned if a cyclic dag is given as input

Types

type Chooser

type Chooser func(interface{}) bool

type DiGraph

type DiGraph interface {
	NumVertex() int
	Successors(int) []int
}

type Graph

type Graph interface {
	NumVertex() int
	Adjacent(int) ([]int, []float64)
}

type Mapper

type Mapper func(a interface{}) interface{}

Jump to

Keyboard shortcuts

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