union

package module
v0.0.0-...-0b9368a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package union provides an implementation of a union-find data structure derived from the work done by Robert Sedgewick and Kevin Wayne as part of Algorithms, 4th Edition.

http://algs4.cs.princeton.edu/code/

Copyright (C) 2000–2016 Robert Sedgewick and Kevin Wayne Copyright (C) 2017 Kasper Kronborg Isager

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Union

type Union interface {
	// Find finds the parent of a given element.
	Find(p int) int

	// Join adds a connection between two elements.
	Join(p int, q int)

	// Connected checks if two elements are connected.
	Connected(p int, q int) bool
}

Union describes a union-find data structure used for partitioning a set of elements into groups of connected components.

func New

func New() Union

New constructs and initialises a new union-find data structure.

Jump to

Keyboard shortcuts

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