graph

package
v0.0.0-...-f550c6f Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DijkstraState

type DijkstraState struct {
	Id            int
	DistFromStart int
}

type Prim

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

Prim最小生成树算法

func NewPrim

func NewPrim(graph [][][]int) *Prim

func (*Prim) AllConnected

func (p *Prim) AllConnected() bool

判断最小生成树是否包含图中的所有节点

func (*Prim) MinWeightSum

func (p *Prim) MinWeightSum() int

返回最小生成树的权重和

type ProbState

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

type ProbStateHeap

type ProbStateHeap []ProbState

func (ProbStateHeap) Len

func (p ProbStateHeap) Len() int

func (ProbStateHeap) Less

func (p ProbStateHeap) Less(i, j int) bool

func (*ProbStateHeap) Pop

func (p *ProbStateHeap) Pop() interface{}

func (*ProbStateHeap) Push

func (p *ProbStateHeap) Push(x interface{})

func (ProbStateHeap) Swap

func (p ProbStateHeap) Swap(i, j int)

type UF

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

并查集(union-find)算法

func NewUF

func NewUF(n int) *UF

func (*UF) Connected

func (u *UF) Connected(p, q int) bool

func (*UF) Count

func (u *UF) Count() int

func (*UF) Union

func (u *UF) Union(p, q int)

Jump to

Keyboard shortcuts

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