# Exploratory Data Analysis and Searching Cliques in Graphs
## 4 Numerical Experiments  
We assess our \(1\)-dimensional manifold finding method by applying it to real world data (i.e., not controlled trials). Sourced from a medical institution, we have access to a large set of fasting blood sugar test measurements. From this set, we take a sample belonging to \(m=300\) patients, such that each patient has \(l\geq 50\) blood sugar measurements taken over the span of \(2.5\leq s<12.5\) years (between 2006 and 2018). There can be many reasons for someone to be measured this many times (e.g., monthly check-ups, daily monitoring of inpatients), and accordingly, the time series exhibit wildly different trajectories (Figure 1). The raw data are in the format of (date-value) pairs. We consider such time series as a sample of a patient's blood glucose dynamics, both in terms of its distribution and trajectory. To moderate the effect of episodes of frequent samplings (e.g., during hospitalization), we convert the series of (date-value) pairs into a series of (week-weekly average value) pairs. For comparability across series of vastly different lengths, we keep only the first \(5\) years of each series. The maximum number of data pairs in a time series \(T\) is thus \(2.5\times 52\leq k\leq 5\times 52\). We propose using three measures to quantify the distance, \(\delta_{i,j}\), between the time series of patients \(i\) and \(j\) (to be named \"distribution\", \"balanced\", and \"trajectory\"). Each option results in a different \(m\times m\) distance matrix \(D\) of the time series, on which to perform the clique-finding algorithm. (1) \"Distribution\" distance. We take the calculated weekly average values, numbering at most \(k\), and sort them. Thus, all information pertaining to their original order is lost; what we keep is solely their distribution. We project these values onto a stretch of \(k\) weeks, as evenly spaced as possible, and fill the missing values by linear interpolation. Once all time series have exactly \(k\) elements, we calculate \(\delta\) by computing the average \(L^{1}\) distance of the blood glucose values at their respective positions in the time series:  
\[\delta_{i,j}=\frac{1}{k}\sum_{x=1}^{k}\left|T_{i}(x)-T_{j}(x)\right|\]  
(2) \"Balanced\" distance. We fill the missing weekly average values by linear interpolation, and then sort them; although we eventually lose the information about their original order, the interpolation step is informed by it. These time series may have less than \(k\) elements, \(k_{i}\leq k\), where the span of the \(i\) time series is \(s_{i}<5\) years; we thus rely on \(k_{\text{min}}=min(k_{i},k_{j})\). Otherwise, \(\delta\) is calculated similarly to above:  
\[\delta_{i,j}=\frac{1}{k_{\text{min}}}\sum_{x=1}^{k_{\text{min}}}\left|T_{i}(x )-T_{j}(x)\right|\]  
(3) \"Trajectory\" distance. We align the time series optimally using dynamic time warping [10; 11; 12], which keeps the original order of the blood glucose values. For the  
Figure 1: **Examples of blood glucose time series. ** Panel (**A**) shows a patient with healthy blood sugar levels (i.e., between 4.4 and 6.1 mmol/L when fasting; see dashed lines and green background). Panel (**B**) shows a slightly elevated baseline, cf. prediabetes. Panel (**C**) shows spikes of extremely high levels (>20 mmol/L), cf. acute hyperglycemia, likely paired with medical emergency and hospital stay. Panel (**D**) shows chronic diabetes, possibly untreated, with both high mean and high variation in blood sugar levels. High values have red and low values have a blue background. respective elements of the aligned time series, we calculate \(L^{1}\) distances, and compute the minimum global distance normalized for path length. Once we have \(D\), we implement the algorithm to produce the \(H\) graph using the flatness of the rectangle. Then we apply the KaMIS program [13; 14] to heuristically find a big clique. Clusters of \(D\) can be expected to correspond to similar blood glucose dynamics (distributions or trajectories), and thus health perspectives.