I am doing signal analysis, part of which is to search for the longest subsequence
I have a dictionary like the following:
sequenceDict = {
0: [168, 360, 470],
1: [279, 361, 471, 633, 729, 817],
2: [32, 168, 170, 350, 634, 730, 818],
3: [33, 155, 171, 363, 635, 731, 765, 819],
4: [352, 364, 732, 766, 822],
5: [157, 173, 353, 577, 637, 733, 823, 969],
6: [158, 174, 578, 638, 706, 734, 824],
7: [159, 175, 579, 707, 735],
8: [160, 464, 640, 708, 826],
9: [173, 709, 757, 827],
10: [174, 540, 642, 666, 710],
11: [253, 667, 711],
12: [254, 304, 668],
13: [181, 255, 831],
14: [256, 340, 646, 832],
16: [184, 416],
17: [417],
18: [418],
19: [875],
20: [876],
23: [217],
24: [168, 218, 880],
25: [219, 765, 881],
26: [220, 766],
27: [221],
28: [768],
29: [3, 769],
30: [344, 476, 706]}
These are, in fact, always sorted indices of another array, I would like to find the longest incremental sequence (as the longest growing subsequence ) by selecting only one number from each key sequentially (key 2 comes immediately after key 1, etc.), for example, from the keys 0 and 1, [360, 361] - one sequence, and [470, 471] - another. I call this incremental sequence, as these numbers must strictly increase by 1.
, .., , , - python , dict, ?