dag

package
v0.0.0-...-c9351ca Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectTypeAssertion = fmt.Errorf("incorrect type assertion")

Functions

This section is empty.

Types

type Dag

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

func New

func New() *Dag

New - creates a new Directed Acyclic Graph

func (*Dag) AddEdge

func (d *Dag) AddEdge(from, to string) error

func (*Dag) AddVertex

func (d *Dag) AddVertex(id string, value any) (*Vertex, error)

AddVertex adds a vertex to the graph

func (*Dag) GetVertex

func (d *Dag) GetVertex(id string) (*Vertex, error)

type Vertex

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

Vertex type implements a vertex of a Directed Acyclic graph or DAG.

func (*Vertex) Children

func (v *Vertex) Children() []*Vertex

func (*Vertex) GetId

func (v *Vertex) GetId() string

func (*Vertex) Parents

func (v *Vertex) Parents() []*Vertex

type VertexAlreadyExistsError

type VertexAlreadyExistsError struct {
	Id string
}

func (*VertexAlreadyExistsError) Error

func (e *VertexAlreadyExistsError) Error() string

type VertexNotFoundError

type VertexNotFoundError struct {
	Id string
}

func (*VertexNotFoundError) Error

func (e *VertexNotFoundError) Error() string

Jump to

Keyboard shortcuts

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