Documentation
¶
Index ¶
- type DSU
- func (d *DSU) Add(label string) int
- func (d *DSU) Connected(x int, y int) bool
- func (d *DSU) CountSets() int
- func (d *DSU) FindLabel(idx int) string
- func (d *DSU) FindOrCreate(label string) int
- func (d *DSU) Labels() []string
- func (d *DSU) MarshalJSON() ([]byte, error)
- func (d *DSU) Size() int
- func (d *DSU) Union(x int, y int)
- func (d *DSU) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DSU ¶
type DSU struct {
// contains filtered or unexported fields
}
DSU represents a Disjoint Set Union data structure
func (*DSU) FindOrCreate ¶
FindOrCreate finds the root of the set by label, or adds it if it doesn't exist
func (*DSU) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*DSU) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
Click to show internal directories.
Click to hide internal directories.