Function
| Static Public Summary | ||
| public |
combinations(iterable: Iterable, r: number): IterableIterator<Array> Yields all combinations of each possible choice of |
|
| Static Private Summary | ||
| private |
* _combinations(n: number, k: number): IterableIterator<number[]> Yields all k-subsets of {0, 1, ..., n-1}. |
|
Static Public
public combinations(iterable: Iterable, r: number): IterableIterator<Array> source
import combinations from '@combinatorics/n-combinations/src/combinations.js'Yields all combinations of each possible choice of r elements
of the input iterable.
Params:
| Name | Type | Attribute | Description |
| iterable | Iterable | The input iterable. |
|
| r | number | The size of the combinations to generate. |
Example:
// AB AC AD BC BD CD
combinations('ABCD', 2)
// 012 013 023 123
combinations(range(4), 3)
