You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
namespace WhiteRabbit
|
|
{
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
internal class PrecomputedPermutationsGenerator
|
|
{
|
|
private static PermutationsGenerator.Permutation[] Permutations1 { get; } = PermutationsGenerator.HamiltonianPermutations(1).ToArray();
|
|
|
|
private static PermutationsGenerator.Permutation[] Permutations2 { get; } = PermutationsGenerator.HamiltonianPermutations(2).ToArray();
|
|
|
|
private static PermutationsGenerator.Permutation[] Permutations3 { get; } = PermutationsGenerator.HamiltonianPermutations(3).ToArray();
|
|
|
|
private static PermutationsGenerator.Permutation[] Permutations4 { get; } = PermutationsGenerator.HamiltonianPermutations(4).ToArray();
|
|
|
|
private static PermutationsGenerator.Permutation[] Permutations5 { get; } = PermutationsGenerator.HamiltonianPermutations(5).ToArray();
|
|
|
|
public static IEnumerable<PermutationsGenerator.Permutation> HamiltonianPermutations(int n)
|
|
{
|
|
switch(n)
|
|
{
|
|
case 1:
|
|
return Permutations1;
|
|
case 2:
|
|
return Permutations2;
|
|
case 3:
|
|
return Permutations3;
|
|
case 4:
|
|
return Permutations4;
|
|
case 5:
|
|
return Permutations5;
|
|
default:
|
|
return PermutationsGenerator.HamiltonianPermutations(n);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|