concrete

package
v0.0.0-...-6fcca8b Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2016 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

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

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

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

func (*DirectedDenseGraph) Edges

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

func (*DirectedDenseGraph) From

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

func (*DirectedDenseGraph) Has

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

func (*DirectedDenseGraph) HasEdge

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

func (*DirectedDenseGraph) HasEdgeFromTo

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

func (*DirectedDenseGraph) Matrix

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

func (*DirectedDenseGraph) Nodes

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

func (*DirectedDenseGraph) RemoveEdge

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

func (*DirectedDenseGraph) SetEdgeWeight

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

func (*DirectedDenseGraph) To

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

func (*DirectedDenseGraph) Weight

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

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

func (*DirectedGraph) Edges

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

func (*DirectedGraph) EmptyGraph

func (g *DirectedGraph) EmptyGraph()

func (*DirectedGraph) From

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

func (*DirectedGraph) Has

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

func (*DirectedGraph) HasEdge

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

func (*DirectedGraph) HasEdgeFromTo

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

func (*DirectedGraph) NewNodeID

func (g *DirectedGraph) NewNodeID() int

func (*DirectedGraph) Node

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

func (*DirectedGraph) Nodes

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

func (*DirectedGraph) RemoveEdge

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

func (*DirectedGraph) RemoveNode

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

func (*DirectedGraph) SetEdge

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

func (*DirectedGraph) To

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

func (*DirectedGraph) Weight

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

func (e Edge) From() graph.Node

func (Edge) To

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

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

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

func (*Graph) EmptyGraph

func (g *Graph) EmptyGraph()

func (*Graph) From

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

func (*Graph) Has

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

func (*Graph) HasEdge

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

func (*Graph) NewNodeID

func (g *Graph) NewNodeID() int

func (*Graph) Node

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

func (*Graph) Nodes

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

func (*Graph) RemoveEdge

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

func (*Graph) RemoveNode

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

func (*Graph) SetEdge

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

func (*Graph) Weight

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

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

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

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

func (*UndirectedDenseGraph) Edge

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

func (*UndirectedDenseGraph) EdgeBetween

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

func (*UndirectedDenseGraph) Edges

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

func (*UndirectedDenseGraph) From

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

func (*UndirectedDenseGraph) Has

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

func (*UndirectedDenseGraph) HasEdge

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

func (*UndirectedDenseGraph) Matrix

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

func (*UndirectedDenseGraph) Nodes

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

func (*UndirectedDenseGraph) RemoveEdge

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

func (*UndirectedDenseGraph) SetEdgeWeight

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

func (*UndirectedDenseGraph) Weight

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