Documentation
¶
Index ¶
- Variables
- type BellmanFord
- func (b *BellmanFord[T]) AddEdge(from, to int, cost T)
- func (b *BellmanFord[T]) BellmanFord(s int) bool
- func (b *BellmanFord[T]) Distance(t int) T
- func (b *BellmanFord[T]) FindNegativeCycle() bool
- func (b *BellmanFord[T]) Infinity() T
- func (b *BellmanFord[T]) Order() int
- func (b *BellmanFord[T]) ShortestPath(t int) []int
- type BinaryHeap
- type BinaryHeap117
- type BinaryHeap117CmpFunc
- type BinaryHeapCompFunc
- type Deque
- func (dq *Deque[T]) Back() T
- func (dq *Deque[T]) Empty() bool
- func (dq *Deque[T]) Front() T
- func (dq *Deque[T]) PopBack() T
- func (dq *Deque[T]) PopFront() T
- func (dq *Deque[T]) PushBack(x T)
- func (dq *Deque[T]) PushBackRange(v []T)
- func (dq *Deque[T]) PushFront(x T)
- func (dq *Deque[T]) PushFrontRange(v []T)
- func (dq *Deque[T]) Size() int
- type Deque117
- func (d *Deque117) Back() interface{}
- func (d *Deque117) Empty() bool
- func (d *Deque117) Front() interface{}
- func (d *Deque117) PopBack() interface{}
- func (d *Deque117) PopFront() interface{}
- func (d *Deque117) PushBack(x interface{})
- func (d *Deque117) PushBackRange(v []interface{})
- func (d *Deque117) PushFront(x interface{})
- func (d *Deque117) PushFrontRange(v []interface{})
- func (d *Deque117) Size() int
- type Dijkstra
- type Queue
- type Queue117
- type Stack
- type Stack117
- type UnionFind
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBellmanFordOutOfRange = errors.New("BellmanFord: index out of range")
View Source
var ErrBinaryHeap117Empty = errors.New("BinaryHeap117: binary-heap is empty")
View Source
var ErrBinaryHeapEmpty = errors.New("BinaryHeap: binary-heap is empty")
View Source
var ErrDeque117Empty = errors.New("Deque117: deque is empty")
View Source
var ErrDequeEmpty = errors.New("Deque: deque is empty")
View Source
var ErrDijkstraOutOfRange = errors.New("Dijkstra: index out of range")
View Source
var ErrQueue117Empty = errors.New("Queue117: queue is empty")
View Source
var ErrQueueEmpty = errors.New("Queue: queue is empty")
View Source
var ErrStack117Empty = errors.New("Stack117: stack is empty")
View Source
var ErrStackEmpty = errors.New("Stack: stack is empty")
View Source
var ErrUnionFindOutOfRange = errors.New("UnionFind: index out of range")
Functions ¶
This section is empty.
Types ¶
type BellmanFord ¶
type BellmanFord[T constraints.Integer | constraints.Float] struct { // contains filtered or unexported fields }
func NewBellmanFord ¶
func NewBellmanFord[T constraints.Integer | constraints.Float](n int, inf T) *BellmanFord[T]
func NewDefaultBellmanFord ¶
func NewDefaultBellmanFord(n int) *BellmanFord[int]
func (*BellmanFord[T]) AddEdge ¶
func (b *BellmanFord[T]) AddEdge(from, to int, cost T)
func (*BellmanFord[T]) BellmanFord ¶
func (b *BellmanFord[T]) BellmanFord(s int) bool
func (*BellmanFord[T]) Distance ¶
func (b *BellmanFord[T]) Distance(t int) T
func (*BellmanFord[T]) FindNegativeCycle ¶
func (b *BellmanFord[T]) FindNegativeCycle() bool
func (*BellmanFord[T]) Infinity ¶
func (b *BellmanFord[T]) Infinity() T
func (*BellmanFord[T]) Order ¶
func (b *BellmanFord[T]) Order() int
func (*BellmanFord[T]) ShortestPath ¶
func (b *BellmanFord[T]) ShortestPath(t int) []int
type BinaryHeap ¶
type BinaryHeap[T any] struct { // contains filtered or unexported fields }
func NewBinaryHeap ¶
func NewBinaryHeap[T any](f BinaryHeapCompFunc[T]) *BinaryHeap[T]
func NewDefaultBinaryHeap ¶
func NewDefaultBinaryHeap[T constraints.Ordered]() *BinaryHeap[T]
func (*BinaryHeap[T]) Empty ¶
func (b *BinaryHeap[T]) Empty() bool
func (*BinaryHeap[T]) Pop ¶
func (b *BinaryHeap[T]) Pop() T
func (*BinaryHeap[T]) Push ¶
func (b *BinaryHeap[T]) Push(x T)
func (*BinaryHeap[T]) Size ¶
func (b *BinaryHeap[T]) Size() int
func (*BinaryHeap[T]) Top ¶
func (b *BinaryHeap[T]) Top() T
type BinaryHeap117 ¶
type BinaryHeap117 struct {
// contains filtered or unexported fields
}
A binary-heap data structure.
func NewBinaryHeap117 ¶
func NewBinaryHeap117(f BinaryHeap117CmpFunc) *BinaryHeap117
Create a new binary-heap.
func NewDefaultBinaryHeap117 ¶
func NewDefaultBinaryHeap117() *BinaryHeap117
Create a new basic binary-heap.
func (*BinaryHeap117) Empty ¶
func (b *BinaryHeap117) Empty() bool
Checks if the binary-heap is empty.
func (*BinaryHeap117) Pop ¶
func (b *BinaryHeap117) Pop() interface{}
Removes and returns the largest element.
func (*BinaryHeap117) Push ¶
func (b *BinaryHeap117) Push(x interface{})
Inserts an element into the binary-heap.
type BinaryHeap117CmpFunc ¶
type BinaryHeap117CmpFunc func(a, b interface{}) bool
type BinaryHeapCompFunc ¶
type Deque ¶
func (*Deque[T]) PushBackRange ¶
func (dq *Deque[T]) PushBackRange(v []T)
func (*Deque[T]) PushFrontRange ¶
func (dq *Deque[T]) PushFrontRange(v []T)
type Deque117 ¶
A deque data structure.
func (*Deque117) PopBack ¶
func (d *Deque117) PopBack() interface{}
Removes and returns the last element.
func (*Deque117) PopFront ¶
func (d *Deque117) PopFront() interface{}
Removes and returns the first element.
func (*Deque117) PushBack ¶
func (d *Deque117) PushBack(x interface{})
Inserts an element at the back.
func (*Deque117) PushBackRange ¶
func (d *Deque117) PushBackRange(v []interface{})
Inserts elements at the back.
func (*Deque117) PushFront ¶
func (d *Deque117) PushFront(x interface{})
Inserts an element at the front.
func (*Deque117) PushFrontRange ¶
func (d *Deque117) PushFrontRange(v []interface{})
Inserts elements at the front.
type Dijkstra ¶
type Dijkstra[T constraints.Integer | constraints.Float] struct { // contains filtered or unexported fields }
func NewDefaultDijkstra ¶
func NewDijkstra ¶
func NewDijkstra[T constraints.Integer | constraints.Float](n int, inf T) *Dijkstra[T]
func (*Dijkstra[T]) ShortestPath ¶
type Queue117 ¶
type Queue117 struct {
Data []interface{}
}
A queue structure.
type Stack117 ¶
type Stack117 struct {
Data []interface{}
}
A stack structure.
type UnionFind ¶
type UnionFind struct {
// contains filtered or unexported fields
}
func NewUnionFind ¶
Click to show internal directories.
Click to hide internal directories.