graphs

package
v0.0.0-...-83ea666 Latest Latest
Warning

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

Go to latest
Published: May 9, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjacencyList

type AdjacencyList map[interface{}]Connections

type Connection

type Connection struct {
	Key    interface{}
	Weight int
}

type Connections

type Connections []Connection

type DirectedGraph

type DirectedGraph struct {
	// contains filtered or unexported fields
}

func NewDirectedGraph

func NewDirectedGraph() *DirectedGraph

func (*DirectedGraph) Append

func (graph *DirectedGraph) Append(key interface{})

func (*DirectedGraph) AppendAdjacencyList

func (graph *DirectedGraph) AppendAdjacencyList(adjacencies AdjacencyList)

func (*DirectedGraph) BreadthFirstSearch

func (graph *DirectedGraph) BreadthFirstSearch(startKey interface{}, callback GraphSearchCallback)

func (*DirectedGraph) Connect

func (graph *DirectedGraph) Connect(fromKey, toKey interface{}, weight int)

func (*DirectedGraph) DepthFirstSearch

func (graph *DirectedGraph) DepthFirstSearch(startKey interface{}, callback GraphSearchCallback)

func (*DirectedGraph) RouteExists

func (graph *DirectedGraph) RouteExists(startKey, endKey interface{}) bool

func (*DirectedGraph) Vertices

func (graph *DirectedGraph) Vertices() VertexMap

type Edge

type Edge struct {
	From   *Vertex
	To     *Vertex
	Weight int
}

func (*Edge) Reverse

func (edge *Edge) Reverse() *Edge

type Graph

type Graph interface {
	Vertices() VertexMap
}

type GraphSearchCallback

type GraphSearchCallback func(vertex *Vertex) bool

type UndirectedGraph

type UndirectedGraph struct {
	*DirectedGraph
}

func NewUndirectedGraph

func NewUndirectedGraph() *UndirectedGraph

func (*UndirectedGraph) Connect

func (graph *UndirectedGraph) Connect(fromKey, toKey interface{}, weight int)

type Vertex

type Vertex struct {
	Edges []*Edge
	Value interface{}
	// contains filtered or unexported fields
}

type VertexMap

type VertexMap map[interface{}]*Vertex

Jump to

Keyboard shortcuts

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