graph

package
v0.0.0-...-7db62b2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

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

Edge represents a connection between two nodes. https://godoc.org/gonum.org/v1/gonum/graph#Edge

func (*Edge) From

func (e *Edge) From() graph.Node

From satisfies graph.Edge.

func (*Edge) ReversedEdge

func (e *Edge) ReversedEdge() graph.Edge

ReversedEdge satisfies graph.Edge.

func (*Edge) To

func (e *Edge) To() graph.Node

To satisfies graph.Edge.

type Graph

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

Graph represents a generic graph structure.

func New

func New() *Graph

New initializes a new Graph.

func (*Graph) Edge

func (g *Graph) Edge(uid, vid int64) graph.Edge

Edge satisfies graph.Graph.

func (*Graph) From

func (g *Graph) From(id int64) graph.Nodes

From satisfies graph.Graph.

func (*Graph) GetNode

func (g *Graph) GetNode(label string) *Node

GetNode returns the node with label = label, or creates a new one with label and returns it.

func (*Graph) HasEdgeBetween

func (g *Graph) HasEdgeBetween(xid, yid int64) bool

HasEdgeBetween satisfies graph.Graph.

func (*Graph) HasEdgeFromTo

func (g *Graph) HasEdgeFromTo(uid, vid int64) bool

HasEdgeFromTo satisfies graph.Directed.

func (*Graph) Node

func (g *Graph) Node(id int64) graph.Node

Node satisfies graph.Graph.

func (*Graph) Nodes

func (g *Graph) Nodes() graph.Nodes

Nodes satisfies graph.Graph.

func (*Graph) To

func (g *Graph) To(id int64) graph.Nodes

To satisfies graph.Directed.

type Node

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

Node represents a node in the graph. https://godoc.org/gonum.org/v1/gonum/graph#Node

func (*Node) AddFrom

func (n *Node) AddFrom(node *Node)

AddFrom adds an outgoing edge.

func (*Node) AddTo

func (n *Node) AddTo(node *Node)

AddTo adds an incoming edge.

func (*Node) GetValue

func (n *Node) GetValue() any

GetValue returns the value associated with the node.

func (*Node) ID

func (n *Node) ID() int64

ID satisfies graph.Node.

func (*Node) LenFrom

func (n *Node) LenFrom() int

LenFrom return the len of from slice.

func (*Node) LenTo

func (n *Node) LenTo() int

LenTo return the len of to slice.

func (*Node) Name

func (n *Node) Name() string

Name returns the node name.

func (*Node) SetValue

func (n *Node) SetValue(v any)

SetValue returns the element associated with the node.

type Nodes

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

Nodes represents a collection of Node elements. https://godoc.org/gonum.org/v1/gonum/graph#Nodes

func (*Nodes) Len

func (n *Nodes) Len() int

Len satisfies graph.Iterator.

func (*Nodes) Next

func (n *Nodes) Next() bool

Next satisfies graph.Iterator.

func (*Nodes) Node

func (n *Nodes) Node() graph.Node

Node satisfies graph.Nodes.

func (*Nodes) Reset

func (n *Nodes) Reset()

Reset satisfies graph.Iterator.

Jump to

Keyboard shortcuts

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