1 Introduction

Epilepsy is a neurological disorder characterized by recurrent seizures due to changes in the normal brain activity [4]. The correct clinical diagnosis and syndromic classification can provide information on the location of the epileptogenic area. Some techniques such as electroencephalography (EEG), video EEG, high-density EEG, deep intracerebral electrodes, magnetic resonance imaging (MRI), magnetoencephalography (MEG), among others are useful supporting tools to identify the epileptogenic area [11, 45]. However, some questions still remain open. For instance, it is not clear if seizures begin in the same region where the highest ictal activity occurs. Another issue relies in determining the region at which seizures involve more than three EEG channels simultaneously, and the way seizures spread over the cerebral cortex [44]. To aid in clarifying these questions, we developed a methodology to identify the region on the cerebral cortex with the highest ictal activity and its dynamical characteristics. This methodology could help neurologists to improve diagnostics and to accurately determine the epileptogenic zone, thus further information about this brain region could be obtained.

In this section, we introduce some well-known concepts related to epileptic seizures and give a survey of related works on the search of the epileptic focus.

1.1 Epileptic seizures

An epileptic seizure is a sudden and unexpected disturbance of the electrical activity of the brain accompanied by clinical manifestations, e.g., changes of behavior and even abnormal movements such as convulsions. In some cases, epileptic seizures may originate as localized spots of unusual electrical activity that spread over the entire brain. In other cases, the onset of seizures is unknown and may not have a clear pattern of evolution [38]. Epileptic seizures lead to transient occurrence of signs and/or symptoms due to excessive abnormal or synchronous neuronal activity in the brain [4]. Synchronicity is manifested by the simultaneous occurrence of EEG waves over distinct regions on the brain with similar speeds and phases [25].

Epileptic seizures are identified in EEG signals as abrupt changes in the background activity consisting of repetitions of excessive neuronal discharges with characteristic patterns that evolve and last several seconds. When EEG seizures do not show the clinical epileptic manifestations, they are referred to as electrographic seizures or ictal EEG patterns [25]. Electrographic seizures and some abnormal transients share similar characteristics and both may show evolving patterns. However, their differences lie in the duration and distribution of their patterns. In particular, seizures can last several seconds (more than 10 s), while transients are shorter (less than 1 s). For example, the ictal generalized spike-wave (GSW) and slow wave complex display a larger number of complex repetitions that occur constantly without intervening of background activity and have a typical duration of at least 5 s [30, 41].

Figure 1 shows two EEG segments that last 8 s. The part (a) of the figure represents an abnormal transient that is noticeable from the background activity of the EEG. The part(b) shows a typical electrographic seizure. Both share similar morphological characteristics but the electrographic seizure lasts longer. These signals have patterns of repetitive epileptiform EEG discharges represented by the high peaks followed by slow waves. In particular, this kind of pattern is known as spike and slow wave complex, which is one of the most commonly found patterns in epileptic seizures [41].

Fig. 1
figure 1

a Typical EEG segment showing an abnormal transient. b An electrographic seizure pattern

Sometimes EEG seizure patterns are manifested like events of short duration (less than 10 s) with a noticeable increase in the frequency (typically higher than 25 Hz) and amplitude reduction. This is the case of the fast EEG ictal activity, also known as low voltage fast activity or low fast activity [25, 41, 47]. Officially, no minimum time span has been established to define seizures, hence any pattern of neuronal discharge may qualify as electrographic seizure regardless its duration [29].

A focal epileptic seizure is an abnormal event originated within neural networks limited to one hemisphere of the brain. It can be located in one lobe of the brain or distributed over a wider region. In addition, focal epileptic seizures may originate in the subcortical structures [4]. The onset of ictal activity is manifested by a seizure on a certain area of the cortex that ends up covering a larger area with a preferential spreading pattern that may even reach the opposite hemisphere. Every seizure has a consistent onset site, though more than one neural network may be involved, and more than one kind of seizure may occur [4].

For those patients that continue suffering seizures in spite of pharmacological treatments, surgery could be an appropriate option. For this reason, the accurate location of the epileptic focus becomes essential. However, in some cases surgery is not an option, or even some patients may not want to undergo any surgical intervention. For these patients, neuromodulation therapy can be a suitable alternative [40]. The identification of the epileptic focus is also decisive for this therapy, which works by actively stimulating nerves to produce a natural biological response in the site of action. This therapy employs a device that sends small electric currents to specific points of the central nervous system aimed to modify its behavior [40].

1.2 Epileptic focus

The epileptic focus is a region of the brain where epileptic seizures originate. This region is most likely associated with the epileptogenic zone. The epileptic focus is essential for the generation of clinical seizures, and can be associated with the region with strongest ictal activity or the regions where seizures spread over. These regions lie in one lobe of the brain and may even reach another lobe, or begin in one hemisphere and may extend to the other.

Nowadays, the boundaries of the regions of the brain that show abnormalities during interictal periods cannot be defined from a diagnostic test, but EEG or MRI recordings can aid to estimate their locations. In addition, these techniques allow to estimate the regions where interictal peaks are generated, and those with structural damage. Nonetheless, the regions where the epileptic focus originates and to where it spreads cannot be accurately identified by a joint study of EEG and MRI recordings. Note that all of these regions define the epileptogenic zone only if they are spatially concordant [29].

Next, we present a survey of the most relevant approaches about the identification of the epileptic focus using the electrical signals from the brain.

1.3 Related works

Functional connectivity refers to the statistical dependence between the neural activity of different regions, regardless of any underlying anatomical connection [44]. Brazier pioneered the analysis of human ictal intracranial electroencephalography (IEEG) recordings using functional connectivity measurements [9]. Her method is based on coherence and phase analysis to infer the causal relations between two channels. A computer program was developed to determine the essential frequencies composing each burst of abnormal wave trains and to follow their passage from the initiating region to other parts of the brain during the spreading of seizures. Coherence was used to estimate the strength of the connection of the channels, while phase was used to determine directionality [9].

The work [44] applied the adapted directed transfer function (ADTF) both to simulated signals and IEEG recordings of patients with refractory epilepsy. The epileptic focus was located by a time-variant connectivity analysis at seizure onsets. The connectivity patterns obtained from IEEG recordings provided useful information about the spreading of seizures and their dynamics. On the other hand, the work [45] gives a survey of functional connectivity methods applied to EEG and IEEG. There it is shown that functional connectivity patterns obtained from intracranial and scalp EEG recordings convey information on the dynamics of seizures, which can be used to locate their onset zone.

The work [48] performed a graph analysis of epileptogenic networks to identify the cortical regions responsible for the initiation and propagation of the ictal activity. They used invasive electrocorticography (EcoG) data of patients diagnosed with intractable epilepsy. They performed a betweenness centrality study to identify critical nodes in cortical networks during both ictal and interictal states. For this aim, they used an algorithm from [37] to identify seizures. It was observed that the betweenness centrality of the identified nodes decreased from the onset of the ictal activity and attained a minimum approximately one minute after ictal cessation.

The works [9] and [39] used brain mapping for visualizing the brain activity over the scalp. There it was observed that implementing a time delay analysis between the EEG channels using topographic mapping can lead to the location of the epileptic focus. However, its successful detection is only possible when specific epileptic seizures can be observed throughout the EEG recordings.

In the literature, one can find several approaches to detect the seizure onset zone (SOZ). For instance, the work [15] proposed a method that uses EEG and functional magnetic resonance imaging (fMRI), both simultaneously acquired. This method allows to quantitatively determine the concordance distance between presumed SOZ, and interictal epileptiform discharges (IED) related to blood-oxygen-level-dependent (BOLD) imaging response. This provided an improvement for tracing the SOZ in different brain regions. From these results, it was possible to find full concordance in 17 from 21 IED types. It was concluded that BOLD changes are related to epileptic spikes, which can help to localize the foci in various brain regions.

The recent study [11] performed a comparison between magnetoencephalographic (MEG) and EEG signals. It was shown that during the resting state, i.e., without requiring any action from the patient and in the absence of interictal spikes, MEG can provide entirely new insights on the malfunctioning operation of different regions of the brain, with more accurate measurements and localization of the foci than simply using EEG.

The approach of [28] involves an analysis of mapping synchronization in three phases: (1) awake stage (AS); (2) sleep stage (SS); and (3) ictal stage (IS) in EEG recordings from two patients, one diagnosed with temporal lobe epilepsy, and the other with frontal lobe epilepsy. They found significant differences of mutual information and nonlinear parameters among the three stages. Besides, it was found that the networks corresponding to seizures always presented a high degree distribution, and the nodes with the largest degrees are related with the onset zone.

Regarding the identification of the epileptogenic zone in the cerebral cortex and the analysis of its behavior in different states (for instance during rest, sleep, stress, awake, or ictal stage), several approaches aimed to study the neural dynamic structures in time and the way seizures propagate. In this path, we can mention the following recent works [16, 18, 19, 34, 49, 50]. Besides, other relevant works related to improve or aid in the focus identification are [9,10,11, 15, 28, 39, 44, 45].

All of the above-mentioned works are devoted to locate the regions where seizures originate and the region with the most ictal activity as well as the regions where seizures spread. These works lack in determining whether all these regions are located in the same area or if they are distributed in a wider region on the cerebral cortex. Hence, an integrated report of the information obtained from EEG is still needed. Having all this information could aid to define suitable treatments for patients and to improve their quality of life.

In the present work, we present a methodology that identifies all the brain regions with behaviors associated with the epileptic focus automatically. This novel methodology arises from the analysis of the complex networks formed in the brain during epileptic seizures. To the best of our knowledge no similar complex network approach has been used for analyzing seizures and their spreading dynamics, though several methods already exist that can identify the zone of the epileptic focus.

1.4 Approach of this paper

In this work, we analyze several EEG recordings from patients diagnosed with two kinds of epilepsy and implement a methodology based on two processes for automatically detecting the epileptic focus and its dynamics. An algorithm was developed for each process. The first algorithm analyzes the ictal activity of the brain and automatically identifies the segments in EEG recordings corresponding to electrographic seizure events. That is, this algorithm identifies ictal EEG patterns and reports the EEG channels where electrographic seizures were detected as well as the instants at which they occurred and their duration, among other data. The second algorithm treats the EEG channels as nodes of a network if electrographic seizures are detected. For each network, we identify the most important node, which is the EEG channel corresponding to the epileptic focus, and determine its dynamics by means of complex network techniques. More precisely, this second algorithm constructs a network whenever at least three EEG channels show electrographic seizures simultaneously. From the resulting networks of the whole recording, we determine the important nodes, together with their degrees and clustering coefficients. Also, we are able to determine the instants at which propagations occur. All this information allows to identify the epileptic focus and the way it spreads over the cerebral cortex.

The rest of the paper is organized as follows. In Sect. 2, the characteristics of the EEG recordings and the device to acquire the signals are presented. In Sect. 3, we describe the methodology implemented by the two main algorithms. The first algorithm for classifying all segments of one second duration corresponding to abnormal events and attenuations from EEG recordings, and for identifying the seizures and the channels with the most ictal EEG activity. The second algorithm for identifying the regions of the cerebral cortex where seizures spread. In Sect. 4, an analysis of the results obtained with this methodology is presented. Finally, in Sects. 5 and 6, the discussion of the results and conclusions are presented, respectively.

2 Materials and data

The clinical procedure to obtain the EEG recordings was the following: the patients attended their scheduled appointments to carry out their EEG studies. The neurologist informed them about the privacy notice where it was specified the protection of their data. An adult patient and the parents of the minor patients gave their consent to make a more thorough analysis of their EEG data for scientific purposes. Seventeen EEG recordings were selected from seventeen subjects diagnosed with different neurological disorders. Six recordings correspond to generalized seizures, seven correspond to focal seizures on different areas of the cortex, two correspond to attention deficit hyperactivity disorder (ADHD), and two correspond to conduct disorder (CD).

The ages of the considered subjects range from 5 to 24 years, see Table 1. The seventeen EEG recordings last from 28 to 45 minutes and were taken according to the tenets of the Declaration of Helsinki [21] by the neurologist using a Comet-PLUS \(^{\textregistered }\) Portable EEG-Recording & Review System from Grass Technologies\(^{\textregistered }\), at a sampling rate of 200 Hz. The distribution of electrodes was according to the 10–20 standard with an average assembly in which the amplitudes of the electrical signals correspond to the potential differences between electrodes and the average of the rest of electrodes. The raw EEG signals were split into segments of one second. This duration was chosen in order to coincide with the duration of regular intervals when reading EEGs, as it is established by clinical guidelines [25].

Table 1 Some characteristics of the EEG recordings of the considered patients

3 Methodology

In order to identify the epileptic focus, we developed a methodology based on two algorithms described in this work. The first algorithm implemented in MATLAB\(^{\textregistered }\)Footnote 1 analyzes the 19 EEG channels forming each EEG recording to obtain information about the duration and prevalence of ictal activity (crises) as well as attenuations. The second algorithm implemented in NetworkX from Python [1, 36] identifies the EEG channels and regions of the cerebral cortex where seizures spread, and determine their dynamics from a complex network approach. The results of the first algorithm called ictal activity analysis feed the second algorithm called seizure propagation analysis, see Fig. 2.

Fig. 2
figure 2

Two algorithms developed in this work to identify the epileptic focus

Fig. 3
figure 3

Eight noticeable abnormal events in an EEG recording of a given channel

3.1 First algorithm: ictal activity analysis

Let us consider the EEG signal of Fig. 3 that lasts 3000 s (50 min). Eight abnormal events are clearly noticeable due to their intense amplitudes compared to the rest of the signal. These events can be considered either ictal or epileptic depending on their morphological characteristics and the conditions defining seizures, see Table 8. Though some events are noticeable by the naked eye, most of the information gets lost by visual analysis. For this reason, we developed an algorithm that accounts for both the noticeable and the imperceptible events. This algorithm involves three main steps: (1) identification of reductions and abnormal events, (2) identification of attenuations and electrographic seizures, and (3) calculation of duration and prevalence.

3.1.1 Identification of reductions and abnormal events

The data of the 19 channels of an EEG recording were split into segments of one second, since it is the minimum length for the analysis of EEG signals [25]. Next, abnormal behaviors and reductions were identified from the segments of the 19 channels and classified throughout the entire recording according to the thresholds shown in Table 8 of Appendix 6. The identification was carried out automatically based on the previous work [36], where three main features are considered: frequency, amplitude, and the age of the patient.

3.1.2 Identification of seizures and attenuations

Seizures are characterized by their long duration, which may last even few minutes. In order to discard short transients during the process of crises identification, we established for definiteness that seizures must last at least 3 s, which is equivalent to the repetition of three consecutive abnormal segments. On this basis, all repetitions of abnormal events larger than 2 s were automatically identified.

On the other hand, attenuations may occur transiently or more permanently. Given that attenuations can last more than one second, their localization throughout the entire recording consists in identifying all the repetitions of reductions, i.e., those segments with amplitudes less or equal than 10 \(\mu \)V in the 19 EEG channels [25]. After that, we identified the regions in the cerebral cortex with the highest number of abnormal segments that fulfill the characteristics of seizures, abnormal transients, or attenuations. Recall that each region of the brain is associated to an EEG channel, thereby the information obtained in this process is translated into corresponding cerebral regions.

3.1.3 Accuracy of the identification process

For determining the accuracy of the identification process we form a random sample as follows. From four recordings of patients diagnosed with epilepsy, we choose three EEG channels. (Recall that each EEG recording entails 19 channels.) This selection process was carried out randomly but the selected channels must contain at least three crises. From the selected EEG channels we choose three sections each of which lasts 8 s. Therefore, 4 recordings \(\times \) 3 channels \(\times \) 3 sections of 8 s produce a sample of 36 EEG sections with both ictal and interictal segments. Next, we employed the confusion matrix [5] of Table 2.

Table 2 Confusion matrix for the identification process of crises

The sensitivity and specificity of the identification process are calculated by the expressions

$$\begin{aligned} \mathrm {Sensitivity}=\frac{{\text {TP}}}{{\text {TP}}+{\text {FP}}},\qquad \mathrm {Specificity}=\frac{{\text {TN}}}{{\text {TN}}+{\text {FP}}}. \end{aligned}$$

Sensitivity relates to the ability of recognizing patterns when they are present. This measurement is used to estimate the probability of getting a positive result from ill subjects. On the other hand, specificity relates to the ability to discard patterns when they are not present. This measurement is employed to estimate the probability of getting a negative result in healthy subjects [17].

3.1.4 Calculation of duration and prevalence

For calculating the duration and prevalence, all seizures and attenuations on each EEG channel were counted. Their initial and final instants were automatically obtained to determine their duration. The prevalence of these events in the whole EEG recording was determined according to Table 9 of Appendix A.

3.1.5 Output data

The first algorithm generates several data from the EEG recordings with relevant clinical meaning, which are summarized next.

Regarding seizures and abnormal behaviors the algorithm provides:

  1. 1.

    The EEG channel with the highest number of abnormal behaviors.

  2. 2.

    The EEG channel where crises begin (that is, the channel where the first seizure was identified, ChCB).

  3. 3.

    The EEG channel with most crises (ChMC).

  4. 4.

    The duration and prevalence in the EEG channel with most crises.

  5. 5.

    The instants at which seizures begin in all EEG channels.

Regarding attenuations the algorithm provides:

  1. 1.

    The EEG channel with most attenuations (ChMA).

  2. 2.

    Their duration and prevalence in the EEG channel with most attenuations.

The instants at which seizures begin are used as input data for the second algorithm, which is introduced next.

3.2 Second algorithm: seizure propagation analysis

The algorithm of Sect. 3.1 classifies all the segments of EEG recordings and identifies the regions on the cerebral cortex with the strongest ictal activity. With this information, it is possible to observe the cortical distribution of seizures. It happens that seizures may start in one or two channels and then they spread to adjacent channels. In other cases, an epileptic event may extend to the channels of different lobes, even in both hemispheres.

The second algorithm is aimed to analyze the propagation of seizures, that is, to identify the regions of the cerebral cortex where seizures spread. This algorithm consists of three main steps: (1) identification of the instant at which propagations occur; (2) generation of adjacency matrices for the complex networks formed during ictal events; and (3) calculation of the network parameters and identification of the most important nodes of such networks.

3.2.1 Identification of the instants at which propagations occur

To identify the instants at which propagations occur, the initial instants of seizures involving simultaneously two or more EEG channels were automatically detected and stored in memory, and the involved EEG channels were counted. These initial instants for each ictal event were provided by the first algorithm. A key aspect in the process of identifying the epileptic focus is that the EEG channels that take part in the propagation of seizures must belong to adjoint regions or lobes in the cerebral cortex [29]. Hence, we are interested in investigating if the channel where seizures begin and the channel with the most ictal activity are involved in the propagation of seizures, and verify if those EEG channels are adjacent.

3.2.2 Generation of adjacency matrices

A definite characteristic of epileptic seizures is that signals from different EEG channels tend to increase their synchronization during ictal events. This effect implies a stronger correlation between the signals from different EEG channels during ictal events than during interictal events. An example of such a synchronization is shown in Fig. 4. The horizontal axes represent a time interval of 8 s, and the vertical axes represent the amplitudes of signals from six EEG channels measured in \(\mu \)V. It is possible to observe \(\delta \) and \(\theta \) activity of great amplitude and a strong synchronization between the channels C3, F3 and P3, as is highlighted by the gray rectangle.

Fig. 4
figure 4

Plots of six channels that show a strong synchronization during an ictal event

Since all the regions of the brain have certain degree of connectivity, and given that some of them are more connected than others, no isolated regions can be found in the brain even during normal events. On this basis, we analyze electrographic seizures from a point of view of complex networks. For each identified seizure involving more than two channels we construct a network consisting of 19 nodes, one node per each EEG channel. By a procedure introduced below in this subsection, we construct fully connected networks [2] by using the cross-correlation as a measure of synchronization.

3.2.3 Cross-correlation of EEG signals

Let \(X_{t}\) and \(Y_{t}\) be a pair of stochastic processes, which are assumed to be jointly wide-sense stationary [33]. Here \(X_{t}\equiv x\left( t\right) \) and \(Y_{t}\equiv y\left( t\right) \) are the pair of signals to be analyzed. Owing to stationarity, their corresponding means \(\mu _{X}={E}\left[ X_{t}\right] \), \(\mu _{Y}={E}\left[ Y_{t}\right] \) and standard deviations

$$\begin{aligned} \sigma _{X}=\sqrt{{E}\left[ \left( X_{t}-\mu _{X}\right) ^{2}\right] },\qquad \sigma _{Y}=\sqrt{{E}\left[ \left( Y_{t}-\mu _{Y}\right) ^{2}\right] } \end{aligned}$$

remain constant over time, where \({E}\left[ \,\cdot \,\right] \) denotes the expected value. Cross-correlation \(\rho _{XY}\) of the jointly wide-sense stationary processes \(X_{t}\) and \(Y_{t}\) is defined by

$$\begin{aligned} \rho _{XY}\left( \tau \right) =\frac{K_{XY}\left( \tau \right) }{\sigma _{X}\sigma _{Y}}= \frac{{E}\left[ \left( X_{t}-\mu _{X}\right) \left( Y_{t+\tau }- \mu _{Y}\right) \right] }{\sigma _{X}\sigma _{Y}}, \end{aligned}$$

where \(K_{XY}\left( \tau \right) \) is the cross-covariance function, and \(\tau \) is the lag time between two instants. Cross-correlation establishes the relationship between two different stochastic processes at the same time or different time considering a lag \(\tau \), [6]. Should the function \(\rho _{XY}\left( \tau \right) \) is well-defined, its range is the segment \(\left[ -1,1\right] \), where 1 represents a total correlation, \(-1\) implies total anti-correlation, and 0 indicates no relationship between the processes.

In general, biosignals are nonlinear, noisy, and non-stationary [20]. Nonetheless, on considering a small enough window, the data covered by it can be considered stationary as a whole [24]. Thus, a large signal register can be treated piecewise stationary by splitting the register into segments with the appropriate sizes. This approach can be used in EEG registers for the sake of simplicity in the analysis [12, 26, 46]. Indeed, in the work [14], it was shown that EEG signals may be considered stationary random processes for epochs shorter than 12 s. On this basis, cross-correlation can be used as a connectivity measurement between EEG signals [45]. It is worth mentioning that cross-correlation has been widely used in the literature as a measure of synchronization for EEG signals (see, e.g. [6, 13, 23, 31, 32, 35] and references therein).

Fig. 5
figure 5

a Spatial layout of the EEG electrodes on the scalp according to the 10–20 standard and their corresponding tags. b An example of a network and the correspondence between nodes and EEG channels

Cross-correlation of a given pair of EEG segments can be estimated from their samples. Let \(X_{i}\equiv x\left( i\right) \) and \(Y_{i}\equiv y\left( i\right) \) denote the discrete time realizations of a pair of EEG segments, both of which consist of N samples. Then, cross-correlation is defined by the formula

$$\begin{aligned} \rho _{XY}\left( \tau \right) =\frac{1}{N-\tau }\sum _{i=1}^{N-\tau } \frac{\left( X_{i}-\mu _{X}\right) \left( Y_{i+\tau }-\mu _{Y}\right) }{\sigma _{X}\sigma _{Y}}. \end{aligned}$$

Let

$$\begin{aligned} {\text {Cor}}_{XY}=\max _{\tau \in \left[ 0,N-1\right] }\rho _{XY}\left( \tau \right) \end{aligned}$$

denote the maximum cross-correlation between the EEG segments \(X_{i}\) and \(Y_{i}\) for positive time lag \(\tau \). In the present work, the analysis window spans 5 s, which agrees with the conditions of stationarity by Cohen and Sances, [14]. The window begins at the instant \(t_{0}\) at which an ictal event is detected. Recall that the instants at which seizures begin were determined by the first algorithm.

3.2.4 Adjacency matrices

On constructing a network, a link between a pair of nodes is established depending on their level of synchronization, which is determined by the cross-correlation \({\text {Cor}}_{XY}\). Each node is assigned a tag corresponding to the number of channel from the EEG assembly. As shown in Fig. 5a, the tags of the nodes correspond to the electrodes on the scalp sensing the cerebral cortex. For instance, the position Fp1 corresponds to node 1 of a graph, the position Fp2 corresponds to node 5, and so on. Figure 5b shows an example of a network formed during certain ictal event.

From the time series of the 19 EEG channels corresponding to a n-th seizure (each of which has a duration of 5 s), we calculate their cross-correlations. The results are organized in a \(19\times 19\)-matrix,

$$\begin{aligned} \mathrm {Cor}\left( n\right) =\left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} {\text {Cor}}_{1,1}^{\left( n\right) } &{} {\text {Cor}}_{1,2}^{\left( n\right) } &{} \cdots &{} {\text {Cor}}_{1,19}^{\left( n\right) }\\ {\text {Cor}}_{2,1}^{\left( n\right) } &{} {\text {Cor}}_{2,2}^{\left( n\right) } &{} \cdots &{} {\text {Cor}}_{2,19}^{\left( n\right) }\\ \vdots &{} \vdots &{} \ddots &{} \vdots \\ {\text {Cor}}_{19,1}^{\left( n\right) } &{} {\text {Cor}}_{19,2}^{\left( n\right) } &{} \cdots &{} {\text {Cor}}_{19,19}^{\left( n\right) } \end{array}\right) , \end{aligned}$$

where n takes the role of an index representing the number of event, and \({\text {Cor}}_{ij}^{\left( n\right) }\) denotes the cross-correlation between the i-th and j-th \(\left( i,j=1,2,\ldots ,19\right) \) EEG samples from that event.

Once the correlation matrix \(\mathrm {Cor}\left( n\right) \) was generated, its average \(\bar{x}_{\mathrm {Cor}}^{\left( n\right) }\) and standard deviation \(\sigma _{\mathrm {Cor}}^{\left( n\right) }\) are calculated according to the formulas:

$$\begin{aligned} \bar{x}_{\mathrm {Cor}}^{\left( n\right) }= & {} \frac{1}{19^{2}} \sum _{i=1}^{19}\sum _{j=1}^{19}{\text {Cor}}_{ij}^{\left( n\right) },\\ \sigma _{\mathrm {Cor}}^{\left( n\right) }= & {} \sqrt{\frac{1}{19^{2}} \sum _{i=1}^{19}\sum _{j=1}^{19}\left( {\text {Cor}}_{ij}^{\left( n\right) }- \bar{x}_{\mathrm {Cor}}^{\left( n\right) }\right) ^{2}}. \end{aligned}$$

These parameters will be used to determine a correlation interval \(I_{n}=\left( a^{\left( n\right) },b^{\left( n\right) }\right) \), and a vector of weights \({W}\left( n\right) \). The components of vector \({W}\left( n\right) \) will determine whether a link is established in the n-th network or not. The ends of the correlation interval \(I_{n}\) are defined by

$$\begin{aligned} a^{\left( n\right) }=\bar{x}_{\mathrm {Cor}}^{\left( n\right) }- \sigma _{\mathrm {Cor}}^{\left( n\right) },\qquad b^{\left( n\right) }= \bar{x}_{\mathrm {Cor}}^{\left( n\right) }+\sigma _{\mathrm {Cor}}^{\left( n\right) }. \end{aligned}$$

To construct the vector of weights \({W}\left( n\right) \), the length \(\left| b^{\left( n\right) }-a^{\left( n\right) }\right| \) of interval \(I_{n}\) is split into 18 equal segments of length \(\Delta _{n}\). The components of vector \({W}\left( n\right) \) are arranged in a decreasing order as follows:

$$\begin{aligned} {W}\left( n\right) =\left( b^{\left( n\right) },b^{\left( n\right) }- \Delta _{n},b^{\left( n\right) }-2\Delta _{n},\ldots ,a^{\left( n\right) }\right) . \end{aligned}$$

Thus, vector \({W}\left( n\right) \) will have 19 components like the number of channels of an EEG recording.

Let \(W_{i}^{\left( n\right) }\) \(\left( i=1,2,\ldots ,19\right) \) be the i-th component of vector \({W}\left( n\right) \). The adjacency matrix

$$\begin{aligned} {A}\left( n\right) =\left( A_{ij}^{\left( n\right) }\right) _{i,j=1}^{19} \end{aligned}$$

for the n-th event is defined as follows. We begin letting \(k=1\), then we set

$$\begin{aligned} A_{ij}^{\left( n\right) }={\left\{ \begin{array}{ll} 1, &{}\quad \text {if }\;W_{k}^{\left( n\right) }\le {\text {Cor}}_{ij}^{\left( n\right) }<1,\\ 0, &{}\quad \text {if }\;W_{k}^{\left( n\right) }>{\text {Cor}}_{ij}^{\left( n\right) } \text { or if }{\text {Cor}}_{ij}^{\left( n\right) }=1, \end{array}\right. } \end{aligned}$$
(1)

for each \(i,j=1,2,\ldots ,19\). As was mentioned above, no isolated regions should be found in the brain. To verify if the resulting adjacency matrix describes a connected network, the following condition

$$\begin{aligned} \sum _{j=1}^{19}A_{ij}^{\left( n\right) }>0 \end{aligned}$$
(2)

must hold for each row \(i=1,2,\ldots ,19\). If this condition is not satisfied the process is repeated by setting \(k=2,3,\ldots ,19\) until condition (2) is fulfilled. Then, that component \(W_{k}^{\left( n\right) }\) of vector \({W}\left( n\right) \) corresponding to the value of k for which condition (2) is satisfied corresponds to highest possible degree of correlation between the EEG channels during the n-th ictal event, which is denoted by \(W_{\max }^{\left( n\right) }\).

Remark 1

Condition (2) may not be satisfied once the previous process finishes. In that case, the following procedure should be carried out. Identify a row \(\lambda \) \(\left( \lambda =1,2,\ldots ,19\right) \) from matrix \({A}\left( n\right) \) for which the condition

$$\begin{aligned} \sum _{j=1}^{19}A_{\lambda j}^{(n)}=0 \end{aligned}$$

is satisfied. Then, we form a set \(\mathrm {\widehat{Cor}}\) from the entries of the \(\lambda \)-th row of matrix \(\mathrm {Cor}\left( n\right) \), which is defined by

$$\begin{aligned} \widehat{\mathrm {Cor}}=\left\{ {\text {Cor}}_{\lambda ,1}^{\left( n\right) },{\text {Cor}}_{\lambda ,2}^{\left( n\right) }, \ldots ,{\text {Cor}}_{\lambda ,19}^{\left( n\right) }\right\} . \end{aligned}$$

Then, we generate an interval \(\widehat{I}_{n}=\left( \widehat{a}^{\left( n\right) }, \widehat{b}^{\left( n\right) }\right) \) of length \(\left| \widehat{b}^{\left( n\right) }- \widehat{a}^{\left( n\right) }\right| \), where

$$\begin{aligned} \widehat{a}^{\left( n\right) }=\min \left( \widehat{\mathrm {Cor}}\right) ,\quad \text {and} \quad \widehat{b}^{\left( n\right) }=a^{\left( n\right) }. \end{aligned}$$

Next, we split the length of the interval \(\widehat{I}_{n}\) into, say, 10 segments of equal length \(\widehat{\Delta }_{n}\) (the number 10 has been chosen arbitrarily, though other positive numbers less than 19 can be used as well). After that, we construct the modified vector of weights \(\widehat{{W}}\left( n\right) \) defined by

$$\begin{aligned} \widehat{{W}}\left( n\right) =\left( \widehat{b}^{\left( n\right) }, \widehat{b}^{\left( n\right) }-\widehat{\Delta }_{n},\widehat{b}^{\left( n\right) }- 2\widehat{\Delta }_{n},\ldots ,\widehat{a}^{\left( n\right) }\right) . \end{aligned}$$

Let \(\widehat{W}_{i}^{\left( n\right) }\) \(\left( i=1,2,\ldots ,10\right) \) denote the i-th component of vector \(\widehat{W}\left( n\right) \). Now, the elements \(A_{\lambda j}^{\left( n\right) }\) of the \(\lambda \)-th row of the adjacency matrix \({A}\left( n\right) \) are defined as follows. We begin letting \(k=2\), then for each \(j=1,2,\ldots ,19\) we set

$$\begin{aligned} A_{\lambda j}^{\left( n\right) }={\left\{ \begin{array}{ll} 1, &{} \text {if }\;\widehat{W}_{k}^{\left( n\right) }\le {\text {Cor}}_{\lambda j}^{\left( n\right) }<1,\\ 0, &{} \text {if }\;\widehat{W}_{k}^{\left( n\right) }>{\text {Cor}}_{\lambda j}^{\left( n\right) } \text { or if }{\text {Cor}}_{\lambda j}^{\left( n\right) }=1. \end{array}\right. } \end{aligned}$$
(3)

Finally, we verify if the condition

$$\begin{aligned} \sum _{j=1}^{19}A_{\lambda j}^{\left( n\right) }>0 \end{aligned}$$
(4)

holds. If not, this process is repeated by letting \(k=3,4,\ldots ,10\) until condition (4) is satisfied.

Example 1

As an example of the above procedure let us consider the network of Fig. 5b that was generated during a seizure that spreads to three EEG channels. This corresponds to the eleventh event indicated by a green disk in Fig. 8b, of the results section. The resulting network contains 44 links, and its highest degree of correlation was \(W_{\max }^{\left( 11\right) }=W_{5}^{\left( 11\right) }=0.564\), which was found at the fifth iteration (that is, \(k=5\)). The resulting vector and matrices are the following:

$$\begin{aligned} {W\left( 11\right) }= & {} \left( \begin{array}{ccccccccc} 0.678,&0.650,&0.622,&0.594,&\mathbf {0.564},&0.539,&\cdots&0.205,&0.177\end{array}\right) ,\\ \mathrm {Cor}\left( 11\right)= & {} \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c@{\quad }c} 1.000 &{} {\mathbf{0.592}} &{} 0.307 &{} \cdots &{} 0.427\\ \mathbf {0.592} &{} 1.000 &{} \mathbf {0.582} &{} \cdots &{} \mathbf {0.580}\\ 0.307 &{} \mathbf {0.582} &{} 1.000 &{} \cdots &{} 0.138\\ \vdots &{} \vdots &{} \vdots &{} \ddots &{} \vdots \\ 0.427 &{} \mathbf {0.580} &{} 0.138 &{} \cdots &{} 1.000 \end{array}\right) ,\\ {A}\left( 11\right)= & {} \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c@{\quad }c} 0 &{} 1 &{} 0 &{} \cdots &{} 0\\ 1 &{} 0 &{} 1 &{} \cdots &{} 1\\ 0 &{} 1 &{} 0 &{} \cdots &{} 0\\ \vdots &{} \vdots &{} \vdots &{} \ddots &{} \vdots \\ 0 &{} 1 &{} 0 &{} \cdots &{} 0 \end{array}\right) . \end{aligned}$$

We observe that the entries in bold of the correlation matrix \(\mathrm {Cor}\left( 11\right) \) are larger than \(W_{5}^{\left( 11\right) }=0.564\). It is worth noticing that the main diagonal of the adjacency matrix \({A}\left( 11\right) \) contains only zeros because no self-links are generated in the network.

Fig. 6
figure 6

a Four important nodes identified in a network during an ictal event; b the same network with labeled nodes corresponding to certain positions on the cortex, see Fig. 5a

Once the adjacency matrix was determined for each ictal event, we proceeded to identify the most important node by means of the NetworkX package of Python.

3.2.5 Identification of the most important node

The shortest path between a pair of nodes \(v_{i},v_{j}\in V\) refers to the path connecting these nodes through the least number of links of a network G, without loops nor self-intersections [2]. Here, \(V=V\left( G\right) \) denotes the set of nodes or vertices of the network G. On the other hand, the betweenness centrality indicates the level of influence of a node on the flow of information in a network, [8]. The betweenness centrality of a node \(v\in V\), denoted by \(c_{b}\left( v\right) \), is calculated by the expression

$$\begin{aligned} c_{b}\left( v\right) =\underset{s,t\in V\left( G\right) }{\sum } \frac{\sigma \left( s,t\mid v\right) }{\sigma \left( s,t\right) }, \end{aligned}$$
(5)

where s and t are dummy indices representing a pair of nodes of the network G, \(\sigma \left( s,t\right) \) is the number of shortest paths between the nodes s and t, and \(\sigma \left( s,t\mid v\right) \) is the number of those shortest paths passing through the analyzed node v.

In order to identify the important nodes of a n-th network generated during an ictal event we implement the betweenness centrality algorithm [7] as follows. First, we calculate the betweenness centrality of each node \(v_{i}\left( n\right) \) \((i=1,2,\ldots ,19)\) of the network by expression (5). The obtained results form a set denoted by \({C}_{b}\left( n\right) \), that is

$$\begin{aligned} {C}_{b}\left( n\right) =\left\{ c_{b}\left( v_{1}\left( n\right) \right) , c_{b}\left( v_{2}\left( n\right) \right) ,\ldots ,c_{b}\left( v_{19}\left( n\right) \right) \right\} . \end{aligned}$$

Next, we calculate the average \(\mathrm {avg}\left( {C}_{b}\left( n\right) \right) \) of the elements of \({C}_{b}\left( n\right) \), and their standard deviation \(\mathrm {std}\left( {C}_{b}\left( n\right) \right) \). Finally, if the condition

$$\begin{aligned} c_{b}\left( v_{i}\left( n\right) \right) \ge \left( \mathrm {avg}\left( {C}_{b} \left( n\right) \right) +\mathrm {std}\left( {C}_{b}\left( n\right) \right) \right) \end{aligned}$$

is satisfied by node \(v_{i}\left( n\right) \) then it is classified as important.

Example 2

As an example, Fig. 6a shows the four important nodes identified in the network from Fig. 5b, which is redrawn in Fig. 6b for the sake of clarity. The important nodes 2, 11, 17 and 19 correspond to the positions F7, P3, Fz and Pz in the cerebral cortex, respectively.

Fig. 7
figure 7

Two different ictal events identified in some EEG recordings

The important nodes of the network \(G\left( n\right) \) corresponding to the n-th ictal event form a set \(\Omega \left( n\right) \). For each node \(v\in \Omega \left( n\right) \) we calculate its degree \(k_{v}^{\left( n\right) }\) (that is, the number of links established by node v with other nodes of the network) and clustering coefficient \(C_{v}^{\left( n\right) }\) according to the formulas [2]

$$\begin{aligned} k_{v}^{\left( n\right) }=\sum _{j=1}^{19}A_{vj}^{\left( n\right) },\quad C_{v}^{\left( n\right) }=\frac{2L_{v}^{\left( n\right) }}{k_{v}^{\left( n\right) } \left( k_{v}^{\left( n\right) }-1\right) }, \end{aligned}$$

where \(L_{v}^{\left( n\right) }\) represents the number of links that connect the neighboring nodes of node \(v\in \Omega \left( n\right) \) to each other [42]. The resulting values of degree and clustering coefficient form the sets \({K}\left( n\right) \) and \({C}\left( n\right) \), respectively.

This procedure is carried out over all seizures at which propagations occur. From the collections \(\Omega \left( n\right) \), \({K}\left( n\right) \) and \({C}\left( n\right) \) obtained during all seizures we form the (super) sets \(\varvec{\Omega }\), \(\varvec{\mathrm {K}}\) and \(\varvec{\mathrm {C}}\) by preserving the ordering of their elements as follows

$$\begin{aligned} \varvec{\Omega }= & {} \left\{ \Omega \left( 1\right) ,\Omega \left( 2\right) ,\ldots , \Omega \left( N\right) \right\} ,\\ \varvec{\mathrm {K}}= & {} \left\{ {K}\left( 1\right) , {K}\left( 2\right) ,\ldots ,{K}\left( N\right) \right\} ,\\ {\mathbf{C}}= & {} \left\{ {C}\left( 1\right) ,{C}\left( 2\right) ,\ldots ,{C}\left( N\right) \right\} , \end{aligned}$$

where N is the number of identified seizures in which more than two channels were involved.

A single node \(\omega _{{\mathrm{max}}}\in \varvec{\Omega }\) with the highest prevalence is identified in a histogram constructed from the set \(\varvec{\Omega }\), in which the frequency of occurrence of nodes \(v_{i}^{\left( n\right) }\) \(\left( i=1,2,\ldots ,19\right) \) is registered as a function of the number n of event. We can think in \(\varvec{\Omega }\) as vector

$$\begin{aligned} \overrightarrow{\varvec{\Omega }}=\left( \underbrace{\omega _{1},\omega _{2}, \cdots ,\omega _{\ell }}_{\Omega \left( 1\right) },\underbrace{\omega _{\ell +1},\ldots , \omega _{m}}_{\Omega \left( 2\right) },\ldots ,\underbrace{\omega _{n+1},\ldots , \omega _{M}}_{\Omega \left( N\right) }\right) \end{aligned}$$

where components \(\omega _{j}\) \(\left( j=1,2,\ldots ,M\right) \) preserve the ordering of the sets \(\Omega \left( i\right) \) \(\left( i=1,2,\ldots ,N\right) \). Similarly, from the sets \(\mathbf {K}\) and \(\mathbf {C}\) we form their corresponding vectors \(\overrightarrow{\mathbf {K}}\) and \(\overrightarrow{\mathbf {C}}\), that is

$$\begin{aligned} \overrightarrow{\mathbf {K}}= & {} \left( \underbrace{K_{1},K_{2},\ldots ,K_{\ell }}_{{K}\left( 1\right) }, \underbrace{K_{\ell +1},\ldots ,K_{m}}_{{K}\left( 2\right) },\ldots , \underbrace{K_{n+1},\ldots ,K_{M}}_{{K}\left( N\right) }\right) ,\\ \overrightarrow{\mathbf {C}}= & {} \left( \underbrace{C_{1},C_{2},\ldots ,C_{\ell }}_{{C}\left( 1\right) }, \underbrace{C_{\ell +1},\ldots ,C_{m}}_{{C}\left( 2\right) },\ldots , \underbrace{C_{n+1},\ldots ,C_{M}}_{{C}\left( N\right) }\right) . \end{aligned}$$

Let us find the positions (indexes) j of the components of vector \(\overrightarrow{\varvec{\Omega }}\) such that \(\omega _{j}\equiv \omega _{\max }\). These positions form a set of indexes denoted by J. We identify in the vectors \(\overrightarrow{\mathbf {K}}\) and \(\overrightarrow{\mathbf {C}}\) those components corresponding to the positions specified in J and construct the sets

$$\begin{aligned} {k}_{J}=\left\{ K_{j}\in \overrightarrow{\mathbf {K}}:\,j\in J\right\} ,\quad {c}_{J}=\left\{ C_{j}\in \overrightarrow{\mathbf {C}}:\,j\in J\right\} . \end{aligned}$$
Table 3 Identification of crises of seventeen complete EEG recordings
Table 4 Identification of attenuations of seventeen complete EEG recordings

Once all of these sets have been determined, the following results are obtained:

  1. 1.

    The EEG channels at which propagations take place and the instants at which these occur.

  2. 2.

    The most important node \(\omega _{{\mathrm{max}}}\), which represents the EEG channel through which seizures spread.

  3. 3.

    The set \({k}_{J}\) with the values of the degree taken by the most important node at the identified seizures.

  4. 4.

    The set \({c}_{J}\) with the values of clustering coefficient taken by the most important node at the identified seizures.

4 Results

4.1 First algorithm: ictal activity analysis

The first algorithm of this methodology analyzes the EEG recordings to identify the regions with the higher ictal activity and the attenuations in the cerebral cortex. The obtained results allow to identify and count the crises and attenuations in their respective EEG channels. Figure 7 shows two examples of ictal events that were identified by means of this algorithm. The morphology of these signals agrees with the characteristics of patterns associated to epilepsy. In particular, a spike-slow wave complex is shown in Fig. 7a, and a complex of slow wave is shown in Fig. 7b. Both waves show high amplitudes that stand out from the background activity.

Table 3 shows the results of identification of ictal events in the considered recordings. The channel with the higher amount of crises, their quantity, duration, and prevalence are presented in the table. Similarly, Table 4 shows the obtained results regarding attenuations.

According to the results of Table 3, the patients \(E-4\), \(E-5, E-6, E-9, E-11\) and \(E-12\) presented in the same region of the cortex the channel where crises began (ChCB) and the channel with most crises (ChMC). For the patient \(E-4\), ChCB and ChMC correspond to Fp1, while for the patient \(E-5\) these channels correspond to Fp2. On the other hand, the patients \(E-7\) and \(E-12\) presented ChCB and ChMC in contiguous channels of the cortex. More precisely, the patient \(E-7\) presented ChCB at Fp1, and ChMC at F3, while the patient \(E-12\) presented ChCB at Pz, and ChMC at O1.

As was expected, the results of Table 3 show that epileptic patients presented a higher crisis activity compared with those patients diagnosed with ADHD and CD. In turn, the results of Table 4 show that patients with ADHD and CD presented a higher activity of attenuations compared with epileptic patients.

Once the automatic process of classification of ictal events had finished we could confirm that the segments that formed the sample to evaluate the methodology fulfills the characteristics established in Table 8 of Appendix A. After the visual evaluation of the sample by the neurologist, the results were registered in a confusion matrix of Table 5. There we can see the performance of our first algorithm.

Table 5 Confusion matrix and performance of the process of crises identification

4.2 Second algorithm: seizure propagation analysis

The second algorithm of this methodology allows to identify the EEG channels and regions of the cerebral cortex where seizures spread. From the seventeen EEG recordings employed in this work, only those thirteen EEG recordings from patients diagnosed with epilepsy were analyzed by this algorithm, but only the results of two of them are shown below, which correspond to patients having different kinds of epilepsy.

Figure 8 shows the dynamic of seizures of the two considered patients as they spread through the EEG channels. The horizontal axes of the plots represent the time at which seizures occurred, and the vertical axes represent the number of involved channels during seizure registration, and not the individual tags of electrodes over the scalp. We can see that seizures begin in a certain channel, and then they propagate to the others. Figure 8a corresponds to a patient diagnosed with generalized seizures, in which 15 propagation events were identified. We can observe that seizures reached up to 16 channels in about 500 s. On the other hand, Fig. 8b shows that seizures begin in certain channel and then they propagated through the 19 channels in about 1350 s. This last case corresponds to a patient diagnosed with focal seizures, where 70 propagation events were identified.

Fig. 8
figure 8

Propagation of seizures and number of channels involved during seizures. a Seizures registered from a patient diagnosed with generalized seizures. b Seizures registered from a patient diagnosed with focal seizures

The set \(\varvec{\Omega }=\left\{ \Omega \left( 1\right) ,\Omega \left( 2\right) , \ldots ,\Omega \left( N\right) \right\} \) gathers the information of the important nodes involved during crises, so that some statistical treatment can be performed on it. For instance, we can determine a histogram for each recording as shown Fig. 9. In these plots, the horizontal axes represent the EEG channels corresponding to the nodes of the networks, and the vertical axes represent the frequency of occurrence of the nodes that were identified as important. For instance, in Fig. 9a, the node 10 labeled as C3 (located in the central left position on the cerebral cortex) has the highest prevalence with a counting of eight occurrences. On the other hand, in Fig. 9b, the node 4 with the label T5 (located in the left temporal position on the cerebral cortex) has the highest prevalence with a total of twenty four occurrences.

Fig. 9
figure 9

Prevalence of the most important nodes (violet bars of the histograms) of the two selected recordings: a patient with generalized seizures, b patient with focal seizures

Once the most important node was determined from the histogram (that is, the node with the highest prevalence), and the sets \({k}_{J}\) and \({c}_{J}\) were determined we continue calculating the average Avg and standard deviation STD of their elements. Let us consider the diagrams shown in Figs. 10 and 11, which represent the results obtained during the whole recordings of the two selected patients with epilepsy. Figure 10 belongs to the patient diagnosed with generalized seizures, and Fig. 11 corresponds to the patient diagnosed with focal seizures. The horizontal axes of the figures are related to the time at which propagations occur, thereby these figures effectively represent the dynamics of propagation for each patient. The values of degree and clustering coefficient of the most important node (violet discs) tend to cluster about their average and get dispersed according to the standard deviation, which lie on the gray rectangle.

The violet disks in figures represent the most important node \(\omega _{\max }\). According to Fig. 10a, the average \(Avg=13.88\) and the standard deviation \(STD=0.78\) of the set \({k}_{J}\) for the first patient indicate that the most important node (in this case the node 10 associated with the EEG channel C3) tends to link to about 14 channels during seizures. On the other hand, Fig. 10b shows that the average \(Avg=0.77\) and the standard deviation \(STD=0.03\) of the set \({c}_{J}\) for the same patient specify that 77% of the neighboring channels to the most important node tend to link each other.

Fig. 10
figure 10

Dynamics of important nodes (blue discs) and the most important node (violet discs) of a patient diagnosed with generalized seizures. a Degree of nodes from the set \({k}_{J}\), and b clustering coefficient from the set \({c}_{J}\)

Similarly, in Fig. 11a, the average \(Avg=7.79\) and the standard deviation \(STD=2.2\) of the set \({k}_{J}\) indicate that the most important node (in this case, the node 4 corresponding to the EEG channel T5) tends to connect with about eight channels during seizures. In Fig. 11b, we observe that the average \(Avg=0.51\) and the standard deviation \(STD=0.16\) of the set \({c}_{J}\) indicate that 51% of the neighboring channels to the most important node tend to link each other.

Fig. 11
figure 11

Dynamics of important nodes (blue discs) and the most important node (violet discs) of a patient diagnosed with focal seizures. a Degree of nodes from set \({k}_{J}\), and b clustering coefficient from set \({c}_{J}\)

This methodology was carried out on the EEG recordings of the thirteen patients diagnosed with epilepsy. The results of the most important nodes are shown in Table 6, while Table 7 summarizes the results of the relevant channels identified with this methodology.

Table 6 Degree and clustering coefficient of the most important nodes
Table 7 Summary results of important channels

5 Discussion

Definitions of epileptogenic zone, seizure focus and epileptic focus remain complex and elusive. Sometimes epileptogenic zone and seizure focus can be considered as equivalent [29]. The zone where seizures begin and the SOZ can be the same. Sometimes these regions are located in the zone where the most ictal activity occurs. Also, these concepts may correspond to different regions on the cerebral cortex. For this reason, it is possible that ChCB and ChMC (see Table 3) correspond to different locations on the cerebral cortex. However, these channels can be considered as the epileptogenic zone only if they are contiguous [29]. Moreover, it is possible that ChCB and ChMC can be located in the same channel.

With the aim of identifying a source of seizures, the works considered in the introduction describe methodologies to search for each region separately. For instance, the works [9] and [39] are aimed to detect on the one hand the SOZ by assuming that seizures get triggered in this region; and on the other hand, to determine the directionality of the frequencies with higher coherence from the SOZ to other parts of the brain. Similarly, the works [44, 45] are focused on determining the functional connectivity patterns obtained from IEEG and EEG recordings, which reveal information on the dynamics of a brain suffering epilepsy that can be used to localize the SOZ. In these three works, only one region associated with the epileptic focus can be found. Moreover, in all cases, the identification of ictal events in the recordings was performed only by specialists.

The epileptogenic zone, seizure focus, SOZ, and the zone where seizures begin can be considered equivalent [29]. By considering the specific characteristics of the several kinds of epileptic patterns in EEG signals, the first algorithm (ictal activity analysis) of the present work provides the time and places at which seizures begin. This information could be crucial to the neurologist. Also, we can determine the EEG channels with the highest ictal activity and its prevalence with respect to the whole recording. Furthermore, attenuations can also be identified since these behaviors display characteristics of low fast activity, which is considered as an EEG ictal pattern. This activity has been observed during epileptic focal seizures, generally occurring at the SOZ [25, 47]. Therefore, by identifying where the low fast activity is located would lead to associate the location of this behavior with the locations of other seizure patterns.

Given that there is no official minimum time to define seizures [29], the first algorithm also allows us to identify abnormal transients that can be related to epilepsy. Hence, repetitions of abnormal behaviors lasting less than 3 s can be identified and analyzed individually.

The methods used in this work to identify crises were designed on the basis of the thresholds and conditions defined on updated standards and clinical guidelines. For this reasons, it was possible to detect all of the events automatically, i.e., without supervision of the specialist. It is worth mentioning that no artificial intelligence techniques were used at all for this purpose along this paper.

With respect to the second algorithm (seizure propagation analysis), the results on the locations at which propagations occur show that it is possible to identify which epoch or stimulus during the acquisition protocol (like open-closed eyes, hyperventilation, sleep among others) involves a higher number of channels during the seizures, as shown in Fig. 8. Note that the bottom margins of Figs. 8a, b show the instants at which the different epochs were presented during the recording.

Regarding the propagation of seizures, the work [48] based on electrocorticography (EcoG) recordings, implemented a betweenness centrality measurement to identify the critical nodes of networks during both ictal and interictal states; however, in order to identify ictal events, they used an algorithm developed by [37] to reduce artifacts in EEG signals. Next, the selection of ictal events was made visually with a sample consisting of 65 events of ictal and interictal periods with length of 5 minutes. Unlike the mentioned work [48], in order to identify the most important node, we analyzed a total of 762 crises (all of them automatically identified) with different lengths. On the other hand, in the work [28], it is calculated the number of links per node to identify which one had the highest degree during awake, asleep and seizure stages. It has been assumed that the node with the highest degree is that which plays an important role in the dynamics of seizures in the brain. Indeed the node with the highest degree is the one that is most connected with others, but sometimes the most important node is not the same than the one with highest degree.

In the works [48] and [28], the graph theory was applied to analyze the cortical networks and to identify the nodes through which information travels. Unlike these two works, our second algorithm analyzes the seizures involving more than two channels under a complex network approach. More specifically, we created a network for each seizure and implemented a betweenness centrality measurement by which the important nodes were identified. In this way, the degree \(k_{v}\) and clustering coefficient \(C_{v}\) of the important nodes were calculated.

Based on the definitions of shortest path and betweenness centrality, we deduced that during seizures, the most important node represents the channel through which seizures propagate to the others. In addition, the degree of the most important node indicates the number of synchronized channels that involve it, and the clustering coefficient offers an estimation of the level of synchronization that exist between its neighboring EEG channels. An example of this is depicted in Fig. 12a, where the arrows represent the links between the most important node (the red one) and its neighbors (the blue nodes). In Fig. 12b, the blue disks linked by arcs represent the neighbors to the most important node that connect each other.

Fig. 12
figure 12

Physical sense of the clustering coefficient and degree of the most important node. a The EEG channel F7 has a degree of 8.5882, which implies a synchronization with at least 8 EEG channels. b The clustering coefficient of the same EEG channel is 0.5102, which means that at least 50% of the neighboring nodes to F7 are synchronized each other

The present work is mainly focused on analyzing the dynamics of the epileptic seizures as well as their spatial location on the cerebral cortex. On considering that links represent the correlations between nodes, the betweeness centrality represents the level of influence that a node has on the flow of information in a graph. The most important node possesses the highest prevalence. Hence, the degree \(k_{v}\) and clustering coefficient \(C_{v}\) of the most important node stand as reliable tools to identify the EEG channels through which seizures spread, and this information can be used to improve the identification of the epileptic focus.

6 Concluding remarks

The first algorithm proposed in this work identifies all the segments of crises, attenuations and all abnormal behaviors, which are counted in their respective EEG channels. With this information it is possible to identify: (i) the EEG channels where seizures begin; (ii) the EEG channels with the more lasting crises; (iii) the EEG channel with the greatest number of crises and the prevalence of these events during the whole recordings; (iv) the EEG channel with the greatest number of attenuations, and also their prevalence; (v) the EEG channel with the greatest number of abnormal transients; and (vi) the instant at which propagations occur as well the epoch of the EEG recording with the higher number of involved EEG channels during seizures. Regarding to point (iii), it is worth mentioning that the patients \(E-4\), \(E-5\) and \(E-10\) presented more than 100 crises because, in these patients, the recurrent presence of short-term crises of 3 and 4 s predominates.

Our methodology splits the signals from the 19 EEG channels into segments where propagations occur, and analyzes the level of synchronization among the EEG channels during the seizures with a complex network approach. The links between nodes were established depending on their level of correlation. More precisely, condition (1) determines if a link is established in a n-th network. This condition implies that correlation values lie in the interval \(I_{n}\). Otherwise, if correlation is below the standard deviation (that is, inside the interval \(\widehat{I}_{n}\)), (3) governs the creation of links.

After analyzing 762 networks, which were generated from all identified ictal events in the total of EEG recordings, up to 48307 links were generated according to condition (2), and six links according to condition (4). Therefore, our approach leads to generate fully connected networks, which implies that no disconnected regions of the brain exist. Furthermore, with the implementation of the concepts of cross-correlation, shortest path, and betweenness centrality, it was possible to identify which EEG channels are more likely related to the propagation of seizures. Indeed, the important EEG channels through which propagations occur and the most important node (which corresponds to the node with the highest prevalence during the whole recording) can be well-identified. This leads us to conclude that the most important node is that which is highly connected with its neighbors, which link each other during the propagation of the seizures.

Finally, with the joint work of our algorithms, it is possible to identify in the cerebral cortex the regions that satisfy the characteristics of the epileptic focus, that is, the channels in the EEG recordings where attenuations, seizures and abnormal activity occur. Moreover, it is possible to determine the EEG channels through which seizures spread and the way these events occur. Also, it is possible to verify if the identified EEG channels are located in adjoint regions on the cortex. Once the regions that involve the epileptic focus are identified, it is possible to accomplish deeper studies of the electrical activity from this region of the brain.

Depending on the location of the important channels, the results listed in Table 7 could let the neurologist discard a certain area of the cortex as epileptic focus if it does not satisfy the condition of adjacency of the channels, and improve his diagnosis. We stress that this work is not intended to be an automatic clinical diagnostic tool for a patient, but all the information obtained by our methodology may lead the medical specialist to link the behavior of the EEG channels where the greatest ictal activity occurs with the EEG channels through which this activity spreads. The medical specialist can also take into account the additional information on the EEG channels where attenuations and abnormal transients occur, since sometimes attenuations precede crises [27].