Documentation ¶
Index ¶
- Constants
- Variables
- func IsVisited(visited []string, child string) ([]string, bool)
- func NewPrioPathQueue() prioShortestPaths
- func NewPrioQueue(nodes []string, less func(n1, n2 string) bool) *prioQueueImpl
- type Color
- type DAG
- type DFSData
- type DagType
- type DirectedGraphImpl
- func (d *DirectedGraphImpl) Add(edge Edge) error
- func (d *DirectedGraphImpl) AddWithCost(edge Edge) error
- func (d *DirectedGraphImpl) BFS(vertex string, visit func(v, w string, c uint) bool) ([]string, error)
- func (d *DirectedGraphImpl) Clone() *DirectedGraphImpl
- func (d *DirectedGraphImpl) DFS(vertex ...string) ([]NodeAndDepth, error)
- func (d *DirectedGraphImpl) DFSWithData(vertex ...string) ([]NodeAndDepth, *DFSData, error)
- func (d *DirectedGraphImpl) FindAllShortestPaths(from, to string) ([][]string, error)
- func (d *DirectedGraphImpl) FindAllShortestPathsAndCost(from, to string) ([][]string, uint, error)
- func (d *DirectedGraphImpl) FindAllShortestPathsAndCostBFS(from, to string) ([][]string, uint, error)
- func (d *DirectedGraphImpl) FindAllShortestPathsBFS(from, to string) ([][]string, error)
- func (d *DirectedGraphImpl) GetEdge(nodeAndNeighbor NodeAndNeighbor) (Edge, error)
- func (d *DirectedGraphImpl) GetStronglyConnectedComponents() ([][]string, error)
- func (d *DirectedGraphImpl) IsStronglyConnected(vertex ...string) (bool, error)
- func (d *DirectedGraphImpl) KShortestPaths(from, to string, k int) ([]uint, [][]string, error)
- func (d *DirectedGraphImpl) New() Graph
- func (d *DirectedGraphImpl) Nodes() []string
- func (d *DirectedGraphImpl) Order() int
- func (d *DirectedGraphImpl) Path() GraphPath
- func (g DirectedGraphImpl) PathLength(path []string) uint
- func (d *DirectedGraphImpl) Remove(nodeAndNeighbor NodeAndNeighbor) error
- func (d *DirectedGraphImpl) RemoveEdge(nodeAndNeighbor NodeAndNeighbor) error
- func (d *DirectedGraphImpl) ShortestPath(v, w string) ([]string, error)
- func (d *DirectedGraphImpl) ShortestPathAndCost(v, w string) ([]string, uint, error)
- func (d *DirectedGraphImpl) ShortestPathWithCost(v, w string) ([]string, uint, error)
- func (d *DirectedGraphImpl) ShortestPaths(from string) (map[string]uint, map[string]string, error)
- func (d *DirectedGraphImpl) Size() int
- func (d *DirectedGraphImpl) String() string
- func (d *DirectedGraphImpl) TopologicalSort() ([]NodeAndDepth, error)
- func (d *DirectedGraphImpl) Transpose() (*DirectedGraphImpl, error)
- func (d *DirectedGraphImpl) Visit(vertex string, visit func(w string, c uint) bool) error
- func (d *DirectedGraphImpl) Walk(vertex string, visit func(w string, c uint) bool) error
- type Edge
- type Graph
- type GraphPath
- type Node
- type NodeAndDepth
- type NodeAndNeighbor
- type UndirectedGraph
- type UndirectedGraphImpl
- func (g *UndirectedGraphImpl) Add(edge Edge) error
- func (g *UndirectedGraphImpl) AddBoth(edge Edge) error
- func (g *UndirectedGraphImpl) AddWithCost(edge Edge) error
- func (g *UndirectedGraphImpl) AddWithCostBoth(edge Edge) error
- func (g *UndirectedGraphImpl) BFS(node string, visit func(v, w string, c uint) bool) ([]string, error)
- func (g *UndirectedGraphImpl) DFS(vertex ...string) ([]NodeAndDepth, error)
- func (g *UndirectedGraphImpl) DFSWithData(vertex ...string) ([]NodeAndDepth, *DFSData, error)
- func (g *UndirectedGraphImpl) FindAllShortestPaths(from, to string) ([][]string, error)
- func (g *UndirectedGraphImpl) FindAllShortestPathsAndCost(from, to string) ([][]string, uint, error)
- func (g *UndirectedGraphImpl) FindAllShortestPathsAndCostBFS(from, to string) ([][]string, uint, error)
- func (g *UndirectedGraphImpl) FindAllShortestPathsBFS(from, to string) ([][]string, error)
- func (g *UndirectedGraphImpl) GetBridges() []Edge
- func (g *UndirectedGraphImpl) GetEdge(nodeAndNeighbor NodeAndNeighbor) (Edge, error)
- func (g *UndirectedGraphImpl) IsStronglyConnected(vertex ...string) (bool, error)
- func (g *UndirectedGraphImpl) KShortestPaths(from, to string, k int) ([]uint, [][]string, error)
- func (g *UndirectedGraphImpl) New() Graph
- func (g *UndirectedGraphImpl) Nodes() []string
- func (g *UndirectedGraphImpl) Order() int
- func (g *UndirectedGraphImpl) Path() GraphPath
- func (g UndirectedGraphImpl) PathLength(path []string) uint
- func (g *UndirectedGraphImpl) Remove(nodeAndNeighbor NodeAndNeighbor) error
- func (g *UndirectedGraphImpl) RemoveBoth(nodeAndNeighbor NodeAndNeighbor) error
- func (g *UndirectedGraphImpl) RemoveEdge(nodeAndNeighbor NodeAndNeighbor) error
- func (g *UndirectedGraphImpl) RemoveEdgeBoth(nodeAndNeighbor NodeAndNeighbor) error
- func (g *UndirectedGraphImpl) ShortestPath(v, w string) ([]string, error)
- func (g *UndirectedGraphImpl) ShortestPathAndCost(v, w string) ([]string, uint, error)
- func (g *UndirectedGraphImpl) ShortestPathWithCost(v, w string) ([]string, uint, error)
- func (g *UndirectedGraphImpl) ShortestPaths(v string) (map[string]uint, map[string]string, error)
- func (g *UndirectedGraphImpl) Size() int
- func (g *UndirectedGraphImpl) String() string
- func (g *UndirectedGraphImpl) Transpose() (*UndirectedGraphImpl, error)
- func (g *UndirectedGraphImpl) Visit(node string, visit func(w string, c uint) bool) error
- func (g *UndirectedGraphImpl) Walk(node string, visit func(w string, c uint) bool) error
Constants ¶
View Source
const (
Infinity = ^uint(0)
)
Variables ¶
Functions ¶
func NewPrioPathQueue ¶ added in v1.0.2
func NewPrioPathQueue() prioShortestPaths
func NewPrioQueue ¶ added in v1.0.2
Types ¶
type DAG ¶
type DAG interface { Graph TopologicalSort() ([]NodeAndDepth, error) }
type DirectedGraphImpl ¶
func NewDirectedGraph ¶
func NewDirectedGraph(opts ...DagType) *DirectedGraphImpl
func (*DirectedGraphImpl) Add ¶ added in v1.0.2
func (d *DirectedGraphImpl) Add(edge Edge) error
func (*DirectedGraphImpl) AddWithCost ¶
func (d *DirectedGraphImpl) AddWithCost(edge Edge) error
func (*DirectedGraphImpl) Clone ¶
func (d *DirectedGraphImpl) Clone() *DirectedGraphImpl
func (*DirectedGraphImpl) DFS ¶
func (d *DirectedGraphImpl) DFS(vertex ...string) ([]NodeAndDepth, error)
func (*DirectedGraphImpl) DFSWithData ¶
func (d *DirectedGraphImpl) DFSWithData(vertex ...string) ([]NodeAndDepth, *DFSData, error)
func (*DirectedGraphImpl) FindAllShortestPaths ¶
func (d *DirectedGraphImpl) FindAllShortestPaths(from, to string) ([][]string, error)
func (*DirectedGraphImpl) FindAllShortestPathsAndCost ¶
func (d *DirectedGraphImpl) FindAllShortestPathsAndCost(from, to string) ([][]string, uint, error)
func (*DirectedGraphImpl) FindAllShortestPathsAndCostBFS ¶
func (d *DirectedGraphImpl) FindAllShortestPathsAndCostBFS(from, to string) ([][]string, uint, error)
func (*DirectedGraphImpl) FindAllShortestPathsBFS ¶
func (d *DirectedGraphImpl) FindAllShortestPathsBFS(from, to string) ([][]string, error)
func (*DirectedGraphImpl) GetEdge ¶ added in v1.0.2
func (d *DirectedGraphImpl) GetEdge(nodeAndNeighbor NodeAndNeighbor) (Edge, error)
func (*DirectedGraphImpl) GetStronglyConnectedComponents ¶ added in v1.0.1
func (d *DirectedGraphImpl) GetStronglyConnectedComponents() ([][]string, error)
func (*DirectedGraphImpl) IsStronglyConnected ¶ added in v1.0.1
func (d *DirectedGraphImpl) IsStronglyConnected(vertex ...string) (bool, error)
func (*DirectedGraphImpl) KShortestPaths ¶ added in v1.0.2
func (*DirectedGraphImpl) New ¶
func (d *DirectedGraphImpl) New() Graph
func (*DirectedGraphImpl) Nodes ¶
func (d *DirectedGraphImpl) Nodes() []string
func (*DirectedGraphImpl) Order ¶
func (d *DirectedGraphImpl) Order() int
func (*DirectedGraphImpl) Path ¶ added in v1.0.2
func (d *DirectedGraphImpl) Path() GraphPath
func (DirectedGraphImpl) PathLength ¶ added in v1.0.2
func (*DirectedGraphImpl) Remove ¶ added in v1.0.2
func (d *DirectedGraphImpl) Remove(nodeAndNeighbor NodeAndNeighbor) error
func (*DirectedGraphImpl) RemoveEdge ¶
func (d *DirectedGraphImpl) RemoveEdge(nodeAndNeighbor NodeAndNeighbor) error
func (*DirectedGraphImpl) ShortestPath ¶
func (d *DirectedGraphImpl) ShortestPath(v, w string) ([]string, error)
func (*DirectedGraphImpl) ShortestPathAndCost ¶
func (d *DirectedGraphImpl) ShortestPathAndCost(v, w string) ([]string, uint, error)
func (*DirectedGraphImpl) ShortestPathWithCost ¶ added in v1.0.2
func (d *DirectedGraphImpl) ShortestPathWithCost(v, w string) ([]string, uint, error)
func (*DirectedGraphImpl) ShortestPaths ¶
func (*DirectedGraphImpl) Size ¶
func (d *DirectedGraphImpl) Size() int
func (*DirectedGraphImpl) String ¶
func (d *DirectedGraphImpl) String() string
func (*DirectedGraphImpl) TopologicalSort ¶
func (d *DirectedGraphImpl) TopologicalSort() ([]NodeAndDepth, error)
func (*DirectedGraphImpl) Transpose ¶ added in v1.0.1
func (d *DirectedGraphImpl) Transpose() (*DirectedGraphImpl, error)
type Graph ¶
type Graph interface { Order() int Size() int Visit(vertex string, visit func(w string, c uint) bool) error Path() GraphPath BFS(vertex string, visit func(v, w string, c uint) bool) ([]string, error) DFS(...string) ([]NodeAndDepth, error) DFSWithData(...string) ([]NodeAndDepth, *DFSData, error) AddWithCost(Edge) error ShortestPath(v, w string) ([]string, error) ShortestPathAndCost(v, w string) ([]string, uint, error) ShortestPaths(v string) (map[string]uint, map[string]string, error) KShortestPaths(from, to string, k int) ([]uint, [][]string, error) RemoveEdge(NodeAndNeighbor) error }
type NodeAndDepth ¶
type NodeAndNeighbor ¶
type UndirectedGraph ¶
type UndirectedGraphImpl ¶
func NewUndirectedGraph ¶
func NewUndirectedGraph() *UndirectedGraphImpl
func (*UndirectedGraphImpl) Add ¶ added in v1.0.2
func (g *UndirectedGraphImpl) Add(edge Edge) error
func (*UndirectedGraphImpl) AddBoth ¶ added in v1.0.2
func (g *UndirectedGraphImpl) AddBoth(edge Edge) error
func (*UndirectedGraphImpl) AddWithCost ¶
func (g *UndirectedGraphImpl) AddWithCost(edge Edge) error
func (*UndirectedGraphImpl) AddWithCostBoth ¶
func (g *UndirectedGraphImpl) AddWithCostBoth(edge Edge) error
func (*UndirectedGraphImpl) DFS ¶
func (g *UndirectedGraphImpl) DFS(vertex ...string) ([]NodeAndDepth, error)
func (*UndirectedGraphImpl) DFSWithData ¶
func (g *UndirectedGraphImpl) DFSWithData(vertex ...string) ([]NodeAndDepth, *DFSData, error)
func (*UndirectedGraphImpl) FindAllShortestPaths ¶
func (g *UndirectedGraphImpl) FindAllShortestPaths(from, to string) ([][]string, error)
func (*UndirectedGraphImpl) FindAllShortestPathsAndCost ¶
func (g *UndirectedGraphImpl) FindAllShortestPathsAndCost(from, to string) ([][]string, uint, error)
func (*UndirectedGraphImpl) FindAllShortestPathsAndCostBFS ¶
func (g *UndirectedGraphImpl) FindAllShortestPathsAndCostBFS(from, to string) ([][]string, uint, error)
func (*UndirectedGraphImpl) FindAllShortestPathsBFS ¶
func (g *UndirectedGraphImpl) FindAllShortestPathsBFS(from, to string) ([][]string, error)
func (*UndirectedGraphImpl) GetBridges ¶ added in v1.0.1
func (g *UndirectedGraphImpl) GetBridges() []Edge
func (*UndirectedGraphImpl) GetEdge ¶ added in v1.0.2
func (g *UndirectedGraphImpl) GetEdge(nodeAndNeighbor NodeAndNeighbor) (Edge, error)
func (*UndirectedGraphImpl) IsStronglyConnected ¶ added in v1.0.1
func (g *UndirectedGraphImpl) IsStronglyConnected(vertex ...string) (bool, error)
func (*UndirectedGraphImpl) KShortestPaths ¶ added in v1.0.2
func (*UndirectedGraphImpl) New ¶
func (g *UndirectedGraphImpl) New() Graph
func (*UndirectedGraphImpl) Nodes ¶
func (g *UndirectedGraphImpl) Nodes() []string
func (*UndirectedGraphImpl) Order ¶
func (g *UndirectedGraphImpl) Order() int
func (*UndirectedGraphImpl) Path ¶ added in v1.0.2
func (g *UndirectedGraphImpl) Path() GraphPath
func (UndirectedGraphImpl) PathLength ¶ added in v1.0.2
func (*UndirectedGraphImpl) Remove ¶ added in v1.0.2
func (g *UndirectedGraphImpl) Remove(nodeAndNeighbor NodeAndNeighbor) error
func (*UndirectedGraphImpl) RemoveBoth ¶ added in v1.0.2
func (g *UndirectedGraphImpl) RemoveBoth(nodeAndNeighbor NodeAndNeighbor) error
func (*UndirectedGraphImpl) RemoveEdge ¶
func (g *UndirectedGraphImpl) RemoveEdge(nodeAndNeighbor NodeAndNeighbor) error
func (*UndirectedGraphImpl) RemoveEdgeBoth ¶
func (g *UndirectedGraphImpl) RemoveEdgeBoth(nodeAndNeighbor NodeAndNeighbor) error
func (*UndirectedGraphImpl) ShortestPath ¶
func (g *UndirectedGraphImpl) ShortestPath(v, w string) ([]string, error)
func (*UndirectedGraphImpl) ShortestPathAndCost ¶
func (g *UndirectedGraphImpl) ShortestPathAndCost(v, w string) ([]string, uint, error)
func (*UndirectedGraphImpl) ShortestPathWithCost ¶ added in v1.0.2
func (g *UndirectedGraphImpl) ShortestPathWithCost(v, w string) ([]string, uint, error)
func (*UndirectedGraphImpl) ShortestPaths ¶
func (*UndirectedGraphImpl) Size ¶
func (g *UndirectedGraphImpl) Size() int
func (*UndirectedGraphImpl) String ¶
func (g *UndirectedGraphImpl) String() string
func (*UndirectedGraphImpl) Transpose ¶ added in v1.0.1
func (g *UndirectedGraphImpl) Transpose() (*UndirectedGraphImpl, error)
Click to show internal directories.
Click to hide internal directories.