graphs

package
v0.0.0-...-e07d34e Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package graphs implements utility functions on Nuggit Graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func (*Builder) Build

func (b *Builder) Build() *nuggit.Graph

func (*Builder) Node

func (b *Builder) Node(nodeType nuggit.OpKey, opts ...BuilderOption) string

func (*Builder) Reset

func (b *Builder) Reset()

func (*Builder) Stage

func (b *Builder) Stage(stage nuggit.StageKey)

type BuilderOption

type BuilderOption func(b *builderOptions)

func Data

func Data(data any) BuilderOption

func Edge

func Edge(dst nuggit.Key, opts ...EdgeOption) BuilderOption

func Key

func Key(k nuggit.Key) BuilderOption

func Stage

func Stage(s nuggit.StageKey) BuilderOption

type EdgeOption

type EdgeOption func(*edgeOptions)

func DstField

func DstField(k nuggit.FieldKey) EdgeOption

func EdgeKey

func EdgeKey(key string) EdgeOption

func SrcField

func SrcField(k nuggit.FieldKey) EdgeOption

type Graph

type Graph struct {
	Stage     nuggit.StageKey
	Adjacency map[nuggit.NodeKey]nuggit.Adjacency
	Edges     map[nuggit.EdgeKey]nuggit.Edge
	Nodes     map[nuggit.NodeKey]nuggit.Node
}

Graph implements a Graph structure that supports efficient for Graph Key lookup.

See nuggit.Graph.

func FromFile

func FromFile(filename string) (*Graph, error)

FromFile loads a Graph from a JSON file. The file may be either a JSON encoded Resource or Graph. Checksum integrity checks are ignored.

func FromGraph

func FromGraph(g *nuggit.Graph) *Graph

FromGraph loads a Graph from a Nuggit Graph spec.

func (*Graph) Clone

func (g *Graph) Clone() *Graph

func (*Graph) Delete

func (g *Graph) Delete(k nuggit.NodeKey) []nuggit.Edge

Delete removes the node from the graph and all edges. It returns the pruned edges.

func (*Graph) Graph

func (g *Graph) Graph() *nuggit.Graph

func (*Graph) Sort

func (g *Graph) Sort(keys []nuggit.NodeKey) error

Sort nodes using a topological sort.

func (*Graph) Var

func (g *Graph) Var(name string) vars.Var

type GraphVar

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

func (GraphVar) Get

func (v GraphVar) Get() (any, error)

func (GraphVar) Set

func (v GraphVar) Set(x any) error

func (GraphVar) SetDefault

func (v GraphVar) SetDefault(x any) error

Jump to

Keyboard shortcuts

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