Networks
Network systems.
The package covers growth, turnover, ensembles, robustness, cascades, walks, diffusion, PageRank, structure, and percolation.
AttackInteraction(label, *, target='nodes', rate=0.01, targeted=True)
Bases: Interaction
Removal of the nodes of a network by random failures or by an attack on the nodes of the largest degree.
The degree of every node is read from the edges at the start of every step. Under random failures every node fails
with the probability rate per step, and under a targeted attack the nodes of the largest degree are removed, one
degree class per step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The nodes whose degrees the interaction sets and that fail. |
'nodes'
|
rate
|
float
|
The probability that a node fails in a step under random failures. |
0.01
|
targeted
|
bool
|
Whether the nodes of the largest degree are attacked, in place of random failures. |
True
|
Examples:
>>> from skcomplex.systems.mathematics.networks import AttackInteraction
>>> AttackInteraction('removal', targeted=False).targeted
False
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
219 220 221 222 223 | |
BarabasiAlbertSystem(*, edges=2, seed_nodes=3, fitness=False, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Barabási-Albert growth.
By preferential attachment the degrees follow a power law P(k) ~ k^-3.
The network starts complete on seed_nodes nodes, and every step one node joins with edges edges to nodes
drawn with probability proportional to their degree, so after t steps it holds seed_nodes + t nodes.
With fitness, every node draws a fitness eta uniformly in [0, 1] and new edges join nodes with probability
proportional to eta k, the model of Bianconi and Barabási (2001) that Raman (2021, section 3.2.4) describes. The
degree of a node then grows as t^beta(eta) with an exponent that rises with its fitness, so a fit late node
overtakes older ones. The system has the groups nodes and links and the arrival growth, and with fitness the
state nodes.fitness.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
int
|
The number of edges of every new node. |
2
|
seed_nodes
|
int
|
The number of nodes of the complete seed network. |
3
|
fitness
|
bool
|
Whether the nodes draw a fitness that scales their attachment, the Bianconi-Barabási model. |
False
|
random_state
|
int | Generator | None
|
The seed or generator of the fitness of the seed nodes. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import BarabasiAlbertSystem
>>> trajectory = BarabasiAlbertSystem().prepare().simulate(until=10, random_state=0)
>>> int(trajectory.get_network(-1).sources.size)
23
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
ClosingNodeElement(label, *, degree=0.0, space=None)
Bases: Element
Node of the Davidsen-Ebel-Bornholdt network, with its degree.
A map of the system reads the degree from the edges at the start of every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
degree
|
Annotated[float, closed_open(0, oo)]
|
The number of edges of the node. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import ClosingNodeElement
>>> ClosingNodeElement('nodes').degree
0.0
Source code in src/skcomplex/systems/mathematics/networks/_davidsen_ebel_bornholdt.py
53 54 55 56 57 58 59 60 61 | |
ClusterNodeElement(label, *, cluster_size=1.0, space=None)
Bases: Element
Node of a network with the number of nodes of its connected component.
A map of the system reads the size from the edges at the start of every step, so it holds the size of the component in the network the requests of the step before left.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
cluster_size
|
Annotated[float, closed_open(1, oo)]
|
The number of nodes of the connected component of the node. |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import ClusterNodeElement
>>> ClusterNodeElement('nodes').cluster_size
1.0
Source code in src/skcomplex/systems/mathematics/networks/_explosive.py
54 55 56 57 58 59 60 61 62 | |
ConfigurationModelSystem(degrees=None, *, n_nodes=1000, exponent=2.5, min_degree=2, simple=True, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The configuration model.
It is the maximally random network of a given degree sequence.
Every node gets as many half-links as its degree, and pairs of half-links drawn uniformly at random become links
(Jensen 2023, section 8.5.1, and Thurner et al. 2018, section 4.5.1). Without a degree sequence the degrees are
drawn from the power law P(k) ~ k^-exponent for k >= min_degree, cut at sqrt(n_nodes), and one half-link is
added to a random node when their sum is odd. The pairing leaves self-loops and multilinks, which the rewiring of
Thurner et al. removes while it keeps every degree. A neighbour has the mean degree <k²> / <k>, above the mean
degree, the friendship paradox. The system has the group nodes and their states degree and clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
degrees
|
Sequence[int] | None
|
The degree of every node, or |
None
|
n_nodes
|
int
|
The number of nodes of the drawn degrees. |
1000
|
exponent
|
float
|
The exponent of the power law of the drawn degrees. |
2.5
|
min_degree
|
int
|
The smallest drawn degree. |
2
|
simple
|
bool
|
Whether self-loops and multilinks are rewired away, or dropped, which lowers some degrees. |
True
|
random_state
|
int | Generator | None
|
The seed or generator of the degrees, the pairing, and the rewiring. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The degree sum of a given sequence is odd, or rewiring cannot make the graph simple. |
Examples:
>>> from skcomplex.systems.mathematics.networks import ConfigurationModelSystem
>>> system = ConfigurationModelSystem([3, 3, 2, 2, 2]).prepare().system_
>>> system.elements[0].degree.tolist()
[3.0, 3.0, 2.0, 2.0, 2.0]
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
CopyingVertexElement(label, *, age=0.0, degree=0.0, inverse=1.0, space=None)
Bases: VertexElement
Node of a vertex-copying network.
The node holds the inverse of its degree for the copying of its edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
age
|
float
|
The number of steps since the node joined. |
0.0
|
degree
|
float
|
The number of edges of the node. |
0.0
|
inverse
|
Annotated[float, closed_open(0, oo)]
|
The inverse of the degree, which only the neighbours of the node read. |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import CopyingVertexElement
>>> CopyingVertexElement('nodes').inverse
1.0
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
64 65 66 67 68 69 70 71 72 73 74 | |
DavidsenEbelBornholdtSystem(n_nodes=200, *, turnover=0.1, links=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Davidsen-Ebel-Bornholdt network.
Its triadic closure and node turnover give high clustering.
The network starts as an Erdős-Rényi graph of n_nodes nodes and links links, n_nodes by default. Every step a
node drawn uniformly joins two of its neighbours that are not yet joined, or, without such a pair, joins a node
drawn uniformly. Then, with probability turnover, a node drawn uniformly leaves with its links and a new node
takes its place with one link to a node drawn uniformly (Thurner et al. 2018, section 4.5.4.6). A closure always
adds one link, and a turnover removes a node of mean degree k and adds one link, so the steady state has the mean
degree k = 1 + 1 / turnover. Closing triangles keeps the clustering high, and since a node lies near many others
in proportion to its degree, closure attaches preferentially, so hubs emerge as the turnover falls. The system has
the groups nodes and links, the closure closure, and the turnover turnover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
200
|
turnover
|
float
|
The probability that a node is replaced at a step. |
0.1
|
links
|
int | None
|
The number of links of the initial Erdős-Rényi graph, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the initial graph. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import DavidsenEbelBornholdtSystem
>>> trajectory = DavidsenEbelBornholdtSystem(50).prepare().simulate(until=20, random_state=0)
>>> len(trajectory.get_network(-1).nodes)
50
Source code in src/skcomplex/systems/mathematics/networks/_davidsen_ebel_bornholdt.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
DependentNodeElement(label, *, active=1.0, space=None)
Bases: Element
Nodes of two interdependent networks, each functional or not by its value active.
A node stands for a pair of nodes, one of each network, that depend on each other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the nodes. |
required |
active
|
Annotated[object, FiniteEnumeratedSet([0, 1])]
|
Whether a node is functional, 1 or 0, one per node or shared. |
1.0
|
space
|
BaseSpace | None
|
The network of two layers with one node per site, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import DependentNodeElement
>>> DependentNodeElement('nodes', active=0.0).active
0.0
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
62 63 64 65 66 67 68 69 70 | |
DuplicatingNodeElement(label, *, degree=0.0, space=None)
Bases: Element
Node of the duplication-deletion network, with its degree.
A map of the system reads the degree from the edges at the start of every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
degree
|
Annotated[float, closed_open(0, oo)]
|
The number of edges of the node. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import DuplicatingNodeElement
>>> DuplicatingNodeElement('nodes').degree
0.0
Source code in src/skcomplex/systems/mathematics/networks/_duplication_deletion.py
53 54 55 56 57 58 59 60 61 | |
DuplicationDeletionSystem(n_nodes=100, *, kill=1.0, inherit=0.5, parent=0.5, new=0.01, density=0.05, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The steady-state duplication-deletion network of Jensen.
Its connectance settles at Eq. 8.84.
The network starts as an Erdős-Rényi graph of n_nodes nodes and the link probability density. Every step a node
drawn uniformly leaves with its links with probability kill, and a parent drawn uniformly among the nodes left is
duplicated: the offspring inherits each link of the parent with probability inherit, joins the parent with
probability parent, and joins every node the parent does not join with probability new (Jensen 2023, section
8.5.1). With kill = 1 the network keeps N nodes, and its connectance converges to
C = (new (N - 2) + parent) / (N - 1 + (new - inherit) (N - 2)), Eq. 8.84. Accurate duplication, with inherit
near 1 and new near 0, turns the binomial degrees of noisy duplication into a cut-off power law. With kill < 1
the network grows by 1 - kill nodes per step on average.
The system has the groups nodes and links, the deletion death, and the duplication birth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
100
|
kill
|
float
|
The probability that the drawn node leaves at a step. |
1.0
|
inherit
|
float
|
The probability that the offspring inherits a link of its parent. |
0.5
|
parent
|
float
|
The probability that the offspring joins its parent. |
0.5
|
new
|
float
|
The probability that the offspring joins a node its parent does not join. |
0.01
|
density
|
float
|
The link probability of the initial Erdős-Rényi graph. |
0.05
|
random_state
|
int | Generator | None
|
The seed or generator of the initial graph. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import DuplicationDeletionSystem
>>> trajectory = DuplicationDeletionSystem(30).prepare().simulate(until=20, random_state=0)
>>> len(trajectory.get_network(-1).nodes)
30
Source code in src/skcomplex/systems/mathematics/networks/_duplication_deletion.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
EnsembleNodeElement(label, *, degree=0.0, rate=0.0, space=None)
Bases: Element
Node of a random graph, with its degree and its probability to add an edge.
The edge goes to a random node, once per step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
degree
|
Annotated[float, closed_open(0, oo)]
|
The number of edges of the node, read at the start of every step. |
0.0
|
rate
|
Annotated[float, closed_open(0, oo)]
|
The probability that the node adds an edge to a random node in a step. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import EnsembleNodeElement
>>> EnsembleNodeElement('nodes', rate=0.1).rate
0.1
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
145 146 147 148 149 150 151 152 153 154 155 | |
ExplosivePercolationSystem(n_nodes=1000, *, candidates=2, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Explosive percolation.
The Achlioptas product rule delays and sharpens the giant component.
The network starts with n_nodes isolated nodes, and every step adds one edge. It draws candidates edges, each
between two distinct nodes not yet joined drawn uniformly, and adds the one whose product of the sizes of the
components it joins is smallest, the product rule of Achlioptas, D'Souza, and Spencer (2009). A map reads the size
of the component of every node at the start of every step. With one candidate the edges are those of an Erdős-Rényi
graph, whose giant component grows continuously from t = 1/2 edges per node. With two candidates the rule
suppresses large components until the giant component jumps in a narrow window near t = 0.888. The system has the
size of the component of every node nodes.cluster_size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
1000
|
candidates
|
int
|
The number of candidate edges of every step. |
2
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import ExplosivePercolationSystem
>>> trajectory = ExplosivePercolationSystem(100).prepare().simulate(until=50, random_state=0)
>>> len(trajectory.get_network(-1).sources)
50
Source code in src/skcomplex/systems/mathematics/networks/_explosive.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
FailingElement(label, *, degree=0.0, space=None)
Bases: Element
Nodes of a network under failures or attacks, each with its degree degree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the nodes. |
required |
degree
|
Annotated[object, closed_open(0, oo)]
|
The initial number of edges of every node, one per node or shared. |
0.0
|
space
|
BaseSpace | None
|
The network with one node per site, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import FailingElement
>>> FailingElement('nodes', degree=3.0).degree
3.0
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
179 180 181 182 183 184 185 186 187 | |
FitnessVertexElement(label, *, age=0.0, degree=0.0, fitness=1.0, space=None)
Bases: VertexElement
Node of a growing network with an intrinsic fitness.
The fitness scales its chance to win new edges.
A new edge joins the node with probability proportional to its fitness times its degree, as in the model of Bianconi and Barabási. The fitness is drawn when the node joins and stays fixed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
age
|
float
|
The number of steps since the node joined. |
0.0
|
degree
|
float
|
The number of edges of the node. |
0.0
|
fitness
|
Annotated[object, closed_open(0, oo)]
|
The fitness of the node. |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import FitnessVertexElement
>>> FitnessVertexElement('nodes', fitness=0.5).fitness
0.5
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
107 108 109 110 111 112 113 114 115 116 117 | |
GiantComponentInteraction(label, *, nodes, links, phase=None)
Bases: Interaction
Activity of every node in its phase.
The activity is 1 in the giant component of the active links and 0 outside it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
nodes
|
Role
|
The path of the group on the nodes, whose activity the interaction sets. |
required |
links
|
Role
|
The path of the group on the edges, whose activity selects the links of the components. |
required |
phase
|
str | None
|
The phase of the step the interaction runs in, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import GiantComponentInteraction
>>> GiantComponentInteraction('percolation', nodes='nodes', links='links').links
'links'
Source code in src/skcomplex/systems/mathematics/networks/_triadic.py
95 96 97 98 99 100 101 102 103 104 105 106 | |
GraphletArrivalSystem(*, alpha=0.3, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Growth by the arrival of three-node graphlets.
The tree has a degree exponent that rises with alpha.
The network starts from one edge, and every step a graphlet of a central node and two peripheral nodes joined to it
arrives and merges one of its nodes with an existing node drawn with probability proportional to its degree: a
peripheral node with probability alpha, so the existing node gains the central node, which carries the other
peripheral node, and the central node otherwise, so the existing node gains both peripheral nodes (Filkov et al.
2009, as Raman 2021, section 3.2.4.2, describes). Every step adds two nodes and two edges, and the shares of nodes
of degree 1 and 2 are 2 (2 - alpha) / 5 and alpha (7 - alpha) / 15. The system has the groups nodes and
links and the arrivals growth and graphlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
The probability that the graphlet attaches by a peripheral node. |
0.3
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import GraphletArrivalSystem
>>> trajectory = GraphletArrivalSystem().prepare().simulate(until=10, random_state=0)
>>> int(trajectory.get_network(-1).nodes.size), int(trajectory.get_network(-1).sources.size)
(22, 21)
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
695 696 697 698 699 700 701 702 703 704 | |
GrowingSimplicialComplexSystem(*, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A simplicial complex that grows by gluing one triangle per step along an edge.
The edge is drawn uniformly.
The complex starts as one triangle, and every step one node joins and forms a triangle with the ends of an edge
drawn uniformly, adding two edges, as the network geometry with flavor s = 0 of Bianconi and Rahmede in two
dimensions. A node gains triangles in proportion to its degree, so the degrees follow the power law P(k) ~ k^-3 of
preferential attachment, and every triangle ages by one per step. The system has the groups nodes, links, and
triangles, and the arrival growth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import GrowingSimplicialComplexSystem
>>> trajectory = GrowingSimplicialComplexSystem().prepare().simulate(until=10, random_state=0)
>>> trajectory.get_network(-1).hyperedges.shape
(11, 3)
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
299 300 301 302 303 304 305 306 | |
HolmeKimSystem(*, edges=3, triad=0.8, seed_nodes=4, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Holme-Kim growth.
The network is scale-free like Barabási-Albert growth but with clustering that stays high.
Every step a node joins with one edge by preferential attachment, and the next step it adds edges - 1 edges, each
to a neighbour of its first contact with probability triad, closing a triangle, and by preferential attachment
otherwise. The system has the groups nodes and links and the arrival growth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
int
|
The number of edges of every new node. |
3
|
triad
|
float
|
The probability that an added edge closes a triangle. |
0.8
|
seed_nodes
|
int
|
The number of nodes of the complete seed network. |
4
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import HolmeKimSystem
>>> type(HolmeKimSystem().prepare().system_.elements[0]).__name__
'TriadVertexElement'
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
HypergraphRandomWalkSystem(hypergraph=None, *, source=0, seed=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The size-biased random walk on a hypergraph, p_j' = sum_i p_i T_ij - p_j.
The walk starts from one node.
A walker at node i moves to node j at rate T_ij = k_ij / sum_l k_il, with k_ij = sum_e (|e| - 1) e_i e_j
over the hyperedges e of the incidence matrix, so large hyperedges carry more of the walk, as in Carletti et al.
The probability of the walker spreads from the source, keeps its sum of 1, and settles on the stationary
distribution p_i = D_i / sum_l D_l, with D_i = sum_e (|e| - 1)^2 e_i the weight of the hyperedges of i. The
system has the probabilities nodes.p and the weights nodes.D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hypergraph
|
Hypergraph | None
|
The XGI hypergraph, or |
None
|
source
|
int
|
The node the walker starts at. |
0
|
seed
|
int
|
The seed of the random hypergraph. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import xgi
>>> from skcomplex.systems.mathematics.networks import HypergraphRandomWalkSystem
>>> system = HypergraphRandomWalkSystem(xgi.Hypergraph([[0, 1, 2], [2, 3]])).prepare().system_
>>> system.elements[0].D.tolist()
[4.0, 4.0, 5.0, 1.0]
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
InterdependenceInteraction(label, *, target='nodes', layer='dependent')
Bases: Interaction
Failure of every node that leaves the giant component of the functional nodes of either network.
The steps alternate between the two networks: even steps keep the nodes of the giant component of the graph of the
network, and odd steps those of the giant component of the layer layer, among the nodes functional so far.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The nodes whose values |
'nodes'
|
layer
|
str
|
The name of the layer of the second network. |
'dependent'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import InterdependenceInteraction
>>> InterdependenceInteraction('cascade').layer
'dependent'
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
97 98 99 100 | |
InterdependentNetworkCascadeSystem(n_nodes=2000, *, mean_degree=4.0, p=0.8, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The cascade of failures of Buldyrev between two interdependent networks.
The cascade is that of Buldyrev et al., and the nodes of the networks depend on each other.
Two Erdős-Rényi networks of the mean degree mean_degree share their nodes, every node of one depending on the node
of the same index in the other, so a node is one pair of dependent nodes. An attack leaves every node functional
with probability p. At even steps the nodes outside the giant component of the functional nodes of the first
network fail, and at odd steps those outside that of the second network, until the cascade stops at the mutual giant
component (Buldyrev et al. 2010, as Artime et al. 2025, section 5, Eqs. 9 to 11, review it). Its share S solves S
= p (1 - exp(-k S))², which has a solution above 0 only for p above 2.4554 / k, where the networks collapse at
once in a discontinuous transition. The system has the functional nodes nodes.active over the graph of the first
network and the layer dependent of the second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes of every network. |
2000
|
mean_degree
|
float
|
The mean degree |
4.0
|
p
|
float
|
The share of nodes the attack leaves functional. |
0.8
|
random_state
|
int | Generator | None
|
The seed or generator of the networks and the attack. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import InterdependentNetworkCascadeSystem
>>> system = InterdependentNetworkCascadeSystem(200, p=0.3).prepare()
>>> int(system.simulate(until=20).get_values('nodes.active')[-1].sum())
0
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | |
KroneckerGraphSystem(first=None, second=None, *, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Kronecker graph of two graphs.
Its adjacency matrix is the Kronecker product of theirs.
The node (i, j) joins (k, l) when i joins k in the first graph and j joins l in the second (Gros 2015,
exercise of chapter 1). The degree of (i, j) is the product of the degrees of i and j, so the mean degree is
the product of the mean degrees, and the degree distribution is the distribution of the products. The system has the
group nodes and their states degree and clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
Graph | None
|
The first graph, or |
None
|
second
|
Graph | None
|
The second graph, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the default graphs. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.mathematics.networks import KroneckerGraphSystem
>>> KroneckerGraphSystem(nx.path_graph(3), nx.path_graph(2)).prepare().system_.elements[0].size
6
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
LoadedNodeElement(label, *, load=0.0, capacity=0.0, giant=0.0, space=None)
Bases: Element
Nodes of a network, each with its load, its capacity, and the size of the largest component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the nodes. |
required |
load
|
Annotated[object, closed_open(0, oo)]
|
The initial betweenness of every node, one per node or shared. |
0.0
|
capacity
|
object
|
The largest load a node carries, a negative value for a node that fails at the first step, one per node or shared. |
0.0
|
giant
|
Annotated[object, closed_open(0, oo)]
|
The initial number of nodes of the largest connected component, the same for every node. |
0.0
|
space
|
BaseSpace | None
|
The network with one node per site, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import LoadedNodeElement
>>> LoadedNodeElement('nodes', capacity=12.0).capacity
12.0
Source code in src/skcomplex/systems/mathematics/networks/_overload.py
59 60 61 62 63 64 65 66 67 68 69 70 71 | |
MergingNodeElement(label, *, degree=0.0, space=None)
Bases: Element
Node of the node-merging network, with its degree.
A map of the system reads the degree from the edges at the start of every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
degree
|
Annotated[float, closed_open(0, oo)]
|
The number of edges of the node. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import MergingNodeElement
>>> MergingNodeElement('nodes').degree
0.0
Source code in src/skcomplex/systems/mathematics/networks/_node_merging.py
53 54 55 56 57 58 59 60 61 | |
MotterLaiOverloadSystem(graph=None, *, tolerance=0.2, attack='load', random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The cascade of overload failures of Motter and Lai after one node is removed.
The load of a node is its betweenness, the number of shortest paths between other pairs of nodes that pass through
it, and its capacity is (1 + tolerance) times its load on the intact network (Motter and Lai 2002, as Artime et
al. 2025, section 5, review it). The attack removes one node at the first step, the node of the largest load, of the
largest degree, or a random node. Every later step the loads are those of the network present, and every node whose
load exceeds its capacity fails at once, until no node is overloaded. A heterogeneous network loses most of its
largest component after an attack on a node of large load and a low tolerance, and keeps it after a random failure.
The system has the nodes nodes, their load, capacity, and the size of the largest component giant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The NetworkX graph, or |
None
|
tolerance
|
float
|
The spare capacity |
0.2
|
attack
|
str
|
|
'load'
|
random_state
|
int | Generator | None
|
The seed or generator of the graph and of the random attack. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The attack is unknown. |
Examples:
>>> from skcomplex.systems.mathematics.networks import MotterLaiOverloadSystem
>>> trajectory = MotterLaiOverloadSystem(tolerance=0.1).prepare().simulate(until=10)
>>> int(trajectory.get_network(-1).nodes.size) < 300
True
Source code in src/skcomplex/systems/mathematics/networks/_overload.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
NetworkAttackSystem(n_nodes=300, *, edges=2, strategy='targeted', rate=0.01, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Failures or attacks on a scale-free network.
The network is robust to random failures but fragile to attacks on hubs.
The network is a Barabási-Albert graph. Under random failures every node fails with probability rate per step, and
the giant component shrinks slowly. Under a targeted attack the nodes of the largest degree are removed every step,
and the giant component breaks up after a few percent of the nodes are gone. The system has the groups nodes and
links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
300
|
edges
|
int
|
The number of edges every node of the Barabási-Albert graph joins with. |
2
|
strategy
|
str
|
|
'targeted'
|
rate
|
float
|
The probability that a node fails in a step under random failures. |
0.01
|
random_state
|
int | Generator | None
|
The seed or generator of the network. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The strategy is unknown. |
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkAttackSystem
>>> trajectory = NetworkAttackSystem(50).prepare().simulate(until=3, random_state=0)
>>> int(trajectory.get_network(-1).nodes.size) < 50
True
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
NetworkDiffusionSystem(graph=None, *, D=1.0, source=0, label='system', solver='auto', backend='auto')
Bases: NetworkDynamicalSystem
Diffusion on a network, du_i/dt = D Σ_j A_ij (u_j - u_i).
The diffusion spreads a unit mass to every node.
The total is conserved, and on a connected graph the content of every node tends to 1 / n. The system has the
contents nodes.u.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The undirected NetworkX graph, or |
None
|
D
|
float
|
The diffusion coefficient of every link. |
1.0
|
source
|
int
|
The index, in node order, of the node that holds the whole mass at the start. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.mathematics.networks import NetworkDiffusionSystem
>>> NetworkDiffusionSystem(nx.path_graph(4)).prepare().simulate(until=0.0).get_values('nodes.u').shape
(1, 4)
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
NetworkMeasuresElement(label, *, path_length=0.0, assortativity=0.0, modularity=0.0, agreement=0.0, triangle_zscore=0.0)
Bases: Element
Measures of a whole network, which the observables of a system report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the element. |
required |
path_length
|
float
|
The mean shortest path length of the largest component. |
0.0
|
assortativity
|
float
|
The degree assortativity. |
0.0
|
modularity
|
float
|
The modularity of the communities found. |
0.0
|
agreement
|
float
|
The agreement of the communities found with a reference partition. |
0.0
|
triangle_zscore
|
float
|
The z-score of the number of triangles against degree-preserving edge switches. |
0.0
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkMeasuresElement
>>> NetworkMeasuresElement('measures', modularity=0.4).modularity
0.4
Source code in src/skcomplex/systems/mathematics/networks/_structure.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
NetworkNodeElement(label, *, degree=0.0, clustering=0.0, betweenness=0.0, community=0.0, size=None, space=None)
Bases: Element
Nodes of a network, each with its degree, clustering, betweenness, and community.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the nodes. |
required |
degree
|
Annotated[object, NN]
|
The degree of every node, one per node or shared. |
0.0
|
clustering
|
Annotated[object, closed_open(0, oo)]
|
The clustering coefficient of every node, one per node or shared. |
0.0
|
betweenness
|
Annotated[object, closed_open(0, oo)]
|
The normalized betweenness centrality of every node, one per node or shared. |
0.0
|
community
|
Annotated[object, NN]
|
The index of the community of every node, one per node or shared. |
0.0
|
size
|
int | None
|
The number of nodes, or |
None
|
space
|
BaseSpace | None
|
The network with one node per site, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkNodeElement
>>> NetworkNodeElement('nodes', degree=[1.0, 2.0, 1.0], size=3).degree
[1.0, 2.0, 1.0]
Source code in src/skcomplex/systems/mathematics/common/networks/_network_node.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
NetworkRandomWalkSystem(graph=None, *, n_walkers=50, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Random walkers on a network.
The walkers visit every node of a connected graph in proportion to its degree.
The system has the group walkers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The undirected NetworkX graph, or |
None
|
n_walkers
|
int
|
The number of walkers, started at random nodes. |
50
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.mathematics.networks import NetworkRandomWalkSystem
>>> NetworkRandomWalkSystem(nx.cycle_graph(6), n_walkers=3).prepare().system_.elements[0].size
3
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
235 236 237 238 239 240 241 242 243 244 245 246 | |
NetworkStepInteraction(label, *, target='walkers')
Bases: Interaction
Step of a walker on a network to a neighbouring node drawn uniformly, counted in steps.
Every walker runs the rule once per step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The walkers that step. |
'walkers'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkStepInteraction
>>> NetworkStepInteraction('walk').target
'walkers'
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
173 174 175 | |
NetworkStructureAnalysisSystem(graph=None, *, reference='block', null_samples=10, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A recorded network with centralities, degree mixing, communities, and motifs.
The motifs are measured by the triangle z-score.
Every node is an agent that carries its degree, clustering, betweenness, and the community found by Louvain
modularity maximization. The observables report the clustering, the mean path length of the largest component, the
degree assortativity, the modularity, the agreement of the communities with a reference partition, and the z-score
of triangles against degree-preserving edge switches. The system has the node group nodes and the network measures
measures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The undirected NetworkX graph, or |
None
|
reference
|
str | None
|
The node attribute that holds the reference partition, such as |
'block'
|
null_samples
|
int
|
The number of edge-switched graphs of the triangle z-score, which is reported only when positive. |
10
|
random_state
|
int | None
|
The seed of the block system, the community detection, and the null graphs. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.mathematics.networks import NetworkStructureAnalysisSystem
>>> karate = NetworkStructureAnalysisSystem(nx.karate_club_graph(), reference='club', null_samples=0)
>>> karate.prepare().system_.elements[0].degree.size
34
Source code in src/skcomplex/systems/mathematics/networks/_structure.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
NetworkSuperpositionSystem(n_nodes=100, *, n_subgraphs=20, exponent=2.0, low=0.005, high=0.1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The network superposition model.
It is a union of Erdős-Rényi graphs whose linking probabilities are drawn.
Every one of n_subgraphs subgraphs of n_nodes nodes draws one linking probability p from Q(p) ~ p^-exponent
on [low, high] and links each pair of its nodes with probability p, and the network is their union (Thurner et
al. 2018, section 4.5.2). Its degrees mix the Poisson laws of the subgraphs, P(k) = ∫ dp P(k | N p) Q(p), Eq.
4.34, so a power law of the probabilities gives a power law of the degrees up to the largest mean degree N high.
The book draws p for every attempted link, which gives one Erdős-Rényi graph of the mean probability, so the
probability is drawn once per subgraph, the reading of Eq. 4.34, like the cells of superstatistics. The system has
the group nodes and their states degree and clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes of every subgraph. |
100
|
n_subgraphs
|
int
|
The number of subgraphs. |
20
|
exponent
|
float
|
The exponent of the distribution |
2.0
|
low
|
float
|
The smallest linking probability. |
0.005
|
high
|
float
|
The largest linking probability. |
0.1
|
random_state
|
int | Generator | None
|
The seed or generator of the linking probabilities and the links. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The bounds of the linking probabilities are not |
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkSuperpositionSystem
>>> system = NetworkSuperpositionSystem(10, n_subgraphs=3).prepare().system_
>>> system.elements[0].degree.size
30
Source code in src/skcomplex/systems/mathematics/networks/_superposition.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
NetworkWalkerElement(label, *, steps=0.0, size=None)
Bases: Element
Walkers on the nodes of a network, each with its number steps of steps taken.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walkers. |
required |
steps
|
Annotated[object, NN]
|
The initial number of steps taken, one per walker or shared. |
0.0
|
size
|
int | None
|
The number of walkers, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NetworkWalkerElement
>>> NetworkWalkerElement('walkers', size=5).size
5
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
141 142 143 144 145 146 147 148 149 | |
NodeMergingSystem(n_nodes=500, *, edges=1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The node-merging network of Kim and coauthors.
Its merging of linked nodes builds hubs without growth.
The network starts as a random tree of n_nodes nodes. Every step a node drawn uniformly merges with one of its
neighbours drawn uniformly into one node that keeps the union of their links, and a new node joins edges nodes
drawn uniformly, so the network keeps its size (Thurner et al. 2018, section 4.5.4.6). Merging adds the links of the
neighbour to the node, so well-linked nodes absorb more links, and the degrees follow a fat-tailed, q-exponential
distribution with hubs far above the degrees of a random graph. The system has the groups nodes and links, the
merging merging, and the arrival arrival.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
500
|
edges
|
int
|
The number of links of every new node. |
1
|
random_state
|
int | Generator | None
|
The seed or generator of the initial tree. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NodeMergingSystem
>>> trajectory = NodeMergingSystem(50).prepare().simulate(until=20, random_state=0)
>>> network = trajectory.get_network(-1)
>>> len(network.nodes), len(network.sources)
(50, 49)
Source code in src/skcomplex/systems/mathematics/networks/_node_merging.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
NodeRankElement(label, *, rank=0.0, degree=1.0, space=None)
Bases: Element
Pages of a network, each with its rank rank and its number degree of links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the pages. |
required |
rank
|
Annotated[object, closed_open(0, oo)]
|
The initial rank, one per page or shared. |
0.0
|
degree
|
Annotated[object, open(0, oo)]
|
The number of links, one per page or shared. |
1.0
|
space
|
BaseSpace | None
|
The network with one page per node, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import NodeRankElement
>>> NodeRankElement('pages', degree=2.0).degree
2.0
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
55 56 57 58 59 60 61 62 63 64 65 | |
OverloadInteraction(label, *, target='nodes')
Bases: Interaction
Failure of every node whose load, the number of shortest paths through it, exceeds its capacity.
At the start of every step the load of every node and the size of the largest component are read from the network present, and every overloaded node leaves the network at the end of the step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The nodes whose loads and sizes the interaction sets and that fail. |
'nodes'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import OverloadInteraction
>>> OverloadInteraction('overload').target
'nodes'
Source code in src/skcomplex/systems/mathematics/networks/_overload.py
95 96 97 | |
PagerankInteraction(label, *, target='pages', damping=0.85, n_nodes=1)
Bases: Interaction
The PageRank iteration r_i' = Σ_j A_ij (d r_j / k_j + (1 - d) / (n k_i)) of a random surfer.
The surfer follows a link with the probability d and jumps to a random page of the n pages otherwise, so the
ranks of an undirected network without isolated pages stay normalized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The pages whose ranks the iteration sets. |
'pages'
|
damping
|
float
|
The probability |
0.85
|
n_nodes
|
int
|
The number |
1
|
Examples:
>>> from skcomplex.systems.mathematics.networks import PagerankInteraction
>>> PagerankInteraction('links', damping=0.9).damping
0.9
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
95 96 97 98 99 | |
PagerankSystem(graph=None, *, damping=0.85, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The PageRank iteration r_i' = (1 - d) / n + d Σ_j A_ij r_j / k_j.
The network is undirected.
The ranks start uniform, stay normalized, and converge to the PageRank of the graph. Every node needs a link. The
system has the ranks pages.rank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
Graph | None
|
The undirected NetworkX graph without isolated nodes, or |
None
|
damping
|
float
|
The probability |
0.85
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> import networkx as nx
>>> from skcomplex.systems.mathematics.networks import PagerankSystem
>>> PagerankSystem(nx.cycle_graph(5)).prepare().system_.elements[0].rank.tolist()
[0.2, 0.2, 0.2, 0.2, 0.2]
Source code in src/skcomplex/systems/mathematics/networks/_processes.py
370 371 372 373 374 375 376 377 378 379 380 381 | |
PercolatingNodeElement(label, *, active=1.0, space=None)
Bases: Element
Node of a network with spatial triadic regulation.
The node is active when it belongs to the giant component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
active
|
Annotated[float, FiniteEnumeratedSet([0, 1])]
|
1 when the node is in the giant component of the active links, and 0 otherwise. |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import PercolatingNodeElement
>>> PercolatingNodeElement('nodes').active
1.0
Source code in src/skcomplex/systems/mathematics/networks/_spatial_triadic.py
57 58 59 60 61 62 63 64 65 | |
PercolationInteraction(label, *, nodes, links, phase=None)
Bases: Interaction
Activity of every node in its phase.
The activity is 1 in the giant component of the active links and 0 outside it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
nodes
|
Role
|
The path of the group on the nodes, whose activity the interaction sets. |
required |
links
|
Role
|
The path of the group on the edges, whose activity selects the links of the components. |
required |
phase
|
str | None
|
The phase of the step the interaction runs in, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import PercolationInteraction
>>> PercolationInteraction('percolation', nodes='nodes', links='links').links
'links'
Source code in src/skcomplex/systems/mathematics/networks/_spatial_triadic.py
210 211 212 213 214 215 216 217 218 219 220 221 | |
PopularitySimilarityNetworkSystem(*, edges=2, exponent=2.5, temperature=0.2, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Popularity-similarity growth, scale-free and clustered.
Its nodes attach by hyperbolic distance.
Every step a node joins at a uniform angle on the circle and the radius 2 ln t, every other node s moves to the
radius b 2 ln s + (1 - b) 2 ln t with b = 1 / (exponent - 1), and the new node joins edges nodes drawn in
proportion to the Fermi-Dirac probability of their hyperbolic distance x = r_s + r_t + 2 ln(theta / 2), at the
temperature temperature. The degrees follow a power law of the given exponent, and the clustering falls as the
temperature rises (Papadopoulos et al. 2012). The system has the groups nodes and links, the arrival growth,
and the states nodes.angle, nodes.age, and nodes.degree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
int
|
The number of edges of every new node, and one less than the nodes of the complete seed network. |
2
|
exponent
|
float
|
The exponent of the degree distribution, above 2. |
2.5
|
temperature
|
float
|
The temperature of the network, between 0 and 1. |
0.2
|
random_state
|
int | Generator | None
|
The seed or generator of the angles of the seed network. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The exponent is not above 2, or the temperature is not between 0 and 1. |
Examples:
>>> from skcomplex.systems.mathematics.networks import PopularitySimilarityNetworkSystem
>>> trajectory = PopularitySimilarityNetworkSystem().prepare().simulate(until=10, random_state=0)
>>> int(trajectory.get_network(-1).sources.size)
23
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
RandomGraphEnsemblesSystem(n_nodes=200, *, ensemble='erdos_renyi', mean_degree=4.0, rewiring=0.2, steps=100, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The construction of an Erdős-Rényi or a Watts-Strogatz random graph.
The graph is built one step of new edges at a time.
The Erdős-Rényi graph starts empty and every node adds an edge to a random node with a probability that brings the
mean degree to mean_degree after steps steps, so a giant component emerges when the mean degree passes 1. The
Watts-Strogatz graph starts as a ring where every node joins its mean_degree nearest nodes, and every edge moves
its target to a random node at a rate that rewires a fraction rewiring of the edges after steps steps, which
shortens paths while the clustering stays high. The system has the groups nodes and links, the map degree, and
the interaction linking or rewiring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
200
|
ensemble
|
str
|
|
'erdos_renyi'
|
mean_degree
|
float
|
The mean degree of the final graph, an even number for the Watts-Strogatz ring. |
4.0
|
rewiring
|
float
|
The fraction of the edges of the Watts-Strogatz ring rewired after |
0.2
|
steps
|
int
|
The number of steps of the construction. |
100
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The ensemble is unknown. |
Examples:
>>> from skcomplex.systems.mathematics.networks import RandomGraphEnsemblesSystem
>>> system = RandomGraphEnsemblesSystem(40, ensemble='watts_strogatz', steps=5).prepare()
>>> trajectory = system.simulate(until=5, random_state=0)
>>> int(trajectory.get_network(-1).sources.size)
80
Source code in src/skcomplex/systems/mathematics/networks/_ensembles.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
RegulatedLinkElement(label, *, active=1.0, sign=1, space=None)
Bases: Element
Link of a network with triadic regulation.
The link has its activity and the sign of its regulating node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the link group. |
required |
active
|
Annotated[object, FiniteEnumeratedSet([0, 1])]
|
1 when the link is active, and 0 otherwise. |
1.0
|
sign
|
Annotated[object, FiniteEnumeratedSet([-1, 1])]
|
1 when the regulating node lets the link be active while the node is active, and -1 when it lets it be active while the node is inactive. |
1
|
space
|
BaseSpace | None
|
The network whose links hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import RegulatedLinkElement
>>> RegulatedLinkElement('links', sign=-1).sign
-1
Source code in src/skcomplex/systems/mathematics/networks/_triadic.py
56 57 58 59 60 61 62 63 64 65 66 | |
RegulatedNodeElement(label, *, active=1.0, space=None)
Bases: Element
Node of a network with triadic regulation.
The node is active when it belongs to the giant component of the active links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
active
|
Annotated[object, FiniteEnumeratedSet([0, 1])]
|
1 when the node is in the giant component of the active links, and 0 otherwise. |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import RegulatedNodeElement
>>> RegulatedNodeElement('nodes').active
1.0
Source code in src/skcomplex/systems/mathematics/common/networks/_regulated_node.py
42 43 44 45 46 47 48 49 50 | |
SignedLinkElement(label, *, active=1.0, negatives=0, positives=1, space=None)
Bases: Element
Link regulated by signed nodes.
The link has its activity and the numbers of its negative and positive regulators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the link group. |
required |
active
|
Annotated[object, FiniteEnumeratedSet([0, 1])]
|
1 when the link is active, and 0 otherwise. |
1.0
|
negatives
|
Annotated[object, closed_open(0, oo)]
|
The number of regulating nodes that let the link be active only while they are inactive, the first regulators of its hyperedge. |
0
|
positives
|
Annotated[object, closed_open(0, oo)]
|
The number of regulating nodes that let the link be active while they are active, the regulators of its hyperedge after the negative ones. |
1
|
space
|
BaseSpace | None
|
The network whose links hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SignedLinkElement
>>> SignedLinkElement('links', negatives=2).negatives
2
Source code in src/skcomplex/systems/mathematics/networks/_spatial_triadic.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
SignedRegulationInteraction(label, *, among='nodes', along='hyperedges', p=0.5, phase=None)
Bases: Interaction
Regulation of every link by signed regulating nodes.
The regulators let the link be active with probability p in its phase.
Every hyperedge (i, j, r_1, ..., r_m) holds the two ends of the link (i, j) and its regulating nodes, first its
negatives negative regulators and then its positives positive ones, which the link reads. Further members pad
the hyperedges to one size and regulate nothing, so links with several numbers of regulators share one size and one
law writes every link once. In every step the link becomes active with probability p when none of its negative
regulators is active and at least one of its positive regulators is active, or, for a link without positive
regulators, when none of its negative regulators is active, and inactive otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
among
|
Role
|
The path of the group on the nodes, whose activity the regulators read. |
'nodes'
|
along
|
str
|
|
'hyperedges'
|
p
|
Annotated[float, closed(0, 1)]
|
The probability that a link the regulation allows is active. |
0.5
|
phase
|
str | None
|
The phase of the step the regulation runs in, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SignedRegulationInteraction
>>> SignedRegulationInteraction('regulation', among='nodes').p
0.5
Source code in src/skcomplex/systems/mathematics/networks/_spatial_triadic.py
150 151 152 153 154 155 156 157 158 159 160 161 | |
SimilarityVertexElement(label, *, age=0.0, degree=0.0, angle=0.0, space=None)
Bases: VertexElement
Node of a popularity-similarity network.
The node has an angle on the circle next to its age and degree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
age
|
object
|
The number of steps since the node joined. |
0.0
|
degree
|
float
|
The number of edges of the node. |
0.0
|
angle
|
object
|
The angle of the node on the circle, its similarity coordinate. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SimilarityVertexElement
>>> SimilarityVertexElement('nodes', angle=1.5).angle
1.5
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
147 148 149 150 151 152 153 154 155 156 157 | |
SimplexAgeingInteraction(label, *, target='triangles')
Bases: Interaction
Ageing of every triangle of a simplicial complex by one per step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the group on the triangles. |
'triangles'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SimplexAgeingInteraction
>>> SimplexAgeingInteraction('ageing').target
'triangles'
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
127 128 129 | |
SimplexElement(label, *, age=0.0, space=None)
Bases: Element
Triangle of a growing simplicial complex, with its age in steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the triangle or the group on the triangles. |
required |
age
|
Annotated[object, closed_open(0, oo)]
|
The number of steps since the triangle joined. |
0.0
|
space
|
BaseSpace | None
|
The network whose hyperedges hold one triangle each, or |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
default_visual_ |
How the triangle is drawn by default, the |
Examples:
>>> from skcomplex.systems.mathematics.networks import SimplexElement
>>> SimplexElement('triangles').age
0.0
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
55 56 57 58 59 60 61 62 63 | |
SizeBiasedMoveInteraction(label, *, among='nodes', along='hyperedges')
Bases: Interaction
Moves of a random walker across a hyperedge.
The walker moves to every other member with weight |e| - 1.
A walker at node i moves to node j at rate T_ij = k_ij / D_i, where k_ij = sum_e (|e| - 1) over the
hyperedges e that hold both, and D_i = sum_j k_ij. On a hyperedge, the focal member gains (|e| - 1) p_j / D_j
from every other member j and loses (|e| - 1)^2 p_i / D_i.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
among
|
Role
|
The path of the group of walker densities on the nodes. |
'nodes'
|
along
|
str
|
|
'hyperedges'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SizeBiasedMoveInteraction
>>> SizeBiasedMoveInteraction('moves', among='nodes').among
'nodes'
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
170 171 | |
SpatialTriadicPercolationSystem(side=4.0, *, density=100.0, c=0.4, positive=0.2, negative=0.2, structural_range=0.25, regulatory_range=0.25, p=0.8, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Spatial triadic percolation.
Nearby signed regulators make the giant component form moving patterns.
The nodes lie uniformly on a square torus of side side with density nodes per unit area, and two nodes at the
distance d are linked with probability c exp(-d / structural_range), a Waxman network, Eq. 1 of Millán et al.
A node regulates a link positively with probability positive exp(-d / regulatory_range) and negatively with
probability negative exp(-d / regulatory_range), never both, from its distance d to the midpoint of the link,
Eq. 2. Every step of the paper runs in two phases. In the phase regulation a link is active with probability p
when none of its negative regulators is active and one of its positive regulators is, or, for the rare link
without positive regulators, when none of its negative regulators is active. In the phase percolation a node is
active when it belongs to the giant component of the active links. All nodes and links start active.
The regulation is local, so the giant component forms clusters, stripes, and octopus-like patterns that move, and
its size keeps changing instead of settling. At p = 0.8 with positive = negative the patterns blink: a pattern
deactivates the links it regulates negatively and the next step activates the region around it, so the active nodes
of consecutive steps are anti-correlated. For long ranges the model becomes the triadic percolation of Erdős-Rényi
networks with many regulators per link. The system has the activities nodes.active and links.active, and
links.negatives and links.positives, the numbers of negative and positive regulators of every link, on a network
whose nodes hold their positions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side
|
float
|
The side of the square torus. |
4.0
|
density
|
float
|
The number of nodes per unit area. |
100.0
|
c
|
float
|
The prefactor of the probability of a structural link. |
0.4
|
positive
|
float
|
The prefactor of the probability of a positive regulation. |
0.2
|
negative
|
float
|
The prefactor of the probability of a negative regulation. |
0.2
|
structural_range
|
float
|
The typical length of the structural links, |
0.25
|
regulatory_range
|
float
|
The typical length of the regulations, |
0.25
|
p
|
float
|
The probability that a link the regulation allows is active. |
0.8
|
random_state
|
int | Generator | None
|
The seed or generator of the positions, the links, and the regulators. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SpatialTriadicPercolationSystem
>>> trajectory = SpatialTriadicPercolationSystem(1.0).prepare().simulate(until=2, random_state=0)
>>> giant = trajectory.get_values('nodes.active').mean(axis=1)
>>> bool(giant[0] == 1.0 and giant[1] < 0.1)
True
Source code in src/skcomplex/systems/mathematics/networks/_spatial_triadic.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
SuperposedNodeElement(label, *, degree=0.0, clustering=0.0, space=None)
Bases: Element
Nodes of a superposed network, each with its degree and its clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the nodes. |
required |
degree
|
Annotated[object, closed_open(0, oo)]
|
The number of edges of every node, one per node or shared. |
0.0
|
clustering
|
Annotated[object, closed(0, 1)]
|
The share of the pairs of neighbours of every node that are joined, one per node or shared. |
0.0
|
space
|
BaseSpace | None
|
The network with one node per site, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import SuperposedNodeElement
>>> SuperposedNodeElement('nodes').clustering
0.0
Source code in src/skcomplex/systems/mathematics/networks/_superposition.py
53 54 55 56 57 58 59 60 61 62 63 | |
TriadVertexElement(label, *, age=0.0, degree=0.0, near=0.0, triad=0.8, extra=1, space=None)
Bases: VertexElement
Node of a Holme-Kim network.
When it joins, the node closes triangles with the neighbours of its first contact.
One step after a node joins with one edge by preferential attachment, the triad formation of the system adds
extra edges to it. Each new end is a neighbour of its first contact with probability triad, and a node drawn by
preferential attachment otherwise. The state near marks the nodes next to the newest node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
age
|
float
|
The number of steps since the node joined. |
0.0
|
degree
|
float
|
The number of edges of the node. |
0.0
|
near
|
Annotated[float, closed_open(0, oo)]
|
The number of neighbours of the node that joined in the previous step. |
0.0
|
triad
|
Annotated[float, closed_open(0, oo)]
|
The probability that a new edge closes a triangle. |
0.8
|
extra
|
Annotated[int, NN]
|
The number of edges a node adds after its first one. |
1
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import TriadVertexElement
>>> TriadVertexElement('nodes', triad=0.5).triad
0.5
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
TriadicPercolationSystem(n_nodes=1000, *, mean_degree=4.0, p=0.5, negative=1.0, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Triadic percolation.
Regulating nodes switch links on and off from the giant component.
Every link of an Erdős-Rényi graph has one regulating node, drawn at random among the other nodes, which is
negative with probability negative and positive otherwise. The link and its regulator form a hyperedge of size
three. Every step is a time step of Millán et al. in two phases. In the phase regulation every link is active
with probability p when its positive regulator is active or its negative regulator is inactive, and inactive
otherwise. In the phase percolation a node is active when it belongs to the giant component of the links the
regulation of the same step left active. All nodes and links start active.
With the fraction R of nodes in the giant component, the links are active with probability p_L = p ((1 -
negative) R + negative (1 - R)), and R follows the map R' = S(c p_L), where S(m) solves S = 1 - exp(-m S)
for the mean degree c. With negative regulators alone the map decreases, so above the percolation point p = 1 /
c its fixed point is unstable and R alternates between a large and a small giant component, a cycle of period
two. Below it the giant component vanishes. The system has the activities nodes.active and links.active and the
signs links.sign.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_nodes
|
int
|
The number of nodes. |
1000
|
mean_degree
|
float
|
The mean degree of the Erdős-Rényi graph. |
4.0
|
p
|
float
|
The probability that a link the regulation allows is active. |
0.5
|
negative
|
float
|
The probability that the regulator of a link is negative. |
1.0
|
random_state
|
int | Generator | None
|
The seed or generator of the graph, the regulators, and their signs. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import TriadicPercolationSystem
>>> trajectory = TriadicPercolationSystem(200, p=0.8).prepare().simulate(until=3, random_state=0)
>>> giant = trajectory.get_values('nodes.active').mean(axis=1)
>>> bool(giant[1] < 0.5 < giant[2])
True
Source code in src/skcomplex/systems/mathematics/networks/_triadic.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
TriadicRegulationInteraction(label, *, among='nodes', along='hyperedges', p=0.5, phase=None)
Bases: Interaction
Regulation of every link by a third node.
The node lets the link be active with probability p in its phase.
Every hyperedge (i, j, r) holds the two ends of the link (i, j) and its regulating node r. In every step the
link becomes active with probability p when a positive regulator is active or a negative regulator is inactive,
and inactive otherwise. The laws run once for every hyperedge and change the link on the edge (i, j).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
among
|
Role
|
The path of the group on the nodes, whose activity the regulators read. |
'nodes'
|
along
|
str
|
|
'hyperedges'
|
p
|
Annotated[float, closed(0, 1)]
|
The probability that a link the regulation allows is active. |
0.5
|
phase
|
str | None
|
The phase of the step the regulation runs in, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import TriadicRegulationInteraction
>>> TriadicRegulationInteraction('regulation', among='nodes').along
'hyperedges'
Source code in src/skcomplex/systems/mathematics/networks/_triadic.py
155 156 157 158 159 160 161 162 163 164 165 166 | |
VertexCopyingSystem(*, edges=3, randomness=0.2, seed_nodes=4, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Vertex-copying growth.
New nodes copy the edges of existing nodes and make a heavy-tailed degree.
Every step a node joins with edges edges, each to a random node with probability randomness and otherwise to a
random neighbour of a random prototype, which favours nodes of high degree without reading degrees. The system has
the groups nodes and links and the arrival growth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
int
|
The number of edges of every new node. |
3
|
randomness
|
float
|
The probability that an edge joins a random node instead of copying. |
0.2
|
seed_nodes
|
int
|
The number of nodes of the complete seed network. |
4
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.mathematics.networks import VertexCopyingSystem
>>> VertexCopyingSystem().prepare().system_.interactions[0].laws[0].target.edges
3
Source code in src/skcomplex/systems/mathematics/networks/_growth.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
VertexElement(label, *, age=0.0, degree=0.0, space=None)
Bases: Element
Node of a growing network, with its age in steps and its degree.
New nodes start with the age their growth gives, and the maps of the system age the node and read its degree from the edges at the start of every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node group. |
required |
age
|
Annotated[object, closed_open(0, oo)]
|
The number of steps since the node joined. |
0.0
|
degree
|
Annotated[object, closed_open(0, oo)]
|
The number of edges of the node. |
0.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Examples:
>>> from skcomplex.systems.mathematics.networks import VertexElement
>>> VertexElement('nodes').age
0.0
Source code in src/skcomplex/systems/mathematics/common/networks/_vertex.py
44 45 46 47 48 49 50 51 52 53 54 | |
WalkerDensityElement(label, *, p=0.0, D=1.0, space=None)
Bases: Element
Probability that a random walker is at a node of a hypergraph.
The node has the weight D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the node or the group on the nodes. |
required |
p
|
Annotated[object, closed(0, 1)]
|
The probability of the walker at the node. |
0.0
|
D
|
Annotated[object, open(0, oo)]
|
The total weight of the moves out of the node, the sum of |
1.0
|
space
|
BaseSpace | None
|
The network whose nodes hold one member each, or |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
default_visual_ |
How the node is drawn by default, the |
Examples:
>>> from skcomplex.systems.mathematics.networks import WalkerDensityElement
>>> WalkerDensityElement('node', D=4.0).D
4.0
Source code in src/skcomplex/systems/mathematics/networks/_hypergraphs.py
96 97 98 99 100 101 102 103 104 105 106 | |