paths = {
const permutations = (tokens, subperms = [[]]) =>
R.isEmpty(tokens)
? subperms
: R.addIndex(R.chain)((token, idx) => permutations(
R.remove(idx, 1, tokens),
R.map(R.append(token), subperms)
), tokens);
const nodes = [
{o: 0, x: 0, y: -2*scale},
{o: 1, x: 0, y: 2*scale},
{o: 2, x: 2*scale, y: 0},
{o: 3, x: -2*scale, y: 0}
]
const colors = d3.schemeTableau10
return permutations(nodes).map(([N, S, E, W]) => [
{...N, c: colors[0], name: "n"},
{...S, c: colors[1], name: "s"},
{...E, c: colors[2], name: "e"},
{...W, c: colors[3], name: "w"}
] )
}