graph

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEdge

func AddEdge(g DirectedGraph, from Node, to Node)

func AddEdges

func AddEdges(g DirectedGraph, edges [][2]Node)

func AddEdgesWithAttrs

func AddEdgesWithAttrs(g DirectedGraph, edges EdgesWithAttrs)

func AddNodes

func AddNodes(g DirectedGraph, nodes ...Node)

func AddNodesWithAttrs

func AddNodesWithAttrs(g DirectedGraph, nodes NodesWithAttrs)

func HasEdge

func HasEdge(g DirectedGraphView, from Node, to Node) bool

func HasNode

func HasNode(g DirectedGraphView, node Node) bool

func RemoveEdges

func RemoveEdges(g DirectedGraph, edges [][2]Node)

func RemoveNodes

func RemoveNodes(g DirectedGraph, nodes ...Node)

Types

type Attrs

type Attrs map[interface{}]interface{}

func AttrsFrom

func AttrsFrom(view AttrsView) Attrs

func (Attrs) Del

func (a Attrs) Del(key interface{})

func (Attrs) Get

func (a Attrs) Get(key interface{}) (interface{}, bool)

func (Attrs) Has

func (a Attrs) Has(key interface{}) bool

func (Attrs) Iterate

func (a Attrs) Iterate(f func(key interface{}, value interface{}) bool) bool

func (Attrs) Len

func (a Attrs) Len() int

func (Attrs) Set

func (a Attrs) Set(key interface{}, value interface{})

type AttrsView

type AttrsView interface {
	Get(key interface{}) (interface{}, bool)
	Set(key interface{}, value interface{})
	Del(key interface{})
	Has(key interface{}) bool
	Iterate(func(key interface{}, value interface{}) bool) bool
}

type DirectedGraph

type DirectedGraph interface {
	DirectedGraphView
	AddNodeWithAttrs(node Node, attrs AttrsView)
	RemoveNode(node Node)

	AddEdgeWithAttrs(from Node, to Node, attrs AttrsView)
	RemoveEdge(from Node, to Node)
}

func DeriveDirectedGraph

func DeriveDirectedGraph(parent DirectedGraphView) DirectedGraph

func NewDirectedGraph

func NewDirectedGraph() DirectedGraph

func NewDirectedGraphFrom

func NewDirectedGraphFrom(source DirectedGraphView) DirectedGraph

func NewDirectedGraphWithInNodes

func NewDirectedGraphWithInNodes(source DirectedGraphView, nodes []Node) DirectedGraph

type DirectedGraphView

type DirectedGraphView interface {
	NodeAttrs(node Node) (AttrsView, bool)
	Nodes() NodeAndAttrsIterator

	EdgeAttrs(from, to Node) (AttrsView, bool)
	Edges() EdgeAndAttrsIterator

	OutEdgesOf(node Node) EdgeAndAttrsIterator
	InEdgesOf(node Node) EdgeAndAttrsIterator
}

func SubGraphOf

func SubGraphOf(source DirectedGraphView, predicate func(Node) bool) DirectedGraphView

func SubGraphWithNodes

func SubGraphWithNodes(source DirectedGraphView, nodes []Node) DirectedGraphView

type EdgeAndAttrsIterator

type EdgeAndAttrsIterator interface {
	Iterate(func(from Node, to Node, attrs AttrsView) bool) bool
}

type EdgeEntry

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

type EdgesWithAttrs

type EdgesWithAttrs map[Node]map[Node]Attrs

func EdgesWithAttrsFrom

func EdgesWithAttrsFrom(ei EdgeAndAttrsIterator) EdgesWithAttrs

func (EdgesWithAttrs) Iterate

func (ei EdgesWithAttrs) Iterate(f func(from Node, to Node, attrs AttrsView) bool) bool

type Node

type Node interface{}

type NodeAndAttrsIterator

type NodeAndAttrsIterator interface {
	Iterate(func(node Node, attrs AttrsView) bool) bool
}

func GetNodesInDirectionMatch

func GetNodesInDirectionMatch(node Node, directionFunc func(Node) NodeAndAttrsIterator,
	predicate func(Node, AttrsView) bool) NodeAndAttrsIterator

func PredecessorsOf

func PredecessorsOf(g DirectedGraphView, node Node) NodeAndAttrsIterator

func SuccessorsOf

func SuccessorsOf(g DirectedGraphView, node Node) NodeAndAttrsIterator

type NodeEntry

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

func (*NodeEntry) Iterate

func (ne *NodeEntry) Iterate(f func(node Node, attrs AttrsView) bool) bool

type NodeIterator

type NodeIterator interface {
	Iterate(func(Node) bool) bool
}

type NodeSet

type NodeSet map[Node]struct{}

func (NodeSet) Add

func (s NodeSet) Add(node Node)

func (NodeSet) Del

func (s NodeSet) Del(node Node)

func (NodeSet) Has

func (s NodeSet) Has(node Node) bool

type NodesWithAttrs

type NodesWithAttrs map[Node]Attrs

func NodesWithAttrsFrom

func NodesWithAttrsFrom(ni NodeAndAttrsIterator) NodesWithAttrs

func (NodesWithAttrs) Iterate

func (na NodesWithAttrs) Iterate(f func(node Node, attrs AttrsView) bool) bool

Jump to

Keyboard shortcuts

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