graph

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveGraphToJSON added in v0.0.6

func SaveGraphToJSON[Node comparable, Edge any](
	graph AbstractGraph[Node, Edge],
	filename string,
) error

func ToDotDirected added in v0.0.6

func ToDotDirected[Node comparable, Edge any](g Graph[Node, Edge]) (string, error)

func ToDotUndirected added in v0.0.6

func ToDotUndirected[Node comparable, Edge any](g Graph[Node, Edge]) (string, error)

Types

type AbstractGraph added in v0.0.6

type AbstractGraph[Node comparable, Edge any] map[Node]map[Node]Edge

func FromDGDot added in v0.0.6

func FromDGDot[Node comparable, Edge any](path string, convert func(string) Node) (AbstractGraph[Node, Edge], error)

func FromDot

func FromDot[Node comparable, Edge any](path, edgeString string, convert func(string) Node) (AbstractGraph[Node, Edge], error)

func FromUDGDot added in v0.0.6

func FromUDGDot[Node comparable, Edge any](path string, convert func(string) Node) (AbstractGraph[Node, Edge], error)

func LoadGraphFromJSON added in v0.0.6

func LoadGraphFromJSON[Node comparable, Edge any](
	filename string,
) (AbstractGraph[Node, Edge], error)

func NewAbstractGraph added in v0.0.6

func NewAbstractGraph[Node comparable, Edge any]() AbstractGraph[Node, Edge]

func (AbstractGraph[Node, Edge]) AddBothEdges added in v0.0.6

func (g AbstractGraph[Node, Edge]) AddBothEdges(a, b Node, edge Edge)

func (AbstractGraph[Node, Edge]) AddEdge added in v0.0.6

func (g AbstractGraph[Node, Edge]) AddEdge(a, b Node, edge Edge)

func (AbstractGraph[Node, Edge]) AllNodes added in v0.0.6

func (g AbstractGraph[Node, Edge]) AllNodes() []Node

func (AbstractGraph[Node, Edge]) EdgesNeighbors added in v0.0.6

func (g AbstractGraph[Node, Edge]) EdgesNeighbors(a Node) ([]Edge, []Node)

type DGraph added in v0.0.6

type DGraph[Node comparable, Edge any] AbstractGraph[Node, Edge]

func NewDGraph added in v0.0.6

func NewDGraph[Node comparable, Edge any]() DGraph[Node, Edge]

func (DGraph[Node, Edge]) AddBothEdges added in v0.0.6

func (g DGraph[Node, Edge]) AddBothEdges(a, b Node, edge Edge)

func (DGraph[Node, Edge]) AddEdge added in v0.0.6

func (g DGraph[Node, Edge]) AddEdge(a, b Node, edge Edge)

func (DGraph[Node, Edge]) AllNodes added in v0.0.6

func (g DGraph[Node, Edge]) AllNodes() []Node

func (DGraph[Node, Edge]) EdgesNeighbors added in v0.0.6

func (g DGraph[Node, Edge]) EdgesNeighbors(a Node) ([]Edge, []Node)

type Graph

type Graph[Node comparable, Edge any] interface {
	AddEdge(a, b Node, e Edge)
	AddBothEdges(a, b Node, e Edge)
	AllNodes() []Node
	EdgesNeighbors(a Node) ([]Edge, []Node)
}

type Keyer added in v0.0.6

type Keyer interface {
	Key() string
}

type MultiDag added in v0.0.6

type MultiDag[Node, Edge Keyer] struct {
	Nodes     []Node
	NodeMap   map[string]int
	Edges     []Edge
	EdgeMap   map[string]int
	EdgeNodes map[int]map[int]int
}

func (*MultiDag[Node, Edge]) AddBothEdges added in v0.0.6

func (g *MultiDag[Node, Edge]) AddBothEdges(a, b Node, e Edge)

func (*MultiDag[Node, Edge]) AddEdge added in v0.0.6

func (g *MultiDag[Node, Edge]) AddEdge(a, b Node, e Edge)

func (MultiDag[Node, Edge]) AllNodes added in v0.0.6

func (g MultiDag[Node, Edge]) AllNodes() []Node

func (MultiDag[Node, Edge]) EdgesNeighbors added in v0.0.6

func (g MultiDag[Node, Edge]) EdgesNeighbors(a Node) ([]Edge, []Node)

type UDGraph added in v0.0.6

type UDGraph[Node comparable, Edge any] AbstractGraph[Node, Edge]

func NewUDGraph added in v0.0.6

func NewUDGraph[Node comparable, Edge any]() UDGraph[Node, Edge]

func (UDGraph[Node, Edge]) AddBothEdges added in v0.0.6

func (g UDGraph[Node, Edge]) AddBothEdges(a, b Node, edge Edge)

func (UDGraph[Node, Edge]) AddEdge added in v0.0.6

func (g UDGraph[Node, Edge]) AddEdge(a, b Node, edge Edge)

func (UDGraph[Node, Edge]) AllNodes added in v0.0.6

func (g UDGraph[Node, Edge]) AllNodes() []Node

func (UDGraph[Node, Edge]) EdgesNeighbors added in v0.0.6

func (g UDGraph[Node, Edge]) EdgesNeighbors(a Node) ([]Edge, []Node)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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