X-Git-Url: https://ruin.nu/git/index.pl?a=blobdiff_plain;f=src%2Fgenealgorithms.cpp;h=7dc832f252c208900b92c234879c8f09b5a93c24;hb=e7953f0050007cd1999d64d985d0a063b9ddc99b;hp=154df354bc346592f53a1373b49bbc1c72a0b79d;hpb=74e3465418ae60633025efb581e399308ffdf4b1;p=germs.git diff --git a/src/genealgorithms.cpp b/src/genealgorithms.cpp index 154df35..7dc832f 100644 --- a/src/genealgorithms.cpp +++ b/src/genealgorithms.cpp @@ -22,31 +22,15 @@ #include "geneorder.h" #include +#include #include using namespace std; std::pair longestSequences(const GeneOrder& go){ + vector > v = robinsonSchensted(go); + return pair(v[0].size(),v.size()); } - -/* -robSche2 :: [Int] -> [[Int]] -> [[Int]] -robSche2 [] ys = ys -robSche2 (x:xs) ys = robSche2 xs $ robSche4 x ys - -robSche3 :: Int -> [Int] -> (Maybe Int,[Int]) -robSche3 x ys = let yless = [y | y <- ys, y < x] in - let ymore = [y | y <- ys, y > x] in - case ymore of - [] -> (Nothing, yless++[x]) - (y:ys) -> (Just y, yless++(x:ys)) - -robSche4 :: Int -> [[Int]] -> [[Int]] -robSche4 x [] = [[x]] -robSche4 x (y:ys) = case robSche3 x y of - (Nothing, y) -> y:ys - (Just x, y) -> y:robSche4 x ys -*/ std::vector > robinsonSchensted(const GeneOrder& go){ vector > v; for (GeneOrder::iterator i = go.begin(); i != go.end(); ++i){ @@ -70,3 +54,21 @@ std::vector > robinsonSchensted(const GeneOrder& go){ } return v; } + +int countCycles(const GeneOrder& go){ + int cycles = 0; + set marked; + for (size_t p = 1; p < go.size() - 1; ++p){ + if (marked.find(p) != marked.end()) + continue; + } + return cycles; +} + +std::vector findComponents(const GeneOrder& go){ + return vector(); +} + +std::vector findIntervals(const GeneOrder& go){ + return vector(); +}