A Simulation Tool for Exploring the Evolution of Temporal Interbank Networks

The topology of the interbank market plays a crucial role during a crisis, a ecting the spreading or absorption of financial shock. The structure of an interbank network changes in the process of its evolution because of the interbank interactions and the interactions between banks and customers. To simulate a temporal interbank network, it is necessary to set an initial state and an evolution law for the topology and system entities. Because of the complex interplay between the network topology and the bank states, the stability of a temporal interbank network is generally unpredictable, even if all parameters and rules of interactions are known. In this paper, we present a simulation tool for temporal interbank networks aimed at exploring the different drivers contributing to evolutionary dynamics of banking networks. We describe a general-simulation scheme for temporal interbank networks and incorporate the creation and rewiring of edges because of the counter-party choices with the deletion of nodes and edges in case of a bank default. An example of the implementation of the general scheme is also presented and include models of banks and customers, strategies of counter-party choice, and clearing algorithms. Toperformaqualitative andquantitative study of the evolutionary process, the proposed simulation tool supports the calculation of di erent topological and stabilitymetrics and visualization of network evolution. The experimental study demonstrates (i) an illustrative example of the application of the simulation tool for synthetic networks while varying the counter-party choice policies and parameters of nodes and edges, and (ii) an investigation of the computational complexity and scalability of the simulation scheme.


Introduction
. The networks of interacting entities have been of great interest in complex system analysis, since complex systems demonstrate emergent behavior that cannot be trivially predicted. Network dynamics in self-organized systems is determined by agents' behavior, whereas the states of the agents o en depend on local topological characteristics. This co-evolution of the states of nodes and the network usually demonstrates unpredictable behavior due to the presence of cascades of feedback links, which are di icult to observe. In this way, along with the evolution law, the network topology significantly a ects the resulting stability of a system. .
Interconnections between the network topology and domain properties of a system were studied from static (Dörfler et al. ; Roukny et al. ) and dynamic perspectives (Ahnert & Fink ; Liu et al. ). The static perspective (when the network structure does not evolve over time) usually considers changes in the node states because of a dynamic process spreading on a fixed topology (Tambayong ). The result of process spreading may be estimated as positive or negative (e. g., spreading or absorbing some shock). In this way, tipping points in the system parameters may be discovered (Dorogovtsev et al. ). Numerous economic studies on the topology of interbank networks emphasize its role in times of crisis (Gupta et al. ; Haldane . The evolution law of a banking system with several evolutionary drivers (this law describes the emergent behavior of a system owing to interactions of di erent entities per the predefined rules) seems to be too complex to be presented mathematically. In addition, making precise models may be inappropriate since "state-of-the-art is evolving over time" and models lose accuracy (Goodhart et al. ). The simulation solves several outlined issues. Existing simulators allow for establishment of a set of rules for the behavior of agents and for the study of the evolution of a network (Schaul ; Quax et al. ). Nevertheless, they are either too general to analyze the multi-factor formation of an interbank network (which is the goal of the simulation tool proposed in this paper) or to be oriented to other domains. Some of the simulators only allow simple integer states of agents (Schaul ) and do not support real-valued states or representing a state by a vector of parameters. Other tools are oriented to the described systems with ordinary di erential equations (Gorochowski et al. ). SEECN, in the frame of DynaNet project (Sloot & Erenstein ), aims for the e icient simulation of complex-network dynamics. It considers each edge and node state as a vector that is processed by a function determining the evolution of a system. Nevertheless, it focuses on general-network dynamics and is inappropriate for exploring multi-factor mechanisms of interbank-network formation. The overwhelming majority of simulation tools do not allow the exploration of temporal complex networks (Rahman et al. ).
. To support the exploration of temporal networks on the di erent levels of granularity, corresponding simulation tools should have a modular structure allowing di erent representations of the main entities and functions of a system. The current study is intended to provide the tool oriented to the exploration of time-evolving interbank networks on the one hand, and, on the other hand, is su iciently generic to solve di erent kinds of problems (in contrast to the existing algorithms in the field that are designed to answer research questions) on the other hand. To do this, we use general domain-specific simulation scheme which can further be supplemented with any necessary algorithms for di erent steps of the scheme. These steps (which are required to update states of nodes and the topology of a network) may be "overloaded" (in terms of object-oriented programing) in a variety of ways to study di erent aspects of the behavior of a system. Thus, competitive simulation tool for temporal networks focus on two goals: (i) to maintain the specificity of a domain area, and (ii) to provide su icient flexibility, i.e., to support di erent models of network entities and algorithms of their interactions.
. This paper is dedicated to the design and implementation of the simulation tool for temporal networks encountered in interbank relations. We incorporated several driving forces specific for the formation of interbank networks into the generic model while supporting di erent implementations of the domain-specific algorithms such as strategies of counter-party choice. As an example of the problem that requires the usage of simulation tools for temporal interbank networks, one can consider the problem of finding the optimal regulation constraints leading to the formation of stable network topology under fixed conditions. The main di iculty in the problem is the absence of a general model able to determine how banks should choose counter-parties to obtain the preferable resulting topology. Therefore, a simulation tool with a set of tunable parameters, extensible banking network entity models, and di erent counter-party choice algorithms seems to be the most appropriate instrument to explore such kinds of problems.
. The evolution of a dynamic network results from edge (or/and node) addition, deletion, and rewiring. In terms of a banking system, each network modification type corresponds to an activity in a banking system, prevailing in di erent times. Edge addition results from the creation of interbank exposures triggered by the changes in bank portfolios, while an edge is deleted a er the loan term expires. Since both bank and customer activities a ect portfolio dynamics (an increase/decrease in assets or liabilities), we consider at least two driving forces as the simplest case. For example, banks interacting with customers more have their portfolio modified more frequently, and therefore interact more intensively with other banks. In this way, partner choice for both customers and banks a ects network-topology dynamics. Clearing algorithms, the algorithms of edge rewiring after bank defaults, and shock-contagion mechanisms also contribute to the topological dynamics. Additionally, the default-contagion mechanism, in terms of networks, is the deletion of a node corresponding to a default bank with the spread of residual shock among its neighbors. Depending on the shock size, contagion defaults can appear, which sometimes results in knock-on e ects (which are also called domino-e ects or avalanches). In addition, the removal of nodes (and consequently, the reduction in edge number) a ects most of the network invariants to a large extent. To explore the impact of all these factors on the resulting topology, we propose a general scheme to simulate the evolution of temporal interbank networks and the example of implementing this scheme based on particular models of network entities and the algorithms of network dynamics. As the interbank network structure has been shown to be especially important in times of crisis (Gai et al. ; Georg ; Grilli et al. ), the proposed simulation tool incorporates di erent stability metrics and topological metrics. The analysis of the evolution of an interbank network is additionally supported by the visualization tool. .
The rest of the paper is organized as follows. We present the general simulation scheme and the particular implementation of this, including the formalized description of modeling entities and algorithms of their interactions. As the proposed simulation tool has a modular structure, particular models and algorithms could be modified, extended, or supplemented to fit the reality in desirable extent and to provide a more comprehensive exploration per the goal of substantive studies. We further observe network topological invariants and stability metrics implemented in frames of the simulation tool to analyze the system structure and to evaluate evolutionary dynamics. The results of experiments for the artificial networks, while varying the counter-party choice algorithms and model parameters, and the results and conclusions on computational complexity and scalability of modeling algorithm are presented in the last section.

The Model Description
. Generally, the model of a system is a set of its internal and external entities (represented by nodes) and the list of relations between them (edges). For temporal networks, edges can disappear if they have a restricted lifetime, and can be added (with some certain attributes) by network agents when the agents optimize their states. Interbank network agents in particular tend to maximize their profit and minimize loss, during asset allocation, and satisfy regulatory restrictions, on other hand. Their state is described by a set of optimized variables. This is an example of how self-organization occurs in temporal networks.
. The current section describes the evolution model of a temporal network specialized for an interbank market. Summarizing the line of research on temporal interbank networks, we distinguish several common steps which could be performed during a single iteration of a simulation. Figure shows five components of a general simulation scheme that a ect the process of network formation. These components serve as a basis for the proposed simulation tool. First, the initial topology of an interbank network should be provided as an input for  Figure : The general simulation scheme: the parameters of evolution and how they a ect network formation. The parameters of network evolution are presented in detail later in the paper. G(0) is an initial topology of the interbank network, P c is the partner choice algorithm for a customer, P b is the partner choice algorithm for a bank, R is rewiring algorithm for the case of default, I(ia, il, ea, el) is an infusion vector for a bank depending on its state, and t I is an iteration of infusion. The bank state is represented with its balance sheet where iainterbank assets, il -interbank liabilities, ea -external assets, el -external liabilities.
the tool (step in Figure ). The topology can be created by the simulator (using existing network generative models) or provided by a user (for cases where real data are available). Also, the step of initialization includes the assignment of node states based on current network structure (see Figure , where a bank state is represented by its balance sheet).
Step creates edges between customers and banks; therefore, it is executed when the model includes customer-nodes which can borrow or lend from/to a bank. The number of customers for each iteration is supposed to be known. Each customer chooses a bank per the predefined partner-choice algorithm.
Step results in bank balance sheets being updated.
Step illustrates the similar step of partner choice for banks, which triggers interbank network formation per the predefined algorithm.
Step presents how edge redistribution is performed in the network a er a node elimination.
Step (fund infusion) represents the external influence on the system, which modifies node states and network topology in some evolution periods. As an example of such e ect, we present a central bank fund infusion aimed at stabilizing bank states if necessary. Generally, some other external factor or implementation of a central bank could be used instead. .
In this study, we present the implementation of the scheme, which generalizes the scheme presented by Guleva et al. ( ) and brings together several di erent models which contribute to the evolution of an interbank network. The detailed description of state parameters (parts of the models of a bank and a customer) and the algorithms used in the implementation are presented further in the current section. .
Each iteration of the simulation may result in di erent topologies and di erent states of nodes. Therefore, the system description is followed by a detailed description of metrics used for quantitatively estimating the changes.

The network model .
Typical interbank network models (Allen & Gale ; Gai & Kapadia ; Steinbacher et al. ) take banks as nodes and interbank lending as edges on a graph. This representation may be described as a graph (Gai et al. ; Georg ) or as the corresponding liability adjacency matrix (Boss et al. ; Upper ). Since the influence of both banks and customers is considered in our work, we suggest expanding the conventional interbank market model with two types of nodes and two corresponding subnetworks. Therefore, a banking network contains a set of banks, a set of customers, list of edges in the interbank network, and list of edges in the external network (consisting of the edges between banks and customers). Edges are directed and attributed with weights and maturities. The weight is the amount of money involved in the interaction represented by an edge. The amount of money can be a fixed constant or can be chosen randomly, and the maturity, which represents lifetime of an edge, can also be random. Namely, it presents how many iterations are performed before the edge disappears. Since lending is distinguished between di erent kinds of terms (Cox et al. ), we first choose the term group randomly, and then the final term of liability within the group is chosen. This may be varied depending on the banking system explored, because the maturity structure may di er (Kim & Singleton ; Smaga et al. ). .
Output links correspond to bank assets, and input links correspond to liabilities, as in Upper ( ) where adjacent matrix rows correspond to assets. In addition, each pair of banks can be connected with more than one edge regarding di erent attribute values.
. Therefore, the banking system is a dynamic directed multigraph with weights and maturities of edges: are the sets of bank nodes and customer nodes, respectively, w is the weight of an edge, and m is the maturity. If necessary, edges also can be attributed with interest rates. Nevertheless, in this report, we leave this possibility since we have no intention to follow the impact of each network formation driver and additional edge attributes complicate dynamics.

The bank model .
The bank model is presented by its balance sheet, which consists of interbank and external assets and liabilities and net worth, which is the di erence between the assets and liabilities. This structure allows for designing the default condition and the interrelation between external e ects on bank balances and interbank activity, which is necessary to avoid defaults. In addition, interbank interactions are well-defined in terms of network science, which is widely used in other studies (Gai & Kapadia ; Haldane & May ; Nier et al. ; Upper ) in more or less detailed variations. External assets and liabilities of a bank are formed by the output and input links from the external network, and interbank interactions are formed by the edges from the interbank network: The net worth determines the state variable s i of a bank in this model. The satisfactory lower bound of the state variable is s 0 . If s i < s 0 , then the process of creation of new interbank links is triggered. .
For the case of two variables characterizing the state of a bank, the balance sheet is extended with cash and operating cost parameters to demonstrate the dualism of bank optimizing policy. The model of the balance sheet with cash variable can be seen in Krause & Giansante ( ). While net worth (nw) tends to increase with a growth of asset size and decrease with a growth of liability size, cash (cash) demonstrates opposite monotony. Each bank needs to balance between net worth and cash values to have those both non-negative . An operating cost parameter (oc) indicates the value deducted from the cash on each iteration.
where cash t (b) is the current cash of bank b, oc(b) is the operational cost for bank b per iteration, cash t+1 (b) is the cash for the next iteration, and ∆ia(b) (and others) is the di erence in interbank asset values between iterations.

The customer model .
Existing customer models consider multiple factors of their decision making. These models describe the correlation between personal and other characteristics (Calem & Mester ) and are aimed at predicting consumers' decisions (Capon et al. ). In our current research, we are interested in a much simpler model, where borrowing and lending and their size are distinguished. Since we have not met up analogous in the literature, we use the following naive implementation. The customers represent firms and organizations. Each customer has an account (referred to as a customer's state -s c ), which corresponds to the total amount of money available. This amount determines the attributes of the edge created by a customer. If a customer's state is greater than δ, a threshold determining average necessary vital resources per customer, then an output link is produced; otherwise, an input link is produced. In this way, delta distinguishes customers who need resources and ones who have redundant resources. The weight of a new edge is proportional to the state value. Therefore, where c is a customer from the set of customers C, s c is the state of a customer c, δ is a boundary parameter, defining the lending frequency in the lending-borrowing process, b is a bank chosen for interaction, ζ is some normalizing parameter for customer activity regulation, and m is the maturity of an edge.

The model of network evolution .
A network evolution begins with an initial topology, which can be constructed by one of the following means: (a) according to complete empirical data, (b) reconstructed with empirical incomplete data of total interbank assets and liabilities and topological properties, or (c) constructed with graph generative models. Then, the network undergoes step-by-step changes a er the actions of customers and banks. Each bank may request a central bank for infusion of funds once during the simulation to avoid going bankrupt; in addition, failed banks are eliminated from the network, triggering the rewiring of edges. The structure of an interbank network is directly a ected by the counter-party choice algorithms. The weights and the maturities of edges influence the rapidity and the intensity of changes in the structure. The network structure may also be modified a er bankruptcies, since this initiates the rewiring of edges. In the case of bankruptcies, the processes of shock absorption or contagion within a given network can be observed. .
We describe the parameters determining the evolution of a temporal interbank network with the following septuple: where G(0) is the initial state of the system, P b and P c are counter-party choice policies for banks and customers, respectively. These policies define a rule per which a partner for interaction is chosen. According to the policies, one can determine which edges must be added to a network during steps and in Figure . New edges could also be added a er nodes elimination (algorithms representing step in Figure ). W is a set of weights that might be attributable to an edge, M is a set of possible maturity values, R is a policy of edge rewiring a er node elimination, and t I , I are the parameters of central bank infusion, where t I is the iteration of infusion, which represents the iteration a er which any bank may get an injection once during the simulation, and I is the function of the infusion size. Then, we obtain the algorithm of network evolution (Algorithm ).

The Counter-Party Choice Algorithms
.
The counter-party choice policies represent a method for banks or customers to choose a counter-party (a bank) for interaction. The implementation of these policies provides the realization of steps -in Figure . .
Let G be the set of all possible networks, P c be a customer choice policy, P b be a bank choice policy, and P a be a policy for any node type. Without loss of generality, the choice function P a is defined as follows: Algorithm The algorithm of network evolution Initialization : Generate G(0) : for each node n ∈ B(0) do : Evaluate ia 0 (n), il 0 (n) initialize bank states : end for Iteration actions : for t ← 1 to T do T -a maximum iteration value Customers interact with banks, creating edges in the external network : Choose the partner, see P c def in Section . : Add edge to the external network : end for Banks interact with banks, creating edges in the interbank network : for each node n ∈ B(t) do : while nw(n, t) < 0 do For several state variables optimize all of them Add edge to the external network : end while : end for Node elimination : for each node n ∈ B(t) do : if nw(n, t) < 0 or cash(n, t) < 0 then : G(t) ← R G(t), n Delete node using predefined algorithm of rewiring R. See for details Section . : end if : end for Fund infusion. : for each node n ∈ B(t) do : if t > t I and ∀t < t I n = 0 then : The direction of new edges for customer-bank interaction can be set randomly or can depend on the state of a customer. Namely, if customers have enough funds, they tend to lend; otherwise, they borrow from banks.
. Despite customer choice being mostly a ected by the image of the bank; the e iciency, quality, and speed of service; and interest rates (Siddique et al. ), we restrict ourselves to random and preferential models in this study, as they can form di erent types of topologies. In addition, the assortative method is also supported for the banks (banks with the high similarity measure values have greater probability to be connected). Therefore, we use random (R), preferential (P), and assortative (A) counter-party choice policies. Let p c (i) and p b (i) denote the probabilities that i th bank will be chosen for interaction by a customer and a bank, respectively. If the policy can be used by both banks and customers, then ∀a ∈ B ∪ C, ∀i ∈ B we denote the probability as p a (i). .
Random choice policies of a bank or a customer imply equal probabilities to choose any of banks, that is: Preferential choice policies imply that the probability of a bank to be chosen is proportional to the size of its asset. Therefore, where ea(i), ia(i) are external and interbank assets of bank i, respectively.
. Assortative policies provide a higher clustering coe icient in comparison to other types of policies. When assortative policy is used, the closest bank to a given bank (in terms of the distance between their asset values) is chosen to create the connection. This is applied only for banks because the assortative rules imply the comparison of the structures of bank balance sheets. Therefore, the probability of bank b to choose bank i is is the distance between banks j and b according to their asset sizes, since ia(j) + ea(j) is the asset size of bank j.
Edge Rewiring Algorithms: The Elimination of a Node. .
The algorithm of bank elimination (step in Figure ) significantly a ects the network evolution in times of avalanches. We assume funds to be redistributed between counter-parties in a pre-established way (according to one of the algorithms). Firms and banks, both, are considered during this process. According to generalized algorithm description (Algorithm ) all input and output edges adjacent to defaulted bank are sorted in corresponding lists and, a er that, each pair of top edges from the lists is replaced with an edge connecting the borrower and lender of a bankrupt. All agents from the bottom of the list, without counter-party assigned, are supposed to lose their funds. The resulting topology a er this procedure may vary, due to the weight and the maturity structure of edges linked to an eliminated bank. All the algorithms for edge rewiring implemented in this study are based on sorting input and output links of a bank, that went bankrupt. A er the sorted links are rewired between other banks, the balance sheets are updated. .
In this paper, we present the following sorting algorithms: (i) random (r),(ii) sorting per to lending repayment urgency (u), (iii) assortative and disassortative attachment (the algorithms and corresponding abbreviations are illustrated in Figure ).
. The first sorting method (i) keeps links in the order they were created. The second algorithm (ii) considers the maturity structure. It indicates the most urgent edges to be rewired first. In this way, the first banks from a liability list are linked to the first banks from the asset list. Therefore, assets and liabilities of a failed bank are sorted by their repayment dates. The third approach (iii) implies assortative and disassortative mixing. Edges are sorted by the asset size of the banks to which they are adjacent. Considering the link directions and both the straight and reverse orders of sorting, we obtain four possible mixing combinations: • The banks with the smallest assets go first in both input and output link lists (SS); • In the liability list, the bank with the largest asset goes first, while in the asset list, the bank with the largest assets goes last (LS); • The bank with the smallest assets goes first, and in the liability list, the smallest one goes last (SL). .
In the simplest case, when a default is associated with the negativity of net worth in the model, assets are less than liabilities. Consequently, a er rewiring there are some banks a ected by a shock, which may potentially trigger a cascade of defaults. Therefore, an algorithm of rewiring (Algorithm ) a ects possible losses.

Algorithm Rewiring a er default
Require: β -a bankrupt ID, G(t) -a graph : E out (β) ← output edges incident to β : E in (β) ← input edges incident to β : Sort E out Sort according to R. See Section . . : Sort E in Sort according to R. See Section . .
The mathematical formalism presented in current subsection intends to describe possible external impacts on node states a ecting topological dynamics. We consider central bank injections as an example of such influence. Despite central bank restrictions a ecting banking system evolution and significantly controlling it, we attempt to distinguish factors driving single bank policies over all simulation and factors a ecting network evolution in some certain periods, e.g. in times of crisis. Generally, this representation can be extended to more or less accurate central bank models or other external factors a ecting network formation, or redefined.
. The central bank infusions may prevent the triggering of node elimination, therefore complicating the evolution dynamics to some extent. If I(t) = I 1 (t), I 2 (t), . . . , I N (t) is an infusion vector at the iteration t, then, for all banks b ∈ B(t), that means cash(b, t) = cash(b, t − 1) + I b (t), which allows the bank to increase the asset size in the near future.
. Central bank infusion is a fund that may be injected to a bank at some moment during modeling. This is allowed once for each bank during simulation. We implement infusion depending on the iteration and size of infusion. The first parameter, an iteration of infusion t I , means that infusion cannot occur before this moment. The second parameter is a function of infusion size, which takes the bank balance sheet values as input and returns the desired infusion size for the bank.
. Let t I , I be infusion parameters, where t I is an iteration of infusion, and the function determining the size of the desired infusion for some bank b is defined as I : R 4 → R. This takes as input the real number values of its balance sheet ia(b, t), il(b, t), ea(b, t), el(b, t) and returns the desirable infusion size for a bank.
. Therefore, the infusion vector describing injections for all banks and all iterations can be defined as follows: The scheme of sorting and rewiring for the node elimination algorithm. Because the negativity of net worth asset list is less than the liability list, some links disappear, and the corresponding banks may undergo a certain decline and trigger shock contagion. The following is an example of the possible results of edge rewiring: Let banks {b 1 , b 2 , . . . , b 5 } be connected with bank b 0 , which goes bankrupt at the current iteration. Each bank has asset values {a(b 1 ), a(b 2 ), . . . , a(b 5 )}, streamlined as a(b 1 ) < a(b 2 ) < a(b 3 ) ∧ a(b 4 ) < a(b 5 ) . The set of edges connecting these banks before the b 0 elimination is (b 2 , b 0 , w, m 3 ), (b 3 , b 0 , w, m 1 ), (b 1 , b 0 , w, m 2 ), (b 0 , b 4 , w, m 5 ), (b 0 , b 5 , w, m 4 ) . Let all edge weights be equal to 1 (w = 1), and the edge maturities are such that (m 1 < m 2 < m 3 ) ∧ (m 4 < m 5 ).
where N is the number of banks, and I j (t) =    I ia(j, t), il(j, t), ea(j, t), el(j, t) 0, ∀j ∈ B, t < t I 0, ∃t < t : I j (t 1 ) = 0 ( ) is the infusion size for some bank j ∈ B at iteration t. In this way, infusion is presented as a vector of fund injections per iteration.

Dynamics Evaluation: Metrics
. The topological dynamics are measured with the network invariants-namely, the average degree, average clustering coe icient, and average shortest path. These invariants are chosen since they are mostly used in empirical networks analysis and therefore there is more information regarding the corresponding values of real world networks. During the calculation of average degree, we consider the presence of multi-edges in a graph, so the degree is calculated as the sum of the weights of edges adjacent to a node. Literature on empirical interbank networks show the average degree to be about - ( ; Soramäki et al. ). Another topological metric, which is currently implemented in the simulation tool, the Entropy feature, was introduced by Ye et al. ( ). This is the entropy of graph Laplacian spectrum metric, and we used it since the Laplacian spectrum su iciently reflects network structure, as it is sensible for the change in the number of edges, reflects number of leaves, maximum degree, algebraic connectivity, and other properties (Merris ; Mohar et al. ). Applied to the network model of a banking system, it can be represented as follows: The qualitative state of the system can be estimated with the number of banks with negative net worth for the models without a mechanism of node elimination, and with the number of eliminated nodes for the models providing such a mechanism.
. To evaluate the dynamics of node states and the overall stability of a system, we use the metrics of velocity and remoteness of nodes from an unsatisfactory state, and the T -threatened set of nodes, which were introduced by Guleva ( a). An unsatisfactory (critical) state of a node is some value of a state variable, approaching to which indicates some additional dynamics, and, finally, the node elimination occurs. The definitions of velocity and remoteness are the following Guleva ( a): Let N be a number of nodes, let S(t) = (s 1 (t), ..., s N (t)) be a state of the network, where s i (t) is a node state at iteration t. Let s 0 be the critical state of a node for some model.
Definition Node velocity v i at iteration t determines the change of a node state per iteration and is defined as Definition Node remoteness r i at iteration t determines a number of iterations which is necessary for node of state s i (t) having the velocity v i (t) to reach the value of its critical state s 0 , and defined as Using the definitions above, the authors introduced the function reflecting the relative number of nodes approaching their critical state: Definition T -Threatened set of nodes D T (S) for the network of state S contains nodes having negative velocity and remoteness, which is less than T .
This set is aimed at recognizing when most of the nodes have negative dynamics and when the knock-on e ect can be induced with node-state dynamics more than with the network topology state. We consider the nodestate oriented features to distinguish cases when the topology does not have a significant contribution to the cascades of defaults. This means that mass bankruptcies may be triggered mostly by the gradual deterioration of node states rather than topological influences.

The Experimental Study
. ), we focused on reproducing driving forces and results of shock contagion for a simplified model rather than the nuanced investigation of evolution of real-world interbank network (such investigation is significantly hampered by the lack of necessary data, e. g. exact values of interbank liabilities and even the structure of a network itself). The model of temporal interbank networks presented above was used to implement the simulation tool supporting di erent realizations of steps -in the general simulation scheme (Figure ). The simulator was implemented with C# programming language. The source code is published (Guleva b) and available online (https://www.openabm.org/model/5285/version/1/view). Face validity, tracing, and internal validity methods were used for the model verification and validation (Xiang et al. ). Along with the general simulation algorithm, the current version of the simulation tool implements all particular algorithms introduced above, namely: • Generative models for artificial networks (the generative models of all widely used network types and the configuration model that generates a network from a given degree sequence are supported).
• The random, preferential and assortative counter-party choice algorithms.
• Algorithms for edge rewiring a er node elimination (see Figure ).
• An algorithm for central bank infusion.
• Algorithms to calculate topological and stability metrics.
. Additionally, output simulation data can be used as an input for the visualization tool which illustrates the evolution of network topology along with the changes of states of nodes and the parameters of systemic stability. These possibilities allow for the exploration of the influences of model parameters and combinations of algorithms on the co-evolution process of the topology and the state of a temporal interbank network. The goal of the experimental study was to demonstrate possible scenarios in which the simulation tool can be used for this co-evolution exploration. Thus, we illustrate its applications rather than provide the domain results in this study.
. The strengths of banking networks presented in the existing studies widely vary. This mainly depends on the types of banks being considered and on the completeness of the data. Building on empirical research of several banking systems we simulate networks with banks and 1, 000 ± 200 customers, representing firms for the illustrative examples. In addition, for scalability experiments the number of banks and customers are varied in ranges [100; 1000] and [1000; 10000], respectively. .
Since the properties of random, scale-free, and small-world structures are well studied, we consider the Erdos-Renyi (ER), Watts-Strogatz (WS), and Barabasi-Albert (BA) models for generating the initial topologies in the experimental study. Real-world interbank networks have been shown to demonstrate power-law degree distribution (Soramäki et al. ; Leonidov & Rumyantsev ). Generative models are used with the following parameters: k = 4 and p = 0.6 for Watts-Strogatz model, where k is the number of attached edges on each iteration and p is the probability of edge rewiring . For Barabasi-Albert, the number of edges attached to a new node on each iteration is 10. The unsatisfactory state for all the experiments was set to zero, s 0 = 0 (i.e. the negativity of the net worth triggers the creation of new interbank links). .
The simulation period is restricted with for all launches. For scenarios with node elimination, the simulation continues until degeneration (all nodes removed) and is about iterations on average. Namely, the number of iterations for considered scenarios is in the range [250; 500]. Each iteration corresponds to one day; nevertheless, scenarios can be scaled. The presented results are averaged for launches with binning, where the bin size is .
The results of experiments .
The first set of experiments with a simulation tool showed how it can be used to investigate the interplay of di erent counter-party choice policies for banks and customers (therefore this scenario considers two driving forces of network evolution). As Figure shows, the topological invariants converge to some certain values as the influence of other parameters on the topological evolution is minimized. In this section, we present results for the share of nodes with negative net worth as a qualitative metric (a number of default banks is not appropriate since the mechanism of nodes elimination is not considered) and three basic topological properties, namely, average degree, clustering coe icient, and average path length, since they are mostly mentioned in empirical interbank networks analyses. The minimum percentage of negative net worth a er the stabilization is observed when both policies of banks and customers uses preferential rule (see Figure c). Use of this policy also leads to the significantly slower increase of this percentage showing that the system as a whole is more stable. On the other hand, PP policy corresponds to the highest value of an average shortest path (Figure d Regarding topological features, average clustering coe icient and average degree are similar to empirical network properties; nevertheless, average path length is the most plausible for preferential algorithms of bank and customer partner choice. This is due to power law topology (which is formed as a result). In addition, this is consistent with the results of Georg ( ) that networks having more long average shortest path are more stable and show the least number of banks with negative net worth.
. One can see that preferential banking policy results in the most stable topology if it is only combined with preferential customer policy ( Figure c). Therefore, the regulation of only bank choice policy is not su icient to obtain an optimal network topology. Consequently, regulatory restrictions should be taken in accordance with the current values of system parameters. In addition, regulation should consider that equitable change of a topological property may a ect on system resilience to contagion non-linearly (Figure a,b). By using the observations on topological metrics during the process of evolution, one can formulate and check hypotheses regarding the interrelation of topological properties, algorithms of counter-party choice, and the resulting stability of an interbank network. .
The second set of experiments was intended to show how the simulation tool can be used to study the controllability of an interbank network. The goal of the experiment was to investigate the extent to which the counterparty choice algorithm influences the trajectory of a system state. To explore this, we change these policies at di erent iterations of simulation (denoted as i) and compare the resulting trajectories of a system. For the current set of experiments, Figure shows that the evolutionary process could be managed. As Figure shows, the case with assortative policy for banks has average clustering coe icient converging to 0.5. When we change this policy to random, the average clustering coe icient changes its trend and stabilizes at 0.25 (Figure a). Similar dynamics is observed for other topological invariants. Using this kind of scenario, one can observe how changing the di erent algorithms implementing steps -of general simulation scheme in Figure influences the topological invariants and the resulting stability of a system. .
The third set of experiments ( Figure ) demonstrates the case when system evolution is driven by a larger number of parameters (initial graph topology, bank and customer counter-party choice algorithms, rewiring algorithm for failed banks elimination, and fund infusion parameters), resulting in increased unpredictability of the behavior of a system. Figure shows how network evolution is a ected by the variation of infusion parameters, iteration and size, for the system with banks and customers, WS initial topology, and LL rewiring algorithm. Banks choose counter-parties randomly and customers choose them preferentially. The addition of parameters moves the values of graph invariants away from the common trend, they were converging to, since di erent drivers prevail for di erent periods of simulation. Figure demonstrates how dynamics may be changed with the modification of parameters in the system under more than two drivers. The chart depicting number of defaults (Figure a,d) can be divided into two parts, monotone (where no defaults occur) and increasing, with a tipping point between them. This dynamics can be explained with observations from other charts. A peak in the number of edges (Figure b,e) corresponds to a tip in default numbers. In addition, one can observe a sharp increase in the number of edges, iterations before the peak. The reason is that banks tend to create new interbank links to enhance their state. In this way, one can conclude banks worsened a er the 150 th iteration. A er the peak, the number of edges demonstrates dive, which occurs with an increase in the number of defaults and consequently with the number of nodes and edges adjacent to them. Infusion temporally delays the increase in default number, therefore we observe one more peak in the number of edges. It can thus be concluded, that Figures a and d, with the number of defaults, do not allow to understand the reasons of observed dynamics and single defaults in particular. On contrary, the analysis of topological properties evolution disclose events accompanying default cascades and presents additional information about their reasons. Figure : The convergence of topological invariants for the model with two driving parameters: the combinations of di erent bank and customer counter-party choice algorithms. AP -assortative bank choice, preferential customer choice, AR -assortative bank choice, random customer choice, P P -preferential both bank and customer choice, P R -preferential bank choice, random customer choice, RP -random bank choice, preferential customer choice, RR -random both bank and customer choice.   Figure : The visualization of interbank network evolution. The evolution is visualized from le to right and from top to bottom. The colored balls correspond to banks, while red balls correspond to failed banks. The color is designed according to node remoteness, the size of ball is proportional to bank asset size. The plot on the le -hand side reflect dynamics in the system, namely, number of failed banks, temperature, entropy and 400-threatened set. .
The increase in the number of driving forces lead the system away from "quasi steady state" and demonstrates more complex dynamics, which correlates with results presented by Delli Gatti & Desiderio ( ). The experiment with infusion size (Figure ) shows that the total amount of funds in the system determines the critical number of edges, which can be created in times of crises (Figure b,e). In this way, possible ranges of topological invariants are also restricted according to system properties (Figure c,f). A change of infusion iteration, τ I , does not a ect a final system state when other parameters are fixed. We specifically observe two states, a better and a worth, with τ I corresponding to the moment of transition between them (Figure a).

.
Finally, the data obtained during simulation may be visualized for a more tangible study. This facilitates the detection of reasons of di erent phenomena observed in the temporal interbank network. The visualization module was implemented to enrich the possibilities of proposed simulation tool. It can be used to visualize the entire process of network evolution with indication of nodes stability and di erent metrics of network dynamics. The example of visualization of interbank network evolution by means of the visualization module is demonstrated in Figure .

Scalability of results
.
To estimate the computational complexity of a model, one can sum estimates for di erent steps of simulation as they are performed sequentially. For the algorithms presented, it can be calculated as follows: where N c is number of customers, N b is number of banks, and E out , E in are the number of input and output edges incident to a bankrupt. .
We performed the simulation for the varying number of banks and customers. The results of simulation were averaged by runs. Figure illustrates the execution time of simulation algorithm for the fixed number of banks while varying the number of customers, and for the fixed number of customers with a variation of the number of banks (error bars represent standard deviations). The results demonstrate that the overall execution time of the simulation algorithm for the case of real-world banking networks will be mostly determined by a number of customers. To reduce the execution time of a simulation, a parallel version of simulation algorithm could be introduced.

Conclusion
. The paper presents a simulation tool for exploring the evolution of temporal interbank networks a ected by several driving forces. Di erent steps of the general simulation scheme (e.g. counter-party choices or bank elimination) can be implemented in a variety of ways increasing the applicability of the simulation tool. As an example of implementation of the general simulation scheme, we present the model of an interbank network with varying algorithms for: (i) generation of initial topology, (ii) counter-party choice, (iii) rewiring of edges a er removing the bank, and (iv) central bank infusion. To support the qualitative and quantitative investigation of simulation results, the proposed tool incorporates static and dynamic topological and stability metrics and the module of visualizing the results of simulation. .
The experimental study demonstrates the illustrative example of application of the simulation tool for the synthetic networks under the variation of algorithms (i)-(iv), and shows the results of scalability of the simulation algorithm with an increase of banks and customers. Topological properties were shown to be closely related to other system properties and, therefore, ranges of network invariants can be physically restricted according to them. Thus, bank regulation aiming at optimal network formation should consider these restrictions of a system. In addition, the successful change of a system trajectory can require multiple parameter changes. The mathematical evaluation of the optimal solutions in terms of systemic restrictions and variable number of parameters remains intractable. Our solution allows to observe the simulation of system evolution under di erent parameter configurations and their values, and evaluate system properties in dynamics.

.
In the future, we would like to extend this research for evaluation of regulatory restrictions, which are necessary for banks (in combination with other system components) for the formation of resilient network. In addition, further improvement of the tool may include incorporating the existing algorithms for the recovery of the structure of interbank networks using total assets and liabilities as input data (this allows exploring real-world networks) and parallelizing the general simulation scheme in order to reduce the overall simulation time. Figure : A snapshot of the animation of the simulation process.
The animation demonstrates interbank market evolution until the network disruption resulted from a default cascade. Node diameter corresponds to total asset value of a bank, color represents the number of iterations expected before its default (and shows their remoteness from the critical state). Charts on the le describe the system state and reflect dynamics of the number of failed banks and system characteristics (temperature and entropy of the graph Laplacian and share of nodes in T -Threatened set, characterizing changes in node states).
The animation shows there are no defaults in the beginning of modeling but nodes are orange, which is the sign of system instability despite the absence of bankruptcies. In addition, increase in bank assets is uncorrelated with expected moment of default, since this is dynamics of change a ecting node remoteness from a critical state. Negative dynamics, observed for the majority of nodes, give rise for default contagion ending with system degeneration.
The charts show the tipping point in the number of failed banks is anticipated by increase in T -Threatened set feature, that occur iterations before the cascade. At the same time, topological features considered are more correlated with edge deletion triggered by nodes elimination. In this way, one can notice the consideration of node state dynamics allows for the detection of systemic instabilities caused by node negative dynamics. In current case, this allows for the detection of reasons of "knock-on e ects" when insignificant financial shock occurs.

Also called dynamic networks and time-evolving networks
Here and further we mean some optimal topology which minimizes loss in the case of financial contagion Or follow other more sophisticated relation Compared with Laplacian matrix, the adjacency matrix spectrum is not so su icient, since cospectral matrices demonstrate di erent topological properties We intended the total number of customers per bank to be consistent with empirical results, but we also supposed their number to be proportional to bank total assets (Leonidov & Rumyantsev ). Thus, the total number of customers in the system can insignificantly di er from the desired one. The Austrian banking system contains about banks (Boss et al. ). The Russian banking system, according to data from to , contains about banks (Vandermarliere ), while the Fedwire system contains more than , participants (Soramäki et al. ). At the same time, the e-MID electronic market contains about banks (Iori et al. ), and there are banks involved in the Japanese banking system (Inaoka et al. ). Opportunities to obtain full data can be restricted; therefore, some studies are based on reduced data or consider networks with the largest banks of a system. Cajueiro & Tabak ( ) studied interbank networks with banks and non-bank financial organizations, and Montagna and Kok reviewed large EU banks (Montagna & Kok ), while (Leonidov & Rumyantsev ) considered the Russian interbank network with banks for the period from to . Delli Gatti et al. ( ) considered banks and firms in their simulations.
Regarding networks robustness, Boss et al. ( ) argue power-law networks to be more robust to random shocks, on the contrary, Lenzu & Tedeschi ( b) shown "random financial networks can be more resilient than a power law in case of agents heterogeneity". Georg ( ) demonstrated "networks with large average path length to be more resilient to financial distress".
The increase in rewiring probability (in WS model) lead to decrease in clustering coe icient and average path length. Therefore, small probability is not enough for obtaining small world, since it provides too large average path length. At the same time, there is a range of values, for which clustering is still large while path length is already small. Therefore, these parameters were taken to provide small-world structure and density properties. Network with nodes and k = 4 has appropriate density and at the same time p = 0.6 allows for relatively high clustering coe icient and quite enough average path length.