memory

package
v0.0.0-...-bcfd2cf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DisjointSet

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

DisjointSet implements disjoint set structure

func NewDisjointSet

func NewDisjointSet() DisjointSet

NewDisjointSet returns a reference to a new istance of persisted disjoint set

func (*DisjointSet) Finalize

func (d *DisjointSet) Finalize()

Finalize parses the entire set

func (*DisjointSet) Find

func (d *DisjointSet) Find(x interface{}) (uint64, error)

Find returns the value of the set required as argument to the function

func (*DisjointSet) FindInternal

func (d *DisjointSet) FindInternal(p []uint64, n uint64) uint64

FindInternal recursively search for the element of depth n in the set

func (*DisjointSet) GetHashMap

func (d *DisjointSet) GetHashMap() *sync.Map

GetHashMap returns the set hashmap

func (*DisjointSet) GetParent

func (d *DisjointSet) GetParent(tag uint64) uint64

GetParent returns parent based on the passed tag

func (*DisjointSet) GetParents

func (d *DisjointSet) GetParents() []uint64

GetParents returns parents list

func (*DisjointSet) GetRanks

func (d *DisjointSet) GetRanks() []uint64

GetRanks returns ranks list

func (*DisjointSet) GetSize

func (d *DisjointSet) GetSize() uint64

GetSize returns the number of elements in the set

func (*DisjointSet) MakeSet

func (d *DisjointSet) MakeSet(x interface{})

MakeSet creates a new set based adding the parameter passed as argument to the set

func (*DisjointSet) PrepareMakeSet

func (d *DisjointSet) PrepareMakeSet(x interface{}, clusters *dgraph.Clusters, lock *sync.RWMutex)

PrepareMakeSet is a method declared for the persistent version of the package. Fallback to MakeSet

func (*DisjointSet) PrepareUnion

func (d *DisjointSet) PrepareUnion(x, y interface{}, clusters *dgraph.Clusters, lock *sync.RWMutex) (uint64, error)

PrepareUnion is a method declared for the persistent version of the package. Fallback to Union

func (*DisjointSet) Union

func (d *DisjointSet) Union(x, y interface{}) (uint64, error)

Union returns the common set to the elements passed as arguments

Jump to

Keyboard shortcuts

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