lib

package
v0.0.0-...-ef4f11a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompleteGraph

func BuildCompleteGraph(n int) ([]Node, Runner)

func BuildCompleteGraphWithLoops

func BuildCompleteGraphWithLoops(n int, oriented bool, indexGenerator Generator) ([]Node, Synchronizer)

func BuildDirectedRing

func BuildDirectedRing(n int) ([]Node, Runner)

func BuildEmptyGraph

func BuildEmptyGraph(n int, indexGenerator Generator) ([]Node, Runner)

func BuildEmptyWeightedGraph

func BuildEmptyWeightedGraph(n int, indexGenerator Generator) ([]WeightedGraphNode, Runner)

func BuildGraphFromAdjacencyList

func BuildGraphFromAdjacencyList(adjacencyList [][]int, generator Generator) ([]Node, Runner)

func BuildHamiltonianOrientedCompleteGraph

func BuildHamiltonianOrientedCompleteGraph(n int) ([]Node, Runner)

func BuildHypercube

func BuildHypercube(dim int, oriented bool) ([]Node, Runner)

func BuildRandomConnectedWeightedGraph

func BuildRandomConnectedWeightedGraph(n, m, maxWeight int, generator Generator) ([]WeightedGraphNode, Runner)

func BuildRandomGraph

func BuildRandomGraph(n int, p float64) ([]Node, Runner)

func BuildRandomTree

func BuildRandomTree(n int) ([]Node, Runner)

func BuildRing

func BuildRing(n int) ([]Node, Runner)

func BuildSynchronizedCompleteGraph

func BuildSynchronizedCompleteGraph(n int) ([]Node, Synchronizer)

func BuildSynchronizedDirectedRing

func BuildSynchronizedDirectedRing(n int) ([]Node, Synchronizer)

func BuildSynchronizedEmptyGraph

func BuildSynchronizedEmptyGraph(n int, indexGenerator Generator) ([]Node, Synchronizer)

func BuildSynchronizedEmptyWeightedGraph

func BuildSynchronizedEmptyWeightedGraph(n int, indexGenerator Generator) ([]WeightedGraphNode, Synchronizer)

func BuildSynchronizedGraphFromAdjacencyList

func BuildSynchronizedGraphFromAdjacencyList(adjacencyList [][]int, generator Generator) ([]Node, Synchronizer)

func BuildSynchronizedHamiltonianOrientedCompleteGraph

func BuildSynchronizedHamiltonianOrientedCompleteGraph(n int) ([]Node, Synchronizer)

func BuildSynchronizedHypercube

func BuildSynchronizedHypercube(dim int, oriented bool) ([]Node, Synchronizer)

func BuildSynchronizedRandomConnectedGraphWithUniqueIndices

func BuildSynchronizedRandomConnectedGraphWithUniqueIndices(n int, m int) ([]Node, Synchronizer)

func BuildSynchronizedRandomConnectedWeightedGraph

func BuildSynchronizedRandomConnectedWeightedGraph(n, m, maxWeight int, generator Generator) ([]WeightedGraphNode, Synchronizer)

func BuildSynchronizedRandomGraph

func BuildSynchronizedRandomGraph(n int, p float64) ([]Node, Synchronizer)

func BuildSynchronizedRandomTree

func BuildSynchronizedRandomTree(n int) ([]Node, Synchronizer)

func BuildSynchronizedRing

func BuildSynchronizedRing(n int) ([]Node, Synchronizer)

func BuildSynchronizedTorus

func BuildSynchronizedTorus(n int) ([]Node, Synchronizer)

func BuildSynchronizedUndirectedMesh

func BuildSynchronizedUndirectedMesh(a int, b int) ([]Node, Synchronizer)

func BuildSynchronizedWeightedGraphFromAdjacencyList

func BuildSynchronizedWeightedGraphFromAdjacencyList(adjacencyList [][][2]int, generator Generator) ([]WeightedGraphNode, Synchronizer)

func BuildSynchronizedWeightedRandomTree

func BuildSynchronizedWeightedRandomTree(n, maxWeight int, generator Generator) ([]WeightedGraphNode, Synchronizer)

func BuildUndirectedMesh

func BuildUndirectedMesh(a int, b int) ([]Node, Runner)

func BuildWeightedGraphFromAdjacencyList

func BuildWeightedGraphFromAdjacencyList(adjacencyList [][][2]int, generator Generator) ([]WeightedGraphNode, Runner)

func BuildWeightedRandomTree

func BuildWeightedRandomTree(n, maxWeight int, generator Generator) ([]WeightedGraphNode, Runner)

Types

type AlgorithmStats

type AlgorithmStats struct {
	MessagesCount int
	RoundsCount   int
}

type Comparable

type Comparable interface {
	Less(Comparable) bool
}

type Generator

type Generator interface {
	Int() int
}

func GetGenerator

func GetGenerator() Generator

func GetRandomGenerator

func GetRandomGenerator() Generator

func GetUniquenessGenerator

func GetUniquenessGenerator(provider func(int) int) Generator

type Node

type Node interface {
	ReceiveMessage(index int) []byte
	ReceiveAnyMessage() (int, []byte)
	ReceiveMessageIfAvailable(index int) []byte
	ReceiveMessageWithTimeout(index int, timeout time.Duration) []byte
	SendMessage(index int, message []byte)
	GetInChannelsCount() int
	GetOutChannelsCount() int
	GetInNeighbors() []Node
	GetOutNeighbors() []Node
	GetIndex() int
	GetState() []byte
	SetState(state []byte)
	GetSize() int
	StartProcessing()
	FinishProcessing(finish bool)
	IgnoreFutureMessages()
	Close() // only for use by Runner
}

type PriorityQueue

type PriorityQueue []Comparable

func (PriorityQueue) Empty

func (pq PriorityQueue) Empty() bool

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type Runner

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

func (*Runner) GetStats

func (r *Runner) GetStats() (int, int)

func (*Runner) Run

func (r *Runner) Run(close bool)

type Synchronizer

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

func (*Synchronizer) GetStats

func (s *Synchronizer) GetStats() (int, int)

func (*Synchronizer) Synchronize

func (s *Synchronizer) Synchronize(interval time.Duration)

type WeightedGraphNode

type WeightedGraphNode interface {
	Node
	GetInWeights() []int
	GetOutWeights() []int
}

Jump to

Keyboard shortcuts

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