Skip to contents

All traverse paths of a sequence

Usage

all_traverse_paths(rules, p)

get_one_traverse_path(rules, p)

plot_traverse_paths(rules, p, type = c("all", "11|22", "12|21"))

Arguments

rules

An sfc_rules object.

p

An sfc_sequence sequence. p and rules should have the same universe base set. Please provide p as a small sequence because the total number of all traverse paths might be very huge.

type

If the value is "11|22", it highlights the paths only via 1-1/2-2 corners. If the value is "12|21", it highlights the paths only via 1-2/2-1 corners.

Details

Given an input sequence with rotations, all_traverse_paths() lists all combinations of expansion codes from the first letter to the last letter in p (i.e. all possible traverse paths).

get_one_traverse_path() returns one random traverse path.

Examples

# expansion rules for the general 3x3 curves
p = SFC_RULES_3x3_COMBINED@rules$I[[3]]
get_one_traverse_path(SFC_RULES_3x3_COMBINED, p)
#> [1] 4 3 2 3 3 2 1 2 4
get_one_traverse_path(SFC_RULES_3x3_COMBINED, p)
#> [1] 1 1 3 1 2 3 3 4 3
get_one_traverse_path(SFC_RULES_3x3_COMBINED, p)
#> [1] 2 2 2 3 3 2 1 4 1
get_one_traverse_path(SFC_RULES_3x3_COMBINED, p)
#> [1] 3 2 2 1 4 1 3 4 1
# 
p = SFC_RULES_3x3_COMBINED@rules$I[[3]]
plot_traverse_paths(SFC_RULES_3x3_COMBINED, p)

plot_traverse_paths(SFC_RULES_3x3_COMBINED, p, type = "11|22")

plot_traverse_paths(SFC_RULES_3x3_COMBINED, p, type = "12|21")


# 2x2 curve
p = sfc_2x2("I", 11)
plot_traverse_paths(SFC_RULES_2x2, p)


# Peano curve
p = sfc_3x3_peano("I", 1)
plot_traverse_paths(SFC_RULES_3x3_PEANO, p)


# Meander curve
p = sfc_3x3_meander("I", 1)
plot_traverse_paths(SFC_RULES_3x3_MEANDER, p)