adjMatrixes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjMatrix

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

func Matrix

func Matrix() *AdjMatrix

func (*AdjMatrix) AddNode

func (m *AdjMatrix) AddNode(id uint64, node *vertexes.Vertexes)

AddNode adds the given node to the matrix (be sure to call ComputeDistances after)

func (*AdjMatrix) ComputeDistances

func (m *AdjMatrix) ComputeDistances()

ComputeDistances sets the matrix distance values for each vertex pair

func (*AdjMatrix) Diameter

func (m *AdjMatrix) Diameter() int

Diameter returns the length of the path between the two most distance vertexes

func (*AdjMatrix) GetValue

func (m *AdjMatrix) GetValue(r, c int) int

GetValue returns the value at that row/col

func (*AdjMatrix) IndexFromID

func (m *AdjMatrix) IndexFromID(id uint64) int

IndexFromID returns the index of the vertex ID or -1 if not found

func (*AdjMatrix) NodeCount

func (m *AdjMatrix) NodeCount() int

NodeCount returns the number of vertexes in the matrix

func (*AdjMatrix) NodeFromIndex

func (m *AdjMatrix) NodeFromIndex(i int) *vertexes.Vertexes

NodeFromIndex returns the node for the given index or nil if not found

func (*AdjMatrix) Serialize

func (m *AdjMatrix) Serialize() string

Serialize returns a string representation of the matrix

func (*AdjMatrix) SetValue

func (m *AdjMatrix) SetValue(r, c, value int)

SetValue returns the value at that row/col

Jump to

Keyboard shortcuts

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