# Extract preferences from user 1 in the included example data.
prefs <- pairwise_preferences[
pairwise_preferences$user == 1, c("top_item", "bottom_item"), drop = FALSE]
# Generate all topological sorts, but don't save them:
sorts <- precompute_topological_sorts(
prefs = as.matrix(prefs),
n_items = 5,
save_frac = 0
)
# Number of sorts
sorts$sort_count
# Empty matrix
sorts$sort_matrix
# Generate all topological sorts and save them:
sorts <- precompute_topological_sorts(
prefs = as.matrix(prefs),
n_items = 5,
save_frac = 1
)
# Number of sorts
sorts$sort_count
# Matrix with all of them
sorts$sort_matrix
Run the code above in your browser using DataLab