# Territorial Development as an Innovation Driver: A Complex Network Approach
## 2 Materials and Methods
### Unveiling Groups of Similar Countries  
The process of community detection must consider the fact that both positive and negative edge weights are involved in the network. Therefore, we used algorithms that are suitable to handle signed weights [45], such as Spin Glass, based on concepts of statistical mechanics [53; 54], and Leiden [55].  
For both the considered algorithms, we performed a hierarchical community detection by recursive partitioning, following a procedure explored in Refs. [26; 56; 57]. In this multi-step process, we applied subsequent detection algorithms to find a subdivision of communities coming from the previous stage. The procedure stopped when an iteration condition, determined by the accordance between outputs of different runs of the algorithm, was no longer satisfied. The pipeline followed by each detection step was not entirely deterministic, thus providing, in general, different outputs when applied to the same network; however, when community detection is robust, the outcome should be as independent as possible from randomness. Moreover, the output of community detection also depends on the choice of the Spin Glass or Leiden algorithm parameters.  
Accordingly, in order to choose the right parameters for the community detection algorithms and obtain consistent communities, we followed this criterion: we used one of the chosen algorithms to partition the network 100 times; if the same outcome occurred in at least 90% of cases, that partition was accepted, and recursive partitioning proceeded to the next step; otherwise, the iteration stopped, and the partition found at the previous level was accepted as the final result. The method was performed with both community detection algorithms through an accurate exploration of the space of their parameters: the choice of parameters was determined by the request of output consistency and robustness with respect to parameter variations. In particular, the relevant parameters that were varied in the Spin Glass algorithm were the _resolution_\(\gamma\) and the _cooling factor_: we considered \(\gamma\) ranging in the interval \([0.5,1.5]\), with a 0.1 step, and cooling factor in \([0.1,0.9]\) with a 0.1 step, besides the extreme values 0.01 and 0.99. In the Leiden algorithm, we varied the resolution \(\gamma\) as well as the _randomness_\(\beta\). The resolution varied in the same range as for Spin Glass, while \(\beta\) ranged in \([0.01,1]\) with a 0.01 step, besides the extreme 0.001.  
Figure 2: Similarity network of StartupBlink countries based on the values of their WDIs. Link colors are related to their weight, in ascending order from yellow to red. Only edges whose weight is equal to or greater than 0.70 are reported.  
We analyzed the performance of the community detection algorithms upon varying parameters by monitoring the behaviour of three quantities:  
* _Percentage of agreement_, computed, for a given set of parameters, as the ratio between the number of occurrences of the most common network partition and the total number of runs of the algorithm;
* _Number of communities_ in the most common partition;
* the _Inverse participation ratio (IPR)_ in the most common partition, defined, for a partition in \(K\) subsets of a network with \(N\) nodes, as \[IPR=\frac{1}{\sum_{i=1}^{K}\left(\frac{n_{i}}{N}\right)^{2}}\] (1) with \((n_{1},n_{2},\ldots,n_{K})\) being the cardinalities of each subset. The \(IPR\) is a mathematical tool to evaluate the number of communities among which the considered network is \"effectively\" shared, discarding communities with a very small quantity of nodes; for example, a partition in \(K=4\) communities of a network of \(N=160\) nodes is characterized by \(IPR=4\) if \(n_{1}=n_{2}=n_{3}=n_{4}=40\), while a partition with cardinalities (\(n_{1}=50;n_{2}=60\); \(n_{3}=9\); \(n_{4}=1\)) yields \(IPR=2.329\), much closer to 2 than to 4.