graph

package
v0.2.5-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNotFoundVertex = errors.New("Not found vertex")

Functions

This section is empty.

Types

type EdgeInfo

type EdgeInfo[Label comparable] struct {
	VertexFrom Label
	VertexTo   Label
}

type Graph

type Graph[T any, Label comparable] struct {
	// contains filtered or unexported fields
}

func NewGraph

func NewGraph[T any, Label comparable](vertexes []VertexInfo[T, Label]) *Graph[T, Label]

func (*Graph[T, Label]) AddOrientedEdge

func (graph *Graph[T, Label]) AddOrientedEdge(vertexFrom, vertexTo Label) error

func (*Graph[T, Label]) AddOrientedEdges

func (graph *Graph[T, Label]) AddOrientedEdges(edges ...EdgeInfo[Label]) (err error)

func (*Graph[T, Label]) AddUndirectedEdge

func (graph *Graph[T, Label]) AddUndirectedEdge(vertexFirst, vertexSecond Label) error

func (*Graph[T, Label]) AddUndirectedEdges

func (graph *Graph[T, Label]) AddUndirectedEdges(edges ...EdgeInfo[Label]) (err error)

func (*Graph[T, Label]) AddVertex

func (graph *Graph[T, Label]) AddVertex(label Label, value T)

func (*Graph[T, Label]) BFS

func (graph *Graph[T, Label]) BFS(startVertex Label, visitor Visitor[T])

func (*Graph[T, Label]) DFS

func (graph *Graph[T, Label]) DFS(startVertex Label, visitor Visitor[T])

func (*Graph[T, Label]) DeleteOrientedEdge

func (graph *Graph[T, Label]) DeleteOrientedEdge(vertexFrom, vertexTo Label) error

func (*Graph[T, Label]) DeleteUndirectedEdge

func (graph *Graph[T, Label]) DeleteUndirectedEdge(vertexFirst, vertexSecond Label) error

func (*Graph[T, Label]) DeleteVertex

func (graph *Graph[T, Label]) DeleteVertex(label Label)

func (*Graph[T, Label]) SetVertexes

func (graph *Graph[T, Label]) SetVertexes(vertexes []VertexInfo[T, Label])

type Node

type Node[T any, Label comparable] struct {
	ValueNode[T]
	// contains filtered or unexported fields
}

type ValueNode

type ValueNode[T any] struct {
	Value T
}

type VertexInfo

type VertexInfo[T any, Label comparable] struct {
	Label Label
	Value T
}

type Visitor

type Visitor[T any] func(value *ValueNode[T]) (stop bool)

Jump to

Keyboard shortcuts

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