We propose a novel computational framework for analyzing electroencephalography (EEG) time series using methods from stringology, the study of efficient algorithms for string processing, to systematically identify and characterize recurrent temporal patterns in neural signals. The primary aim is to introduce quantitative measures to understand neural signal dynamics, with the present findings serving as a proof-of-concept. The framework adapts order-preserving matching (OPM) and Cartesian tree matching (CTM) to detect temporal motifs that preserve relative ordering and hierarchical structure while remaining invariant to amplitude scaling. This approach provides a temporally precise representation of EEG dynamics that complements traditional spectral and global complexity analyses. To evaluate its utility, we applied the framework to multichannel EEG recordings from individuals with attention-deficit/hyperactivity disorder (ADHD) and matched controls using a publicly available dataset. Highly recurrent, group-specific motifs were extracted and quantified using both OPM and CTM. The ADHD group exhibited significantly higher motif frequencies, suggesting increased repetitiveness in neural activity. OPM analysis revealed shorter motif lengths and greater gradient instability in ADHD, reflected in larger mean and maximal inter-sample amplitude changes. CTM analysis further demonstrated reduced hierarchical complexity in ADHD, characterized by shallower tree structures and fewer hierarchical levels despite comparable motif lengths. These findings suggest that ADHD-related EEG alterations involve systematic differences in the structure, stability, and hierarchical organization of recurrent temporal patterns. The proposed stringology-based motif framework provides a complementary computational tool with potential applications for objective biomarker development in neurodevelopmental disorders.
Figures & tables
Brain Region
Electrodes
Channels
Frontal
Fp1, Fp2, F3, F4, F7, F8, Fz
1, 2, 3, 4, 11, 12, 17
Central
C3, C4, Cz
5, 6, 18
Temporal
T7, T8
13, 14
Parietal
P3, P4, P7, P8, Pz
7, 8, 15, 16, 19
Occipital
O1, O2
9, 10
Reference
A1, A2
—
Table 1: EEG electrode groups and corresponding channel numbers. This configuration provided comprehensive coverage of frontal, central, temporal, parietal, and occipital brain regions.
Figure 1: The Cartesian trees of (7,2,16,4,8) and (10,5,17,9,18) are identical, illustrating a Cartesian Tree Matching (CTM) instance. In both cases, the tree nodes are labeled by the positions of the corresponding values in the string, starting from position 0 . More generally, any string of length 5 in which the minimum value occurs at position 1 and the second minimum occurs at position 3 will produce the same Cartesian tree structure, regardless of the order relations between the values at positions 0 , 2 , and 4 .
Channel
Len 6
Len 6
Len 7
Len 7
1
101
3
70
22
2
46
8
62
15
3
50
6
63
20
4
52
10
51
21
5
53
3
41
32
6
35
6
59
21
Table 2: OPM motif counts per channel, per length, and per group. (Orange - ADHD, Blue - Control)
Channel
Len 9
Len 9
Len 10
Len 10
1
17
4
85
9
2
10
2
62
19
3
13
2
56
13
4
9
3
76
15
5
15
1
71
27
6
8
6
57
16
Table 3: CTM motif counts per channel, per length, and per group. (Orange - ADHD, Blue - Control)
Figure 2: Median frequency of discovered OPM motifs across all EEG channels.
Figure 3: Median frequency of discovered CTM motifs across all EEG channels.
Figure 4: Detailed comparison of the mean of all discovered OPM motifs of length 7 in electrode fz (channel 17) (a.u.).
Figure 5: The ranks derived from the mean OPM motifs of length 7 in midline frontal electrode Fz (channel 17) for both groups.
Figure 6: Detailed comparison of the mean of all discovered CTM motifs of length 9 in electrode fz (channel 17) (a.u.).
Figure 7: Left: The Cartesian tree of the mean of CTM motifs of length 9 in the control group. Right: The Cartesian tree of the mean of CTM motifs of length 9 in the ADHD group. In both trees, each node includes the position of the value.
Figure 8: Median max jump magnitude of all significant discovered OPM motifs. No significant group differences were observed in channels 2-4, 6-8, and 10-11 (a.u.).
Figure 9: Median mean jump of all significant discovered OPM motifs. No significant group differences were observed in channels 2-3, 6-8, and 10-11 (a.u.).
Figure 10: Median standard deviation of jump magnitude for all significant discovered OPM motifs. No significant group differences were observed in channels 2-4, 6-7, 9-11, and 19 (a.u.).
Figure 11: Median normalized jump magnitude of all significant discovered OPM motifs. No significant group differences were observed in channels 2-3, 6-8, and 10-11 (a.u.).
Figure 12: The median value of the rank turning points count of all significant discovered OPM motifs. The rank turning points count is significant across all channels.
Figure 13: The median value of the rank diff max of all significant discovered OPM motifs. The median value of the rank diff max is significant only in channel 1.
Figure 14: Median mean jump in all significant CTM motifs. There are no significant motif mean jumps for channels 1-13, and 17-19 (a.u.).
Figure 15: Median max jump value in all significant CTM motifs. There are no significant motif max jumps for channels 1-8, 11-13, and 18-19 (a.u.).
Figure 16: The median of tree max depth in all significant CTM motifs. There are no significant motif tree max depths for channels 1-4, 6-9, 11, 13, and 18-19.
Figure 17: The median of tree leaves in all significant CTM motifs. There are no significant motif tree leaves for channels 1-4, 6-9, 11, 13, and 18-19.
Figure 18: The median of tree branches in all significant CTM motifs. There are no significant motif tree branches for channels 1-4, 6-9, 11, 13, and 18-19.
Figure 19: The median of tree balance in all significant CTM motifs. There are no significant motif tree balances for channels 1-2, 4, 6-9, 11, 13, and 18-19.
Fischell Department of Bioengineering, University of Maryland, College Park, MD, United States · School of Basic Sciences, Hanbat National University, Daejeon, Republic of Korea
Laboratory of Neural Computing and Intelligent Perception, College of Information Engineering, Capital Normal University, Beijing, China · Karlsruhe Institute of Technology, Germany · School of Psychology, Capital Normal University, Beijing, China