graph

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 1 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 struct {
	// contains filtered or unexported fields
}

Graph represents a directed graph structure

func NewGraph

func NewGraph() *Graph

NewGraph creates a new empty graph

func (*Graph) AddNode

func (g *Graph) AddNode(node Node)

AddNode adds a node to the graph

func (*Graph) ComputeProcessingOrder

func (g *Graph) ComputeProcessingOrder() ([]Node, error)

ComputeProcessingOrder returns nodes in topological order

func (*Graph) ComputeTransitiveDependencies

func (g *Graph) ComputeTransitiveDependencies()

ComputeTransitiveDependencies removes redundant edges from the graph

func (*Graph) GetNode

func (g *Graph) GetNode(name string) (Node, bool)

GetNode retrieves a node by name

func (*Graph) GetNodes

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

GetNodes returns all nodes in the graph

func (*Graph) PrintGraph

func (g *Graph) PrintGraph()

PrintGraph prints a human-readable representation of the graph structure

type Node

type Node interface {
	GetName() string
	GetParents() []Node
	GetChildren() []Node
	SetParents([]Node)
	SetChildren([]Node)
}

Node represents a node in a directed graph

Jump to

Keyboard shortcuts

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