Anonymous user
Floyd-Warshall algorithm: Difference between revisions
m
Convert tabs to spaces.
m (spelling) |
m (Convert tabs to spaces.) |
||
Line 745:
=={{header|Go}}==
<lang go>package main
import (
)
// A Graph is the interface implemented by graphs that
// this algorithm can run on.
type Graph interface {
}
// Nonnegative integer ID of vertex
type Vertex int
// ig is a graph of integers that satisfies the Graph interface.
type ig struct {
}
func (g ig) edge(u, v Vertex, w int) {
}
func (g ig) Vertices() []Vertex { return g.vert }
func (g ig) Neighbors(v Vertex) (vs []Vertex) {
}
func (g ig) Weight(u, v Vertex) int { return g.edges[u][v] }
func (g ig) path(vv []Vertex) (s string) {
}
const Infinity = int(^uint(0) >> 1)
func FloydWarshall(g Graph) (dist map[Vertex]map[Vertex]int, next map[Vertex]map[Vertex]*Vertex) {
}
}
}
}
}
}
}
func Path(u, v Vertex, next map[Vertex]map[Vertex]*Vertex) (path []Vertex) {
}
func main() {
}
}
}</lang>
{{out}}
|