Versions in this module Expand all Collapse all v0 v0.2.1 Feb 9, 2024 Changes in this version + const ThreadSafe + const ThreadUnsafe + var ErrDestNodeNotExist = errors.New("destination node does not exist") + var ErrFullGraph32 = errors.New("Graph32 is full") + var ErrFullMap32 = errors.New("Map32 is full") + var ErrInvalidOrOutOfBoundsNodeId = errors.New("invalid or out of bound node id") + var ErrNodeNotFound = errors.New("node not found") + var ErrNodeSameStringDataAlreadyInGraph = errors.New("a node with the same data is already in the graph") + var ErrOutOfBoundsBit32Index = errors.New("out of bounds Bit32Index") + var ErrSelfEdgeNotSupportedYet = errors.New("self edge not supported yet") + var ErrSrcNodeNotExist = errors.New("source node does not exist") + var ErrUnsupportedSingleNodeRetrieval = errors.New("unsupported single node retrieval") + type ArrayQueue struct + func NewArrayQueue[T any]() *ArrayQueue[T] + func (q *ArrayQueue[T]) Clear() + func (q *ArrayQueue[T]) Dequeue() (value T, ok bool) + func (q *ArrayQueue[T]) Empty() bool + func (q *ArrayQueue[T]) Enqueue(value T) + func (q *ArrayQueue[T]) ForEachElem(fn func(i int, e T) error) error + func (q *ArrayQueue[T]) Iterator() *ArrayQueueIterator[T] + func (q *ArrayQueue[T]) Peek() (value T, ok bool) + func (q *ArrayQueue[T]) Size() int + func (q *ArrayQueue[T]) Values() []T + type ArrayQueueIterator struct + func (it *ArrayQueueIterator[T]) Index() int + func (it *ArrayQueueIterator[T]) Next() bool + func (it *ArrayQueueIterator[T]) Value() T + type Bit32Index uint8 + type BitSet32 uint32 + func (s *BitSet32) CountSet() int + func (s *BitSet32) ForEachSet(fn func(index Bit32Index) error) error + func (s *BitSet32) IsSet(index Bit32Index) bool + func (s *BitSet32) Set(index Bit32Index) + func (s *BitSet32) SetAll() + func (s *BitSet32) Unset(index Bit32Index) + type DirectedGraph struct + func NewDirectedGraphUniqueString[NodeData ~string, EdgeData any](threadSafety ThreadSafety) *DirectedGraph[NodeData, EdgeData, map[NodeData]NodeId] + func NewDirectedGraph[NodeData, EdgeData any](threadSafety ThreadSafety) *DirectedGraph[NodeData, EdgeData, struct{}] + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) AddNode(data NodeData) NodeId + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) CountSourceNodes(id NodeId) int + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) DestinationIds(id NodeId) []NodeId + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) DestinationNodes(id NodeId) []GraphNode[NodeData] + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) Edge(srcId, destId NodeId) (GraphEdge[EdgeData], bool) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) EdgeCount() int64 + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) Edges() []GraphEdge[EdgeData] + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) GetNode(retrievalType SingleNodeRetrievalType, data any) (node GraphNode[NodeData], finalErr error) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) HasCycleOrCircuit() bool + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) HasEdgeBetween(xid, yid NodeId) bool + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) HasEdgeFromTo(srcId, destId NodeId) bool + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) HasNode(retrievalType SingleNodeRetrievalType, data any) (found bool, finalErr error) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) LongestPath() (nodesInPath []NodeId, pathLength int) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) LongestPathLen() int + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) Node(id NodeId) (GraphNode[NodeData], bool) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) NodeCount() int + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) NodeData(id NodeId) (_ NodeData, _ bool) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) NodeIds() []NodeId + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) NodeWithID(id NodeId) (n GraphNode[NodeData], found bool) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) RandomNode() (NodeId, bool) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) RemoveEdge(srcId, destId NodeId) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) RemoveNode(id NodeId) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) SetEdge(from, to NodeId, data EdgeData) + func (g *DirectedGraph[NodeData, EdgeData, InternalData]) SourceNodes(id NodeId) []GraphNode[NodeData] + type Graph32 struct + func (g *Graph32[T]) AddEdge(fromNodeId, toNodeId NodeId) + func (g *Graph32[T]) AddNode(data T) Graph32Node[T] + func (g *Graph32[T]) Capacity() int + func (g *Graph32[T]) Size() int + func (g Graph32[T]) HasEdgeFromTo(fromNodeId, toNodeId NodeId) bool + func (g Graph32[T]) HasNodeOfId(id NodeId) bool + func (g Graph32[T]) IdOfNode(v T) (NodeId, bool) + func (g Graph32[T]) IteratorDirectlyReachableNodes(fromNodeId NodeId) Graph32Iterator[T] + func (g Graph32[T]) IteratorFrom(fromNodeId NodeId) Graph32Iterator[T] + func (g Graph32[T]) MustGetIdOfNode(v T) NodeId + func (g Graph32[T]) NodeOfId(id NodeId) (node Graph32Node[T], found bool) + type Graph32Iterator struct + func (it *Graph32Iterator[T]) Next() bool + func (it *Graph32Iterator[T]) Node() Graph32Node[T] + type Graph32Node struct + func (n Graph32Node[T]) Id() NodeId + type GraphEdge struct + Data EdgeData + From NodeId + To NodeId + type GraphNode struct + Data T + Id NodeId + type Map32 struct + func (m *Map32[K, V]) Get(key K) (v V, found bool) + func (m *Map32[K, V]) IsFull() bool + func (m *Map32[K, V]) MustGet(key K) V + func (m *Map32[K, V]) Set(key K, v V) error + func (m *Map32[K, V]) Size() int + type Node interface + Id func() NodeId + type NodeId int64 + type RWLocker interface + Lock func() + RLock func() + RUnlock func() + Unlock func() + type SingleNodeRetrievalType int + const WithData + type StringMap32Entry struct + type TSArrayQueue struct + func NewTSArrayQueueWithConfig[T any](config TSArrayQueueConfig[T]) *TSArrayQueue[T] + func NewTSArrayQueue[T any]() *TSArrayQueue[T] + func (q *TSArrayQueue[T]) AutoRemove() + func (q *TSArrayQueue[T]) Clear() + func (q *TSArrayQueue[T]) Dequeue() (value T, ok bool) + func (q *TSArrayQueue[T]) DequeueAll() []T + func (q *TSArrayQueue[T]) Enqueue(value T) + func (q *TSArrayQueue[T]) EnqueueAll(values ...T) + func (q *TSArrayQueue[T]) EnqueueAllAutoRemove(values ...T) + func (q *TSArrayQueue[T]) EnqueueAutoRemove(value T) + func (q *TSArrayQueue[T]) HasNeverHadElements() bool + func (q *TSArrayQueue[T]) IsEmpty() bool + func (q *TSArrayQueue[T]) Iterator() *ArrayQueueIterator[T] + func (q *TSArrayQueue[T]) Peek() (value T, ok bool) + func (q *TSArrayQueue[T]) Size() int + func (q *TSArrayQueue[T]) Values() []T + type TSArrayQueueConfig struct + AutoRemoveCondition func(v T) bool + type ThreadSafety bool