graphstore

package
v0.0.0-...-d724b4b Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	// ID of the node.
	ID string `json:"id"`
	// Parent node.
	Parent *string `json:"parent"`
	// Child nodes.
	Children []string `json:"children"`
}

Node within a graph.

func NewNode

func NewNode(id string, parent *string) Node

NewNode creates a new Node.

type Store

type Store struct {
	Nodes map[string]*Node
}

Store of a graph.

func NewStore

func NewStore() *Store

NewStore creates a new store.

func (*Store) Add

func (s *Store) Add(n Node)

Add a node.

func (*Store) AddEdge

func (s *Store) AddEdge(parent, child string) (err error)

AddEdge between parent and child.

func (*Store) Get

func (s *Store) Get(id string) (n *Node)

Get a node.

func (*Store) Roots

func (s *Store) Roots() []string

Roots of the graph.

Jump to

Keyboard shortcuts

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