graph

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Sugar = libfuncs.Sugar

Functions

func BaseHashString

func BaseHashString(data []forms.Form, sb strings.Builder) string

Generates a base string for hashing the heuristic Valid hash input strings must be 32 characters or less and only contain alphanumeric characters If the string is not valid then a random string is generated and used

func CostSummer

func CostSummer(timeslot, vote string, caps map[string]float64, sumCap float64) (map[string]float64, float64)

func HashHeuristic

func HashHeuristic(groupName, timeslot, FullHash string) float64

TODO: Figure out if this is doable with a rolling hash function

func MinCostPath

func MinCostPath(N, K, s, t int, edges []Edge) (float64, [][]int)

MinCostPath returns the minimum cost path from the start node to the end node Variable explanation N - number of nodes K - the minimum required flow. Setting this to group count seems to work well s - source node t - sink node edges - slice of edges

func RoundFloat

func RoundFloat(val float64, precision uint) float64

https://gosamples.dev/round-float/

func SolveMin_Cost

func SolveMin_Cost(args []string) (int, map[int]forms.Form, float64, [][]int, map[int]string, map[string]float64)

Types

type Edge

type Edge struct {
	From, To, Capacity int
	Cost               float64
}

func Translate

func Translate(data []forms.Form) ([]Edge, int, map[int]forms.Form, map[int]string, map[string]float64)

Translates data from the forms package to the graph package

Jump to

Keyboard shortcuts

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