Documentation
¶
Index ¶
- type DisjointSet
- func (d *DisjointSet) Finalize()
- func (d *DisjointSet) Find(x interface{}) (uint64, error)
- func (d *DisjointSet) FindInternal(p []uint64, n uint64) uint64
- func (d *DisjointSet) GetHashMap() *sync.Map
- func (d *DisjointSet) GetParent(tag uint64) uint64
- func (d *DisjointSet) GetParents() []uint64
- func (d *DisjointSet) GetRanks() []uint64
- func (d *DisjointSet) GetSize() uint64
- func (d *DisjointSet) MakeSet(x interface{})
- func (d *DisjointSet) PrepareMakeSet(x interface{}, clusters *dgraph.Clusters, lock *sync.RWMutex)
- func (d *DisjointSet) PrepareUnion(x, y interface{}, clusters *dgraph.Clusters, lock *sync.RWMutex) (uint64, error)
- func (d *DisjointSet) Union(x, y interface{}) (uint64, error)
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) 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