Skip to content

daviddengcn/go-algs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms

In this repository, some algorithms are implemented in go language.

GoDoc link: ed maxflow

About Max-flow problem:

A flow network is represented in a directed acyclic graph(DAG). Each edge has a nonnegative capacity, to which the flow is limited. There are a source node s and a sink node t. s has no incoming edges, and t has no outgoing edges. All other nodes are internal nodes, in which the amount of incoming flow must equal to the amount of ougoing flow. The goal of the max-flow problem is, given a flow network, to find a flow of maximum value.

max-flow GoSearch

This package implements the max-flow(min-cuts, graph-cuts) algorithm that is used to solve the labeling problem in computer vision or graphics area.

Usage:

    g := maxflow.NewGraph()
    
    nodes := make([]*maxflow.Node, 2)
    
    for i := range(nodes) {
        nodes[i] = g.AddNode()
    } // for i
    
    g.SetTweights(nodes[0], 1, 5)
    g.SetTweights(nodes[1], 2, 6)
    g.AddEdge(nodes[0], nodes[1], 3, 4)
    
    g.Run();

    flow := g.Flow()

    isSource0 := g.IsSource(nodes[0])

ed GoSearch

This package implements the edit-distance algorithm that is used to compute the similarity between two strings, or more generally defined lists.

  1. For computing the standard edit-distance of two strings, call ed.String or ed.StringFull function.

  2. For generally defined lists, implement the ed.Interface, and use ed.EditDistance or ed.EditDistanceFull function.

LICENSE

BSD license

About

Some algorithms in go: maxflow(min-cuts or graph-cuts), edit-distance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages