## 2 Materials and Methods
### Layer 1
The NEDS vectors associated with the columns of the matrix [CC] should be integrated into K classes: \[[CC]=\left[CC_{1}\quad CC_{2}\quad\cdots\quad CC_{n}\quad\cdots\quad CC_{N_{EDS}}\right]\] (5) \[CC_{n}=\left[CC_{n,1}\quad CC_{n,2}\quad\cdots\quad CC_{n,N_{EDS}}\right]_{t}, \ n=1,\ldots,N_{EDS}\] (6) where CC\({}_{n}\), n = 1, \(\ldots\), N\({}_{EDS}\), corresponds to the columns from the matrix [CC] including the correlation coefficients between the EDS n and the other EDSs from the EDNs and CC\({}_{n,N_{EDS}}\) represents a generic element from the column n, n = 1, \(\ldots\), N\({}_{EDS}\). 2. Determination of the maximum number in which the NEDS electric distribution substations can be distributed using the following relation [33]: \[K_{max}=\sqrt{N_{EDS}}\] (7)
3. The vectors CC\({}_{n}\), n = 1, \(\ldots\), N\({}_{EDS}\), will be randomly assigned in the K classes of the EDSs. 4. The centroids C\({}_{k}\), k = 1, \(\ldots\), K and K = 2, \(\ldots\), K\({}_{max}\), representing vectors with the size (N\({}_{EDS}\)x1) are calculated. \[C_{k}=\frac{1}{N_{EDS}}\sum\limits_{j=1}^{n}CC_{j}^{(k)}\] (8) where n\({}_{k}\)--the number of the EDSs from the classes k, k = 1, \(\ldots\), K and K = 2, \(\ldots\), K\({}_{max}\); CC\({}_{j}^{(k)}\)--the vector associated with an EDS, generically noted j inside the class k from partition K, K = 2, \(\ldots\), K\({}_{max}\). 5. The repartition of the EDSs in one of the K classes, K = 2, \(\ldots\), K\({}_{max}\), will be based on the minimisation of an objective function (OF) having the following expression: \[min(OF)=min\left(\sum\limits_{k=1}^{K}\sum\limits_{j=1}^{n_{k}}\left\|CC_{j}^{ (k)}-C_{k}\right\|^{2}\right)\] (9)
6. The positions of the C\({}_{k}\) centroids are re-adjusting through their recalculation using relation (8). In the case when all vectors CC\({}_{n}\), n = 1, \(\ldots\), N\({}_{EDS}\), are considered and re-labelled, Step 5 is repeated. 7. The silhouette coefficient for each partition K = 2, \(\ldots\), K\({}_{max}\), will be calculated using the following formula [34]: \[c_{s}{}^{(K)}=\frac{1}{N_{EDS}}\sum\limits_{i=1}^{N_{EDS}}\left(\frac{x_{i}- y_{i}}{max\{x_{i},y_{i}\}}\right),\ K=2,\ldots,K_{max}\] (10) \[ \begin{array}{ccc}\sum\limits_{j\in X}\ dist(v_{i},v_{j})&\sum\limits_{s\in Y }\ dist(v_{i},v_{j})\\ x_{i}=\frac{j\
eq i}{n_{X}-1}\ ;\ y_{i}=\underset{X\
eq Y}{min}\frac{j\
eq i}{n_{Y}} \\ \end{array} \] (11) where n\({}_{X}\) and n\({}_{Y}\)--the number of the vectors CC belonging to the EDSs from the classes X and Y associated with the partition K, K = 2, \(\ldots\), K\({}_{max}\); dist(v\({}_{i}\), v\({}_{j}\))--the distance calculated between the vectors v\({}_{i}\) and v\({}_{j}\) from the matrix [CC]. 8. The value of the silhouette coefficient SC(k) for each partition K = 2, \(\ldots\), K\({}_{max}\) is recorded in the vector [SC], and the maximum value is identified as follows: \[[c_{s}^{max},p^{max}]=max\{[\text{SC}]\}\] (12)where \({\rm c_{s}}^{\max}\) represents the maximum value of the silhouette coefficient; \({\rm p}^{\max}\) is the position from the vector [SC] where the maximum value has been identified. 9. Determination of the optimal partition containing \({\rm K_{opt}}\) classes: \[K_{opt}=p^{max}+1\] (13)