Documentation
¶
Index ¶
- type Graph
- func (g *Graph[T]) AddEdge(from, to string) error
- func (g *Graph[T]) AddNode(id string, data T) error
- func (g *Graph[T]) AddNodes(nodes map[string]T) error
- func (g *Graph[T]) EdgeCount() int
- func (g *Graph[T]) GetChildren(id string) []string
- func (g *Graph[T]) GetNode(id string) (T, bool)
- func (g *Graph[T]) GetNodes() map[string]T
- func (g *Graph[T]) GetParents(id string) []string
- func (g *Graph[T]) HasCircularDependency() bool
- func (g *Graph[T]) HasEdge(from, to string) bool
- func (g *Graph[T]) HasNode(id string) bool
- func (g *Graph[T]) IsEmpty() bool
- func (g *Graph[T]) NodeCount() int
- func (g *Graph[T]) RemoveChildren(id string) error
- func (g *Graph[T]) RemoveEdge(from, to string) error
- func (g *Graph[T]) RemoveNode(id string) error
- func (g *Graph[T]) RemoveSubGraph(id string) error
- func (g *Graph[T]) SetNode(id string, data T) error
- func (g *Graph[T]) Sort() ([]T, error)
- func (g *Graph[T]) SortNodeIDs() ([]string, error)
- func (g *Graph[T]) String() string
- func (g *Graph[T]) UpdateNode(id string, data T) error
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]) AddNode ¶ added in v0.9.1
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
AddNodes adds multiple nodes to the graph. Returns an error if any node with the same ID already exists.
func (*Graph[T]) GetChildren ¶ added in v0.9.1
func (*Graph[T]) GetParents ¶ added in v0.9.1
func (*Graph[T]) HasCircularDependency ¶ added in v0.9.1
func (*Graph[T]) RemoveChildren ¶ added in v0.9.1
func (*Graph[T]) RemoveEdge ¶ added in v0.9.1
func (*Graph[T]) RemoveNode ¶
func (*Graph[T]) RemoveSubGraph ¶
func (*Graph[T]) SortNodeIDs ¶ added in v0.9.1
func (*Graph[T]) UpdateNode ¶ added in v0.9.1
Click to show internal directories.
Click to hide internal directories.