graph

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

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

func NewGraph

func NewGraph[T comparable]() *Graph[T]

func (*Graph[T]) AddEdge

func (g *Graph[T]) AddEdge(from, to string) error

func (*Graph[T]) AddNode added in v0.9.1

func (g *Graph[T]) AddNode(id string, data T) error

AddNode adds a node to the graph with the given ID and data. Returns an error if a node with the same ID already exists.

func (*Graph[T]) AddNodes added in v0.9.1

func (g *Graph[T]) AddNodes(nodes map[string]T) error

AddNodes adds multiple nodes to the graph. Returns an error if any node with the same ID already exists.

func (*Graph[T]) EdgeCount added in v0.9.1

func (g *Graph[T]) EdgeCount() int

func (*Graph[T]) GetChildren added in v0.9.1

func (g *Graph[T]) GetChildren(id string) []string

func (*Graph[T]) GetNode added in v0.9.1

func (g *Graph[T]) GetNode(id string) (T, bool)

func (*Graph[T]) GetNodes added in v0.9.1

func (g *Graph[T]) GetNodes() map[string]T

func (*Graph[T]) GetParents added in v0.9.1

func (g *Graph[T]) GetParents(id string) []string

func (*Graph[T]) HasCircularDependency added in v0.9.1

func (g *Graph[T]) HasCircularDependency() bool

func (*Graph[T]) HasEdge added in v0.9.1

func (g *Graph[T]) HasEdge(from, to string) bool

func (*Graph[T]) HasNode added in v0.9.1

func (g *Graph[T]) HasNode(id string) bool

func (*Graph[T]) IsEmpty added in v0.9.1

func (g *Graph[T]) IsEmpty() bool

func (*Graph[T]) NodeCount added in v0.9.1

func (g *Graph[T]) NodeCount() int

func (*Graph[T]) RemoveChildren added in v0.9.1

func (g *Graph[T]) RemoveChildren(id string) error

func (*Graph[T]) RemoveEdge added in v0.9.1

func (g *Graph[T]) RemoveEdge(from, to string) error

func (*Graph[T]) RemoveNode

func (g *Graph[T]) RemoveNode(id string) error

func (*Graph[T]) RemoveSubGraph

func (g *Graph[T]) RemoveSubGraph(id string) error

func (*Graph[T]) SetNode added in v0.9.1

func (g *Graph[T]) SetNode(id string, data T) error

func (*Graph[T]) Sort added in v0.9.1

func (g *Graph[T]) Sort() ([]T, error)

func (*Graph[T]) SortNodeIDs added in v0.9.1

func (g *Graph[T]) SortNodeIDs() ([]string, error)

func (*Graph[T]) String added in v0.9.1

func (g *Graph[T]) String() string

func (*Graph[T]) UpdateNode added in v0.9.1

func (g *Graph[T]) UpdateNode(id string, data T) error

Jump to

Keyboard shortcuts

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