Skip to content

Common

Realizations shared by several mathematics systems: flows and the nodes of networks.

NetworkNodeElement(label, visual=VisualSpec('agents', {'color_by': 'community'}), *, degree=0.0, clustering=0.0, betweenness=0.0, community=0.0)

Bases: Element

Node of a network that carries its degree, clustering, betweenness, and community.

Parameters:

Name Type Description Default
label str

The label of the agent or group.

required
visual VisualSpec | None

How the element is drawn, or None for default_visual_.

VisualSpec('agents', {'color_by': 'community'})
degree Annotated[float, StateSpec(domain=NN)]

The degree of the node.

0.0
clustering Annotated[float, StateSpec(domain=closed_open(0, oo))]

The clustering coefficient of the node.

0.0
betweenness Annotated[float, StateSpec(domain=closed_open(0, oo))]

The normalized betweenness centrality of the node.

0.0
community Annotated[float, StateSpec(domain=NN)]

The index of the community of the node.

0.0

Examples:

>>> from skcomplex.core.components.elements import GroupElement
>>> from skcomplex.systems.mathematics.networks import NetworkNodeElement
>>> group = GroupElement('nodes', element=NetworkNodeElement, size=3)
>>> group.label, group.element.__name__, group.size
('nodes', 'NetworkNodeElement', 3)
Source code in src/skcomplex/systems/mathematics/common/_network_node.py
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def __init__(
    self,
    label: str,
    visual: VisualSpec | None = VisualSpec('agents', {'color_by': 'community'}),
    *,
    degree: Annotated[float, StateSpec(domain=NN)] = 0.0,
    clustering: Annotated[float, StateSpec(domain=RealSet.closed_open(0, oo))] = 0.0,
    betweenness: Annotated[float, StateSpec(domain=RealSet.closed_open(0, oo))] = 0.0,
    community: Annotated[float, StateSpec(domain=NN)] = 0.0,
) -> None:
    super().__init__(label, visual=visual)
    self.degree = degree
    self.clustering = clustering
    self.betweenness = betweenness
    self.community = community

stay(agent, system)

Keep the node and its measures unchanged.

Parameters:

Name Type Description Default
agent AgentView

The node.

required
system SystemView

The system.

required
Source code in src/skcomplex/systems/mathematics/common/_network_node.py
77
78
79
80
81
82
83
84
85
86
def stay(self, agent: AgentView, system: SystemView) -> None:
    """Keep the node and its measures unchanged.

    Args:
        agent:
            The node.

        system:
            The system.
    """

RegulatedNodeElement(label, visual=ACTIVITY_VISUAL, *, active=1.0)

Bases: Element

Node of a network with triadic regulation, 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
visual VisualSpec | None

How the element is drawn, or None for default_visual_.

ACTIVITY_VISUAL
active Annotated[float, StateSpec(domain=FiniteEnumeratedSet([0, 1]))]

1 when the node is in the giant component of the active links, and 0 otherwise.

1.0

Examples:

>>> from skcomplex.systems.mathematics.networks import RegulatedNodeElement
>>> RegulatedNodeElement('nodes').active
1.0
Source code in src/skcomplex/systems/mathematics/common/_regulated_node.py
35
36
37
38
39
40
41
42
43
def __init__(
    self,
    label: str,
    visual: VisualSpec | None = ACTIVITY_VISUAL,
    *,
    active: Annotated[float, StateSpec(domain=FiniteEnumeratedSet([0, 1]))] = 1.0,
) -> None:
    super().__init__(label, visual=visual)
    self.active = active

VertexElement(label, visual=DEGREE_VISUAL, *, age=0.0, degree=0.0)

Bases: Element

Node of a growing network, with its age in steps and its degree.

New nodes start with age 0, 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
visual VisualSpec | None

How the element is drawn, or None for default_visual_.

DEGREE_VISUAL
age Annotated[float, StateSpec(domain=closed_open(0, oo))]

The number of steps since the node joined.

0.0
degree Annotated[float, StateSpec(domain=closed_open(0, oo))]

The number of edges of the node.

0.0

Examples:

>>> from skcomplex.systems.mathematics.networks import VertexElement
>>> VertexElement('nodes').age
0.0
Source code in src/skcomplex/systems/mathematics/common/_vertex.py
42
43
44
45
46
47
48
49
50
51
52
def __init__(
    self,
    label: str,
    visual: VisualSpec | None = DEGREE_VISUAL,
    *,
    age: Annotated[float, StateSpec(domain=RealSet.closed_open(0, oo))] = 0.0,
    degree: Annotated[float, StateSpec(domain=RealSet.closed_open(0, oo))] = 0.0,
) -> None:
    super().__init__(label, visual=visual)
    self.age = age
    self.degree = degree