Networks
Network realizations shared by the biology packages: weighted edges of ecological networks and their draws.
EdgeDrawInteraction(label, *, target, edges, noise=0.0, low=-1.0, high=1.0, state='w')
Bases: NeighborInteraction
First draw of the weight of every new edge of a network, and a random drift of the weights of the other edges.
Every step of discrete time an edge marked fresh draws its weight uniformly from [low, high] and loses its mark,
and every other edge adds noise times a standard normal draw to its weight, or keeps it without noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Annotated[str, RoleSpec()]
|
The path of the group on the nodes of the network. |
required |
edges
|
Annotated[str, RoleSpec()]
|
The path of the group on its edges, whose members hold the weight and the mark. |
required |
noise
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The standard deviation of the drift of a weight in a step, 0 for none. |
0.0
|
low
|
float
|
The least weight of a new edge. |
-1.0
|
high
|
float
|
The largest weight of a new edge. |
1.0
|
state
|
str
|
The name of the state of the edges that holds the weight. |
'w'
|
Examples:
>>> from types import SimpleNamespace
>>> from sage.all__sagemath_symbolics import var
>>> from skcomplex.models.biology.common.networks import EdgeDrawInteraction
>>> edge = SimpleNamespace(w=var('w'), fresh=var('fresh'))
>>> draw = EdgeDrawInteraction('draw', target='species', edges='links').check().prepare()
>>> [str(law.value) for law in draw.run(SimpleNamespace(edge=edge, noise=var('noise'))).laws_][1]
'0'
Source code in src/skcomplex/models/biology/common/networks/_edge_draw.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
WeightedEdgeElement(label, visual=None, *, w=0.0, fresh=1.0)
Bases: Element
Edge of a network with a weight w, such as the strength of an influence or a coupling between two species.
A new edge is marked fresh until an EdgeDrawInteraction draws its weight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the edge or of the group of edges. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
None
|
w
|
Annotated[float, StateSpec()]
|
The weight. |
0.0
|
fresh
|
Annotated[float, StateSpec(domain=FiniteEnumeratedSet([0, 1]))]
|
Whether the edge has not drawn its weight yet, 1 or 0. |
1.0
|
Examples:
>>> from skcomplex.models.biology.common.networks import WeightedEdgeElement
>>> WeightedEdgeElement('edge').fresh
1.0
Source code in src/skcomplex/models/biology/common/networks/_weighted_edge.py
38 39 40 41 42 43 44 45 46 47 48 | |