adjLists

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RunningID int64
)

Functions

This section is empty.

Types

type AdjLists added in v0.0.13

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

AdjLists implements an undirected graph

func NewAL

func NewAL() AdjLists

NewAL returns a new, empty adjacency list

func (*AdjLists) AddEdge added in v0.0.13

func (a *AdjLists) AddEdge(n1, n2 *vertexes.Vertexes)

AddEdge adds an edge, adding the nodes if they are not already present

func (*AdjLists) AddNode added in v0.0.13

func (a *AdjLists) AddNode(node *vertexes.Vertexes)

AddNode adds a node to the adjacency list if not already present

func (*AdjLists) Connected added in v0.0.13

func (a *AdjLists) Connected() bool

Connected returns true if every vertex is reachable from every other vertex

func (*AdjLists) Copy added in v0.0.13

func (a *AdjLists) Copy() AdjLists

Copy returns a copy of the AdjacencyList

func (*AdjLists) EdgeCount added in v0.0.13

func (a *AdjLists) EdgeCount() int

EdgeCount returns the number of distinct edges in the adjacency list

func (*AdjLists) FirstNode added in v0.0.13

func (a *AdjLists) FirstNode() *vertexes.Vertexes

FirstNode returns a node from the map

func (*AdjLists) Genus added in v0.0.13

func (a *AdjLists) Genus() int

Genus returns the genus number of the adjacency list

func (*AdjLists) HamiltonianPaths added in v0.0.13

func (a *AdjLists) HamiltonianPaths(minLength int, stopOnFirstPath bool, includeReverse bool) [][]*vertexes.Vertexes

HamiltonianPaths returns paths, the traversal of which touch each vertex once

func (*AdjLists) HasNode added in v0.0.13

func (a *AdjLists) HasNode(node vertexes.Vertexes) bool

HasNode returns true if the node is already in the adjacency list

func (*AdjLists) MinimalVertexCover added in v0.0.13

func (a *AdjLists) MinimalVertexCover() map[uint64]*vertexes.Vertexes

MinimalVertexCover returns vertices that make a minimal (not guaranteed to be minimum) vertex cover

func (*AdjLists) NodeCount added in v0.0.13

func (a *AdjLists) NodeCount() int

NodeCount returns the number of nodes in the adjacency list

func (*AdjLists) NodeWithMostEdges added in v0.0.13

func (a *AdjLists) NodeWithMostEdges() *vertexes.Vertexes

NodeWithMostEdges returns the node with the highest edge count

func (*AdjLists) Nodes added in v0.0.13

func (a *AdjLists) Nodes() map[uint64]*vertexes.Vertexes

Nodes returns the map of nodes in the adjacency list

func (*AdjLists) RemoveNode added in v0.0.13

func (a *AdjLists) RemoveNode(node vertexes.Vertexes)

RemoveNode removes a node from the adjacency list

func (*AdjLists) RemoveOrphans added in v0.0.13

func (a *AdjLists) RemoveOrphans()

RemoveOrphans removes all vertices that have no edges

func (*AdjLists) Serialize added in v0.0.13

func (a *AdjLists) Serialize(title string) string

Serialize returns the adjacency list in graphviz format

func (*AdjLists) ValueLowest added in v0.0.13

func (a *AdjLists) ValueLowest() *vertexes.Vertexes

ValueLowest returns the node with the lowest value

func (*AdjLists) ValueSum added in v0.0.13

func (a *AdjLists) ValueSum() int

ValueSum returns the sum of all node values

func (*AdjLists) Whiskers added in v0.0.13

func (a *AdjLists) Whiskers() map[uint64]*vertexes.Vertexes

Whiskers returns a map of vertices that have only one edge

Jump to

Keyboard shortcuts

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