adjLists

package
v0.0.12 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 AdjList

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

AdjList implements an undirected graph

func NewAL

func NewAL() AdjList

NewAL returns a new, empty adjacency list

func (*AdjList) AddEdge

func (a *AdjList) AddEdge(n1, n2 *vertexes.Vertex)

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

func (*AdjList) AddNode

func (a *AdjList) AddNode(node *vertexes.Vertex)

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

func (*AdjList) Connected

func (a *AdjList) Connected() bool

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

func (*AdjList) Copy

func (a *AdjList) Copy() AdjList

Copy returns a copy of the AdjacencyList

func (*AdjList) EdgeCount

func (a *AdjList) EdgeCount() int

EdgeCount returns the number of distinct edges in the adjacency list

func (*AdjList) FirstNode

func (a *AdjList) FirstNode() *vertexes.Vertex

FirstNode returns a node from the map

func (*AdjList) Genus

func (a *AdjList) Genus() int

Genus returns the genus number of the adjacency list

func (*AdjList) HamiltonianPaths

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

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

func (*AdjList) HasNode

func (a *AdjList) HasNode(node vertexes.Vertex) bool

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

func (*AdjList) MinimalVertexCover

func (a *AdjList) MinimalVertexCover() map[uint64]*vertexes.Vertex

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

func (*AdjList) NodeCount

func (a *AdjList) NodeCount() int

NodeCount returns the number of nodes in the adjacency list

func (*AdjList) NodeWithMostEdges

func (a *AdjList) NodeWithMostEdges() *vertexes.Vertex

NodeWithMostEdges returns the node with the highest edge count

func (*AdjList) Nodes

func (a *AdjList) Nodes() map[uint64]*vertexes.Vertex

Nodes returns the map of nodes in the adjacency list

func (*AdjList) RemoveNode

func (a *AdjList) RemoveNode(node vertexes.Vertex)

RemoveNode removes a node from the adjacency list

func (*AdjList) RemoveOrphans

func (a *AdjList) RemoveOrphans()

RemoveOrphans removes all vertices that have no edges

func (*AdjList) Serialize

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

Serialize returns the adjacency list in graphviz format

func (*AdjList) ValueLowest

func (a *AdjList) ValueLowest() *vertexes.Vertex

ValueLowest returns the node with the lowest value

func (*AdjList) ValueSum

func (a *AdjList) ValueSum() int

ValueSum returns the sum of all node values

func (*AdjList) Whiskers

func (a *AdjList) Whiskers() map[uint64]*vertexes.Vertex

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