graph

package
v0.0.0-...-cbcbf1e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: GPL-2.0 Imports: 8 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 interface {
	ID() string
	Points() [2]Point
	Weight() float64
}

Edge is a bi-directional link, which has a weight, among two points.

type Graph

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

func New

func New() *Graph

func (*Graph) AddEdge

func (r *Graph) AddEdge(e Edge) (added bool, err error)

func (*Graph) AddVertex

func (r *Graph) AddVertex(v Vertex)

func (*Graph) FindPath

func (r *Graph) FindPath(src, dst Vertex) []Path

func (*Graph) IsEdge

func (r *Graph) IsEdge(p Point) bool

IsEdge returns whether p is on an edge between two vertexeis.

func (*Graph) IsEnabledPoint

func (r *Graph) IsEnabledPoint(p Point) bool

IsEnabledPoint returns whether p is an active point that is not disabled by the minimum spanning tree.

func (*Graph) RemoveEdge

func (r *Graph) RemoveEdge(p Point)

func (*Graph) RemoveStaleEdges

func (r *Graph) RemoveStaleEdges(expiration time.Duration) (removed bool)

func (*Graph) RemoveVertex

func (r *Graph) RemoveVertex(v Vertex)

func (*Graph) String

func (r *Graph) String() string

type Path

type Path struct {
	V Vertex
	E Edge
}

type Point

type Point interface {
	ID() string
	Vertex() Vertex
}

Point is a spot (e.g., switch port) on a vertex. We need this to represent multiple links among two vertexies.

type Vertex

type Vertex interface {
	ID() string
}

Vertex is a node (e.g., switch) that consists of at least one or more points.

Jump to

Keyboard shortcuts

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