# dentist.util.math

## Members

### Functions

N
ElementType!Range N(Range values, Num totalSize)

Calculate the Nxx (e.g. N50) of values.

absdiff
Num absdiff(in Num a, in Num b)

Returns the absolute difference between two numbers.

G.Edge add(ref G graph, G.Edge edge)

Add an edge to this graph and handle existing edges with handleConflict. The handler must have this signature Edge handleConflict(Edge, Edge).

void bulkAdd(ref G graph, R edges)

Add a set of edges to this graph and merge mutli-edges using merge.

ceil
Integer ceil(in Integer x, in Integer base)

Round x upward according to base, ie. returns the next integer larger or equal to x which is divisible by base.

ceildiv
Integer ceildiv(in Integer a, in Integer b)

Returns the result of ceil(a / b) but uses integer arithmetic only.

findAllCliques

Find all maximal cliques in a graph represented by adjacencyList. The implementation is based on version 1 of the Bron-Kerbosch algorithm .

floor
Integer floor(in Integer x, in Integer base)

Round x downward according to base, ie. returns the next integer smaller or equal to x which is divisible by base.

longestIncreasingSubsequence
auto longestIncreasingSubsequence(Range sequence)

Calculate a longest increasing subsequence of sequence. This subsequence is not necessarily contiguous, or unique. Given a sequence of n elements the algorithm uses O(n log n) evaluation of pred.

mean
ElementType!Range mean(Range values)

Calculate the mean of range.

median
ElementType!Range median(Range values)

Calculate the median of range.

### Structs

Graph
struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)

This structure represents a graph with optional edge payloads. The graph is represented as a list of edges which is particularly suited for sparse graphs. While the set of nodes is fixed the set of edges is mutable.

NaturalNumberSet
struct NaturalNumberSet