package set
import "gonum.org/v1/gonum/graph/internal/set"
Package set provides integer and graph.Node sets.
Index ¶
- func Equal(a, b Nodes) bool
- func IntsEqual[T Int](a, b Ints[T]) bool
- type Int
- type Ints
- func (s Ints[T]) Add(e T)
- func (s Ints[T]) Count() int
- func (s Ints[T]) Has(e T) bool
- func (s Ints[T]) Remove(e T)
- type Nodes
Functions ¶
func Equal ¶
Equal reports set equality between the parameters. Sets are equal if and only if they have the same elements.
func IntsEqual ¶
IntsEqual reports set equality between the parameters. Sets are equal if and only if they have the same elements.
Types ¶
type Int ¶
type Ints ¶
type Ints[T Int] map[T]struct{}
func (Ints[T]) Add ¶
func (s Ints[T]) Add(e T)
Add inserts an element into the set.
func (Ints[T]) Count ¶
Count reports the number of elements stored in the set.
func (Ints[T]) Has ¶
Has reports the existence of the element in the set.
func (Ints[T]) Remove ¶
func (s Ints[T]) Remove(e T)
Remove deletes the specified element from the set.
type Nodes ¶
Nodes is a set of nodes keyed in their integer identifiers.
func CloneNodes ¶
CloneNodes returns a clone of src.
func IntersectionOfNodes ¶
IntersectionOfNodes returns the intersection of a and b.
The intersection of two sets, a and b, is the set containing all the elements shared between the two sets, for instance:
{a,b,c} INTERSECT {b,c,d} = {b,c}
The intersection between a set and itself is itself, and thus effectively a copy operation:
{a,b,c} INTERSECT {a,b,c} = {a,b,c}
The intersection between two sets that share no elements is the empty set:
{a,b,c} INTERSECT {d,e,f} = {}
func NewNodes ¶
func NewNodes() Nodes
NewNodes returns a new Nodes.
func NewNodesSize ¶
NewNodesSize returns a new Nodes with the given size hint, n.
func UnionOfNodes ¶
UnionOfNodes returns the union of a and b.
The union of two sets, a and b, is the set containing all the elements of each, for instance:
{a,b,c} UNION {d,e,f} = {a,b,c,d,e,f}
Since sets may not have repetition, unions of two sets that overlap do not contain repeat elements, that is:
{a,b,c} UNION {b,c,d} = {a,b,c,d}
func (Nodes) Add ¶
Add inserts an element into the set.
func (Nodes) Count ¶
Count returns the number of element in the set.
func (Nodes) Has ¶
Has reports the existence of the elements in the set.
func (Nodes) Remove ¶
Remove deletes the specified element from the set.
Source Files ¶
doc.go same.go set.go
- Version
- v0.15.1 (latest)
- Published
- Aug 16, 2024
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 day ago –
Tools for package owners.