graph

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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