concrete

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectedDenseGraph added in v1.0.3

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

DirectedDenseGraph represents a graph such that all IDs are in a contiguous block from 0 to n-1.

func NewDirectedDenseGraph added in v1.0.3

func NewDirectedDenseGraph(n int, passable bool, absent float64) *DirectedDenseGraph

NewDirectedDenseGraph creates a directed dense graph with n nodes. If passable is true all pairs of nodes will be connected by an edge with unit cost, otherwise every node will start unconnected with the cost specified by absent.

func (*DirectedDenseGraph) Edge added in v1.0.3

func (g *DirectedDenseGraph) Edge(u, v graph.Node) graph.Edge

func (*DirectedDenseGraph) Edges added in v1.0.3

func (g *DirectedDenseGraph) Edges() []graph.Edge

func (*DirectedDenseGraph) From added in v1.0.3

func (g *DirectedDenseGraph) From(n graph.Node) []graph.Node

func (*DirectedDenseGraph) Has added in v1.0.3

func (g *DirectedDenseGraph) Has(n graph.Node) bool

func (*DirectedDenseGraph) HasEdge added in v1.0.3

func (g *DirectedDenseGraph) HasEdge(x, y graph.Node) bool

func (*DirectedDenseGraph) HasEdgeFromTo added in v1.0.3

func (g *DirectedDenseGraph) HasEdgeFromTo(u, v graph.Node) bool

func (*DirectedDenseGraph) Matrix added in v1.0.3

func (g *DirectedDenseGraph) Matrix() mat64.Matrix

func (*DirectedDenseGraph) Nodes added in v1.0.3

func (g *DirectedDenseGraph) Nodes() []graph.Node

func (*DirectedDenseGraph) RemoveEdge added in v1.0.3

func (g *DirectedDenseGraph) RemoveEdge(e graph.Edge)

func (*DirectedDenseGraph) SetEdgeWeight added in v1.0.3

func (g *DirectedDenseGraph) SetEdgeWeight(e graph.Edge, weight float64)

func (*DirectedDenseGraph) To added in v1.0.3

func (g *DirectedDenseGraph) To(n graph.Node) []graph.Node

func (*DirectedDenseGraph) Weight added in v1.0.3

func (g *DirectedDenseGraph) Weight(e graph.Edge) float64

type DirectedGraph

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

A Directed graph is a highly generalized MutableDirectedGraph.

In most cases it's likely more desireable to use a graph specific to your problem domain.

func NewDirectedGraph

func NewDirectedGraph() *DirectedGraph

func (*DirectedGraph) AddNode

func (g *DirectedGraph) AddNode(n graph.Node)

Adds a node to the graph. Implementation note: if you add a node close to or at the max int on your machine NewNode will become slower.

func (*DirectedGraph) Degree

func (g *DirectedGraph) Degree(n graph.Node) int

func (*DirectedGraph) Edge added in v1.0.3

func (g *DirectedGraph) Edge(u, v graph.Node) graph.Edge

func (*DirectedGraph) Edges added in v1.0.3

func (g *DirectedGraph) Edges() []graph.Edge

func (*DirectedGraph) EmptyGraph

func (g *DirectedGraph) EmptyGraph()

func (*DirectedGraph) From added in v1.0.3

func (g *DirectedGraph) From(n graph.Node) []graph.Node

func (*DirectedGraph) Has added in v1.0.3

func (g *DirectedGraph) Has(n graph.Node) bool

func (*DirectedGraph) HasEdge added in v1.0.3

func (g *DirectedGraph) HasEdge(x, y graph.Node) bool

func (*DirectedGraph) HasEdgeFromTo added in v1.0.3

func (g *DirectedGraph) HasEdgeFromTo(u, v graph.Node) bool

func (*DirectedGraph) NewNodeID added in v1.0.3

func (g *DirectedGraph) NewNodeID() int

func (*DirectedGraph) Node added in v1.0.3

func (g *DirectedGraph) Node(id int) graph.Node

func (*DirectedGraph) Nodes added in v1.0.3

func (g *DirectedGraph) Nodes() []graph.Node

func (*DirectedGraph) RemoveEdge added in v1.0.3

func (g *DirectedGraph) RemoveEdge(e graph.Edge)

func (*DirectedGraph) RemoveNode

func (g *DirectedGraph) RemoveNode(n graph.Node)

func (*DirectedGraph) SetEdge added in v1.0.3

func (g *DirectedGraph) SetEdge(e graph.Edge, cost float64)

func (*DirectedGraph) To added in v1.0.3

func (g *DirectedGraph) To(n graph.Node) []graph.Node

func (*DirectedGraph) Weight added in v1.0.3

func (g *DirectedGraph) Weight(e graph.Edge) float64

type Edge

type Edge struct {
	F, T graph.Node
}

Just a collection of two nodes

func (Edge) From added in v1.0.3

func (e Edge) From() graph.Node

func (Edge) To added in v1.0.3

func (e Edge) To() graph.Node

type Graph

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

A GonumGraph is a very generalized graph that can handle an arbitrary number of vertices and edges -- as well as act as either directed or undirected.

Internally, it uses a map of successors AND predecessors, to speed up some operations (such as getting all successors/predecessors). It also speeds up things like adding edges (assuming both edges exist).

However, its generality is also its weakness (and partially a flaw in needing to satisfy MutableGraph). For most purposes, creating your own graph is probably better. For instance, see TileGraph for an example of an immutable 2D grid of tiles that also implements the Graph interface, but would be more suitable if all you needed was a simple undirected 2D grid.

func NewGraph

func NewGraph() *Graph

func (*Graph) AddNode

func (g *Graph) AddNode(n graph.Node)

func (*Graph) Degree

func (g *Graph) Degree(n graph.Node) int

func (*Graph) Edge added in v1.0.3

func (g *Graph) Edge(u, v graph.Node) graph.Edge

func (*Graph) EdgeBetween

func (g *Graph) EdgeBetween(u, v graph.Node) graph.Edge

func (*Graph) Edges added in v1.0.3

func (g *Graph) Edges() []graph.Edge

func (*Graph) EmptyGraph

func (g *Graph) EmptyGraph()

func (*Graph) From added in v1.0.3

func (g *Graph) From(n graph.Node) []graph.Node

func (*Graph) Has added in v1.0.3

func (g *Graph) Has(n graph.Node) bool

func (*Graph) HasEdge added in v1.0.3

func (g *Graph) HasEdge(n, neigh graph.Node) bool

func (*Graph) NewNodeID added in v1.0.3

func (g *Graph) NewNodeID() int

func (*Graph) Node added in v1.0.3

func (g *Graph) Node(id int) graph.Node

func (*Graph) Nodes added in v1.0.3

func (g *Graph) Nodes() []graph.Node

func (*Graph) RemoveEdge added in v1.0.3

func (g *Graph) RemoveEdge(e graph.Edge)

func (*Graph) RemoveNode

func (g *Graph) RemoveNode(n graph.Node)

func (*Graph) SetEdge added in v1.0.3

func (g *Graph) SetEdge(e graph.Edge, cost float64)

func (*Graph) Weight added in v1.0.3

func (g *Graph) Weight(e graph.Edge) float64

type Node

type Node int

A simple int alias.

func (Node) ID

func (n Node) ID() int

type UndirectedDenseGraph added in v1.0.3

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

UndirectedDenseGraph represents a graph such that all IDs are in a contiguous block from 0 to n-1.

func NewUndirectedDenseGraph added in v1.0.3

func NewUndirectedDenseGraph(n int, passable bool, absent float64) *UndirectedDenseGraph

NewUndirectedDenseGraph creates an undirected dense graph with n nodes. If passable is true all pairs of nodes will be connected by an edge with unit cost, otherwise every node will start unconnected with the cost specified by absent.

func (*UndirectedDenseGraph) Degree added in v1.0.3

func (g *UndirectedDenseGraph) Degree(n graph.Node) int

func (*UndirectedDenseGraph) Edge added in v1.0.3

func (g *UndirectedDenseGraph) Edge(u, v graph.Node) graph.Edge

func (*UndirectedDenseGraph) EdgeBetween added in v1.0.3

func (g *UndirectedDenseGraph) EdgeBetween(u, v graph.Node) graph.Edge

func (*UndirectedDenseGraph) Edges added in v1.0.3

func (g *UndirectedDenseGraph) Edges() []graph.Edge

func (*UndirectedDenseGraph) From added in v1.0.3

func (g *UndirectedDenseGraph) From(n graph.Node) []graph.Node

func (*UndirectedDenseGraph) Has added in v1.0.3

func (g *UndirectedDenseGraph) Has(n graph.Node) bool

func (*UndirectedDenseGraph) HasEdge added in v1.0.3

func (g *UndirectedDenseGraph) HasEdge(u, v graph.Node) bool

func (*UndirectedDenseGraph) Matrix added in v1.0.3

func (g *UndirectedDenseGraph) Matrix() mat64.Matrix

func (*UndirectedDenseGraph) Nodes added in v1.0.3

func (g *UndirectedDenseGraph) Nodes() []graph.Node

func (*UndirectedDenseGraph) RemoveEdge added in v1.0.3

func (g *UndirectedDenseGraph) RemoveEdge(e graph.Edge)

func (*UndirectedDenseGraph) SetEdgeWeight added in v1.0.3

func (g *UndirectedDenseGraph) SetEdgeWeight(e graph.Edge, weight float64)

func (*UndirectedDenseGraph) Weight added in v1.0.3

func (g *UndirectedDenseGraph) Weight(e graph.Edge) float64

type WeightedEdge

type WeightedEdge struct {
	graph.Edge
	Cost float64
}

Jump to

Keyboard shortcuts

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