Skip to main content

Orderings

An ordering is a mapping from elements of a data aray to natural numbers.

Orderings are important because they can control how data is positioned by attribute-based layouts.

There are two main types of orderings:

  • attribute-based orderings are defined by the attributes of data elements directly
  • seriation-based orderings are obtained by trying to trying to permuate the rows or columns of a matrix in such a way that reveals structure which would otherwise be hidden

Seriation-based orderings are obtained using the Reorder.js library (GitHub, npm)

An ordering specification has the following parameters:

AttributeTypeDescription
namestringThe name that will be given to the ordering when it is created.
datastringThe name that will be given to the ordering when it is created
allowTies?booleanIf allowTies is true, then two items for which the ordering criterion are equal will be assigned the same rank.If allowTies is false, then every item will be assigned a distinct rank.
orderByOrderingCriterion[] or OrderingCriterionThe criterion that will be used when ordering items.

An OrderingCriterion is either an OrderingCriterionAttribute or an OrderingCriterionSeriation.

Attribute-based orderings

An OrderingCriterionAttribute is either a string specifying the name of the attribute to be used, an OrderingCriterionExpression or an OrderingCriterionField.

OrderingCriterionExpression:

AttributeTypeDescription
expressionstringThis expression will be evaluated for each item, and the items will be sorted based on these calculated values. The expression can access an item as datum.
direction?"ascending" or "descending"Which direction to sort in.
fnanyThis expression will be evaluated for each item, and the items will be sorted based on these calculated values.Whether to sort in ascending or descending order.

OrderingCriterionField:

AttributeTypeDescription
fieldstring or string[]The name of a field (or list of names of fields) to sort on.
direction?"ascending" or "descending"Which direction to sort in.
fnanyThis expression will be evaluated for each item, and the items will be sorted based on these calculated values.Whether to sort in ascending or descending order.

Seriation-based orderings

OrderingCriterionSeriation:

AttributeTypeDescription
methodSeriationAlgorithmNameThe name of the seriation method.
weightField?stringThe name of a field containing edge weights.
distance?DistancesThe name of the distance function to use.

The method can be one of optimal-leaf-order, barycentre, bandwidth-reduction, or pca. The distance can be one of euclidean, manhattan, minkowski, chebyshev, hamming, jaccard, braycurtis.