tnfr 3.0.3__py3-none-any.whl → 8.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tnfr might be problematic. Click here for more details.
- tnfr/__init__.py +375 -56
- tnfr/__init__.pyi +33 -0
- tnfr/_compat.py +10 -0
- tnfr/_generated_version.py +34 -0
- tnfr/_version.py +49 -0
- tnfr/_version.pyi +7 -0
- tnfr/alias.py +723 -0
- tnfr/alias.pyi +108 -0
- tnfr/backends/__init__.py +354 -0
- tnfr/backends/jax_backend.py +173 -0
- tnfr/backends/numpy_backend.py +238 -0
- tnfr/backends/optimized_numpy.py +420 -0
- tnfr/backends/torch_backend.py +408 -0
- tnfr/cache.py +171 -0
- tnfr/cache.pyi +13 -0
- tnfr/cli/__init__.py +110 -0
- tnfr/cli/__init__.pyi +26 -0
- tnfr/cli/arguments.py +489 -0
- tnfr/cli/arguments.pyi +29 -0
- tnfr/cli/execution.py +914 -0
- tnfr/cli/execution.pyi +70 -0
- tnfr/cli/interactive_validator.py +614 -0
- tnfr/cli/utils.py +51 -0
- tnfr/cli/utils.pyi +7 -0
- tnfr/cli/validate.py +236 -0
- tnfr/compat/__init__.py +85 -0
- tnfr/compat/dataclass.py +136 -0
- tnfr/compat/jsonschema_stub.py +61 -0
- tnfr/compat/matplotlib_stub.py +73 -0
- tnfr/compat/numpy_stub.py +155 -0
- tnfr/config/__init__.py +224 -0
- tnfr/config/__init__.pyi +10 -0
- tnfr/config/constants.py +104 -0
- tnfr/config/constants.pyi +12 -0
- tnfr/config/defaults.py +54 -0
- tnfr/config/defaults_core.py +212 -0
- tnfr/config/defaults_init.py +33 -0
- tnfr/config/defaults_metric.py +104 -0
- tnfr/config/feature_flags.py +81 -0
- tnfr/config/feature_flags.pyi +16 -0
- tnfr/config/glyph_constants.py +31 -0
- tnfr/config/init.py +77 -0
- tnfr/config/init.pyi +8 -0
- tnfr/config/operator_names.py +254 -0
- tnfr/config/operator_names.pyi +36 -0
- tnfr/config/physics_derivation.py +354 -0
- tnfr/config/presets.py +83 -0
- tnfr/config/presets.pyi +7 -0
- tnfr/config/security.py +927 -0
- tnfr/config/thresholds.py +114 -0
- tnfr/config/tnfr_config.py +498 -0
- tnfr/constants/__init__.py +92 -0
- tnfr/constants/__init__.pyi +92 -0
- tnfr/constants/aliases.py +33 -0
- tnfr/constants/aliases.pyi +27 -0
- tnfr/constants/init.py +33 -0
- tnfr/constants/init.pyi +12 -0
- tnfr/constants/metric.py +104 -0
- tnfr/constants/metric.pyi +19 -0
- tnfr/core/__init__.py +33 -0
- tnfr/core/container.py +226 -0
- tnfr/core/default_implementations.py +329 -0
- tnfr/core/interfaces.py +279 -0
- tnfr/dynamics/__init__.py +238 -0
- tnfr/dynamics/__init__.pyi +83 -0
- tnfr/dynamics/adaptation.py +267 -0
- tnfr/dynamics/adaptation.pyi +7 -0
- tnfr/dynamics/adaptive_sequences.py +189 -0
- tnfr/dynamics/adaptive_sequences.pyi +14 -0
- tnfr/dynamics/aliases.py +23 -0
- tnfr/dynamics/aliases.pyi +19 -0
- tnfr/dynamics/bifurcation.py +232 -0
- tnfr/dynamics/canonical.py +229 -0
- tnfr/dynamics/canonical.pyi +48 -0
- tnfr/dynamics/coordination.py +385 -0
- tnfr/dynamics/coordination.pyi +25 -0
- tnfr/dynamics/dnfr.py +3034 -0
- tnfr/dynamics/dnfr.pyi +26 -0
- tnfr/dynamics/dynamic_limits.py +225 -0
- tnfr/dynamics/feedback.py +252 -0
- tnfr/dynamics/feedback.pyi +24 -0
- tnfr/dynamics/fused_dnfr.py +454 -0
- tnfr/dynamics/homeostasis.py +157 -0
- tnfr/dynamics/homeostasis.pyi +14 -0
- tnfr/dynamics/integrators.py +661 -0
- tnfr/dynamics/integrators.pyi +36 -0
- tnfr/dynamics/learning.py +310 -0
- tnfr/dynamics/learning.pyi +33 -0
- tnfr/dynamics/metabolism.py +254 -0
- tnfr/dynamics/nbody.py +796 -0
- tnfr/dynamics/nbody_tnfr.py +783 -0
- tnfr/dynamics/propagation.py +326 -0
- tnfr/dynamics/runtime.py +908 -0
- tnfr/dynamics/runtime.pyi +77 -0
- tnfr/dynamics/sampling.py +36 -0
- tnfr/dynamics/sampling.pyi +7 -0
- tnfr/dynamics/selectors.py +711 -0
- tnfr/dynamics/selectors.pyi +85 -0
- tnfr/dynamics/structural_clip.py +207 -0
- tnfr/errors/__init__.py +37 -0
- tnfr/errors/contextual.py +492 -0
- tnfr/execution.py +223 -0
- tnfr/execution.pyi +45 -0
- tnfr/extensions/__init__.py +205 -0
- tnfr/extensions/__init__.pyi +18 -0
- tnfr/extensions/base.py +173 -0
- tnfr/extensions/base.pyi +35 -0
- tnfr/extensions/business/__init__.py +71 -0
- tnfr/extensions/business/__init__.pyi +11 -0
- tnfr/extensions/business/cookbook.py +88 -0
- tnfr/extensions/business/cookbook.pyi +8 -0
- tnfr/extensions/business/health_analyzers.py +202 -0
- tnfr/extensions/business/health_analyzers.pyi +9 -0
- tnfr/extensions/business/patterns.py +183 -0
- tnfr/extensions/business/patterns.pyi +8 -0
- tnfr/extensions/medical/__init__.py +73 -0
- tnfr/extensions/medical/__init__.pyi +11 -0
- tnfr/extensions/medical/cookbook.py +88 -0
- tnfr/extensions/medical/cookbook.pyi +8 -0
- tnfr/extensions/medical/health_analyzers.py +181 -0
- tnfr/extensions/medical/health_analyzers.pyi +9 -0
- tnfr/extensions/medical/patterns.py +163 -0
- tnfr/extensions/medical/patterns.pyi +8 -0
- tnfr/flatten.py +262 -0
- tnfr/flatten.pyi +21 -0
- tnfr/gamma.py +354 -0
- tnfr/gamma.pyi +36 -0
- tnfr/glyph_history.py +377 -0
- tnfr/glyph_history.pyi +35 -0
- tnfr/glyph_runtime.py +19 -0
- tnfr/glyph_runtime.pyi +8 -0
- tnfr/immutable.py +218 -0
- tnfr/immutable.pyi +36 -0
- tnfr/initialization.py +203 -0
- tnfr/initialization.pyi +65 -0
- tnfr/io.py +10 -0
- tnfr/io.pyi +13 -0
- tnfr/locking.py +37 -0
- tnfr/locking.pyi +7 -0
- tnfr/mathematics/__init__.py +79 -0
- tnfr/mathematics/backend.py +453 -0
- tnfr/mathematics/backend.pyi +99 -0
- tnfr/mathematics/dynamics.py +408 -0
- tnfr/mathematics/dynamics.pyi +90 -0
- tnfr/mathematics/epi.py +391 -0
- tnfr/mathematics/epi.pyi +65 -0
- tnfr/mathematics/generators.py +242 -0
- tnfr/mathematics/generators.pyi +29 -0
- tnfr/mathematics/metrics.py +119 -0
- tnfr/mathematics/metrics.pyi +16 -0
- tnfr/mathematics/operators.py +239 -0
- tnfr/mathematics/operators.pyi +59 -0
- tnfr/mathematics/operators_factory.py +124 -0
- tnfr/mathematics/operators_factory.pyi +11 -0
- tnfr/mathematics/projection.py +87 -0
- tnfr/mathematics/projection.pyi +33 -0
- tnfr/mathematics/runtime.py +182 -0
- tnfr/mathematics/runtime.pyi +64 -0
- tnfr/mathematics/spaces.py +256 -0
- tnfr/mathematics/spaces.pyi +83 -0
- tnfr/mathematics/transforms.py +305 -0
- tnfr/mathematics/transforms.pyi +62 -0
- tnfr/metrics/__init__.py +79 -0
- tnfr/metrics/__init__.pyi +20 -0
- tnfr/metrics/buffer_cache.py +163 -0
- tnfr/metrics/buffer_cache.pyi +24 -0
- tnfr/metrics/cache_utils.py +214 -0
- tnfr/metrics/coherence.py +2009 -0
- tnfr/metrics/coherence.pyi +129 -0
- tnfr/metrics/common.py +158 -0
- tnfr/metrics/common.pyi +35 -0
- tnfr/metrics/core.py +316 -0
- tnfr/metrics/core.pyi +13 -0
- tnfr/metrics/diagnosis.py +833 -0
- tnfr/metrics/diagnosis.pyi +86 -0
- tnfr/metrics/emergence.py +245 -0
- tnfr/metrics/export.py +179 -0
- tnfr/metrics/export.pyi +7 -0
- tnfr/metrics/glyph_timing.py +379 -0
- tnfr/metrics/glyph_timing.pyi +81 -0
- tnfr/metrics/learning_metrics.py +280 -0
- tnfr/metrics/learning_metrics.pyi +21 -0
- tnfr/metrics/phase_coherence.py +351 -0
- tnfr/metrics/phase_compatibility.py +349 -0
- tnfr/metrics/reporting.py +183 -0
- tnfr/metrics/reporting.pyi +25 -0
- tnfr/metrics/sense_index.py +1203 -0
- tnfr/metrics/sense_index.pyi +9 -0
- tnfr/metrics/trig.py +373 -0
- tnfr/metrics/trig.pyi +13 -0
- tnfr/metrics/trig_cache.py +233 -0
- tnfr/metrics/trig_cache.pyi +10 -0
- tnfr/multiscale/__init__.py +32 -0
- tnfr/multiscale/hierarchical.py +517 -0
- tnfr/node.py +763 -0
- tnfr/node.pyi +139 -0
- tnfr/observers.py +255 -130
- tnfr/observers.pyi +31 -0
- tnfr/ontosim.py +144 -137
- tnfr/ontosim.pyi +28 -0
- tnfr/operators/__init__.py +1672 -0
- tnfr/operators/__init__.pyi +31 -0
- tnfr/operators/algebra.py +277 -0
- tnfr/operators/canonical_patterns.py +420 -0
- tnfr/operators/cascade.py +267 -0
- tnfr/operators/cycle_detection.py +358 -0
- tnfr/operators/definitions.py +4108 -0
- tnfr/operators/definitions.pyi +78 -0
- tnfr/operators/grammar.py +1164 -0
- tnfr/operators/grammar.pyi +140 -0
- tnfr/operators/hamiltonian.py +710 -0
- tnfr/operators/health_analyzer.py +809 -0
- tnfr/operators/jitter.py +272 -0
- tnfr/operators/jitter.pyi +11 -0
- tnfr/operators/lifecycle.py +314 -0
- tnfr/operators/metabolism.py +618 -0
- tnfr/operators/metrics.py +2138 -0
- tnfr/operators/network_analysis/__init__.py +27 -0
- tnfr/operators/network_analysis/source_detection.py +186 -0
- tnfr/operators/nodal_equation.py +395 -0
- tnfr/operators/pattern_detection.py +660 -0
- tnfr/operators/patterns.py +669 -0
- tnfr/operators/postconditions/__init__.py +38 -0
- tnfr/operators/postconditions/mutation.py +236 -0
- tnfr/operators/preconditions/__init__.py +1226 -0
- tnfr/operators/preconditions/coherence.py +305 -0
- tnfr/operators/preconditions/dissonance.py +236 -0
- tnfr/operators/preconditions/emission.py +128 -0
- tnfr/operators/preconditions/mutation.py +580 -0
- tnfr/operators/preconditions/reception.py +125 -0
- tnfr/operators/preconditions/resonance.py +364 -0
- tnfr/operators/registry.py +74 -0
- tnfr/operators/registry.pyi +9 -0
- tnfr/operators/remesh.py +1809 -0
- tnfr/operators/remesh.pyi +26 -0
- tnfr/operators/structural_units.py +268 -0
- tnfr/operators/unified_grammar.py +105 -0
- tnfr/parallel/__init__.py +54 -0
- tnfr/parallel/auto_scaler.py +234 -0
- tnfr/parallel/distributed.py +384 -0
- tnfr/parallel/engine.py +238 -0
- tnfr/parallel/gpu_engine.py +420 -0
- tnfr/parallel/monitoring.py +248 -0
- tnfr/parallel/partitioner.py +459 -0
- tnfr/py.typed +0 -0
- tnfr/recipes/__init__.py +22 -0
- tnfr/recipes/cookbook.py +743 -0
- tnfr/rng.py +178 -0
- tnfr/rng.pyi +26 -0
- tnfr/schemas/__init__.py +8 -0
- tnfr/schemas/grammar.json +94 -0
- tnfr/sdk/__init__.py +107 -0
- tnfr/sdk/__init__.pyi +19 -0
- tnfr/sdk/adaptive_system.py +173 -0
- tnfr/sdk/adaptive_system.pyi +21 -0
- tnfr/sdk/builders.py +370 -0
- tnfr/sdk/builders.pyi +51 -0
- tnfr/sdk/fluent.py +1121 -0
- tnfr/sdk/fluent.pyi +74 -0
- tnfr/sdk/templates.py +342 -0
- tnfr/sdk/templates.pyi +41 -0
- tnfr/sdk/utils.py +341 -0
- tnfr/secure_config.py +46 -0
- tnfr/security/__init__.py +70 -0
- tnfr/security/database.py +514 -0
- tnfr/security/subprocess.py +503 -0
- tnfr/security/validation.py +290 -0
- tnfr/selector.py +247 -0
- tnfr/selector.pyi +19 -0
- tnfr/sense.py +378 -0
- tnfr/sense.pyi +23 -0
- tnfr/services/__init__.py +17 -0
- tnfr/services/orchestrator.py +325 -0
- tnfr/sparse/__init__.py +39 -0
- tnfr/sparse/representations.py +492 -0
- tnfr/structural.py +705 -0
- tnfr/structural.pyi +83 -0
- tnfr/telemetry/__init__.py +35 -0
- tnfr/telemetry/cache_metrics.py +226 -0
- tnfr/telemetry/cache_metrics.pyi +64 -0
- tnfr/telemetry/nu_f.py +422 -0
- tnfr/telemetry/nu_f.pyi +108 -0
- tnfr/telemetry/verbosity.py +36 -0
- tnfr/telemetry/verbosity.pyi +15 -0
- tnfr/tokens.py +58 -0
- tnfr/tokens.pyi +36 -0
- tnfr/tools/__init__.py +20 -0
- tnfr/tools/domain_templates.py +478 -0
- tnfr/tools/sequence_generator.py +846 -0
- tnfr/topology/__init__.py +13 -0
- tnfr/topology/asymmetry.py +151 -0
- tnfr/trace.py +543 -0
- tnfr/trace.pyi +42 -0
- tnfr/tutorials/__init__.py +38 -0
- tnfr/tutorials/autonomous_evolution.py +285 -0
- tnfr/tutorials/interactive.py +1576 -0
- tnfr/tutorials/structural_metabolism.py +238 -0
- tnfr/types.py +775 -0
- tnfr/types.pyi +357 -0
- tnfr/units.py +68 -0
- tnfr/units.pyi +13 -0
- tnfr/utils/__init__.py +282 -0
- tnfr/utils/__init__.pyi +215 -0
- tnfr/utils/cache.py +4223 -0
- tnfr/utils/cache.pyi +470 -0
- tnfr/utils/callbacks.py +375 -0
- tnfr/utils/callbacks.pyi +49 -0
- tnfr/utils/chunks.py +108 -0
- tnfr/utils/chunks.pyi +22 -0
- tnfr/utils/data.py +428 -0
- tnfr/utils/data.pyi +74 -0
- tnfr/utils/graph.py +85 -0
- tnfr/utils/graph.pyi +10 -0
- tnfr/utils/init.py +821 -0
- tnfr/utils/init.pyi +80 -0
- tnfr/utils/io.py +559 -0
- tnfr/utils/io.pyi +66 -0
- tnfr/utils/numeric.py +114 -0
- tnfr/utils/numeric.pyi +21 -0
- tnfr/validation/__init__.py +257 -0
- tnfr/validation/__init__.pyi +85 -0
- tnfr/validation/compatibility.py +460 -0
- tnfr/validation/compatibility.pyi +6 -0
- tnfr/validation/config.py +73 -0
- tnfr/validation/graph.py +139 -0
- tnfr/validation/graph.pyi +18 -0
- tnfr/validation/input_validation.py +755 -0
- tnfr/validation/invariants.py +712 -0
- tnfr/validation/rules.py +253 -0
- tnfr/validation/rules.pyi +44 -0
- tnfr/validation/runtime.py +279 -0
- tnfr/validation/runtime.pyi +28 -0
- tnfr/validation/sequence_validator.py +162 -0
- tnfr/validation/soft_filters.py +170 -0
- tnfr/validation/soft_filters.pyi +32 -0
- tnfr/validation/spectral.py +164 -0
- tnfr/validation/spectral.pyi +42 -0
- tnfr/validation/validator.py +1266 -0
- tnfr/validation/window.py +39 -0
- tnfr/validation/window.pyi +1 -0
- tnfr/visualization/__init__.py +98 -0
- tnfr/visualization/cascade_viz.py +256 -0
- tnfr/visualization/hierarchy.py +284 -0
- tnfr/visualization/sequence_plotter.py +784 -0
- tnfr/viz/__init__.py +60 -0
- tnfr/viz/matplotlib.py +278 -0
- tnfr/viz/matplotlib.pyi +35 -0
- tnfr-8.5.0.dist-info/METADATA +573 -0
- tnfr-8.5.0.dist-info/RECORD +353 -0
- tnfr-8.5.0.dist-info/entry_points.txt +3 -0
- tnfr-3.0.3.dist-info/licenses/LICENSE.txt → tnfr-8.5.0.dist-info/licenses/LICENSE.md +1 -1
- tnfr/constants.py +0 -183
- tnfr/dynamics.py +0 -543
- tnfr/helpers.py +0 -198
- tnfr/main.py +0 -37
- tnfr/operators.py +0 -296
- tnfr-3.0.3.dist-info/METADATA +0 -35
- tnfr-3.0.3.dist-info/RECORD +0 -13
- {tnfr-3.0.3.dist-info → tnfr-8.5.0.dist-info}/WHEEL +0 -0
- {tnfr-3.0.3.dist-info → tnfr-8.5.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"""Adaptive learning system for TNFR.
|
|
2
|
+
|
|
3
|
+
This module implements high-level adaptive learning dynamics combining
|
|
4
|
+
emission (AL) and self-organization (T'HOL) operators into canonical
|
|
5
|
+
learning cycles. All functionality reuses existing TNFR infrastructure.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Sequence
|
|
11
|
+
|
|
12
|
+
from ..alias import get_attr
|
|
13
|
+
from ..constants.aliases import ALIAS_EPI, ALIAS_DNFR
|
|
14
|
+
from ..operators.definitions import (
|
|
15
|
+
Coherence,
|
|
16
|
+
Contraction,
|
|
17
|
+
Dissonance,
|
|
18
|
+
Emission,
|
|
19
|
+
Mutation,
|
|
20
|
+
Operator,
|
|
21
|
+
Reception,
|
|
22
|
+
Recursivity,
|
|
23
|
+
Resonance,
|
|
24
|
+
SelfOrganization,
|
|
25
|
+
Silence,
|
|
26
|
+
Transition,
|
|
27
|
+
)
|
|
28
|
+
from ..structural import run_sequence
|
|
29
|
+
from ..types import TNFRGraph
|
|
30
|
+
|
|
31
|
+
__all__ = ["AdaptiveLearningSystem"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AdaptiveLearningSystem:
|
|
35
|
+
"""System for adaptive learning using TNFR operators.
|
|
36
|
+
|
|
37
|
+
This class orchestrates adaptive learning cycles combining emission (AL),
|
|
38
|
+
reception (EN), self-organization (T'HOL), and stabilization (IL) operators.
|
|
39
|
+
It implements the canonical learning sequences defined in the TNFR manual.
|
|
40
|
+
|
|
41
|
+
All methods reuse existing operators and run_sequence infrastructure.
|
|
42
|
+
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
graph : TNFRGraph
|
|
46
|
+
Graph containing the learning node.
|
|
47
|
+
node : Any
|
|
48
|
+
Node identifier for the learning entity.
|
|
49
|
+
learning_rate : float, default=1.0
|
|
50
|
+
Sensitivity to dissonance that triggers reorganization. Higher values
|
|
51
|
+
make the system more responsive to novel stimuli.
|
|
52
|
+
consolidation_threshold : float, default=0.7
|
|
53
|
+
ΔNFR threshold below which the system stabilizes. Lower values mean
|
|
54
|
+
earlier consolidation.
|
|
55
|
+
|
|
56
|
+
Attributes
|
|
57
|
+
----------
|
|
58
|
+
G : TNFRGraph
|
|
59
|
+
Reference to the graph.
|
|
60
|
+
node : Any
|
|
61
|
+
Node being managed.
|
|
62
|
+
learning_rate : float
|
|
63
|
+
Configured learning sensitivity.
|
|
64
|
+
consolidation_threshold : float
|
|
65
|
+
Configured consolidation trigger.
|
|
66
|
+
|
|
67
|
+
Examples
|
|
68
|
+
--------
|
|
69
|
+
>>> from tnfr.structural import create_nfr
|
|
70
|
+
>>> from tnfr.dynamics.learning import AdaptiveLearningSystem
|
|
71
|
+
>>> G, node = create_nfr("learner", epi=0.3, vf=1.0)
|
|
72
|
+
>>> system = AdaptiveLearningSystem(G, node, learning_rate=0.8)
|
|
73
|
+
>>> # Basic learning cycle
|
|
74
|
+
>>> system.learn_from_input(stimulus=0.5, consolidate=True)
|
|
75
|
+
>>> # Consolidate memory
|
|
76
|
+
>>> system.consolidate_memory()
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
def __init__(
|
|
80
|
+
self,
|
|
81
|
+
graph: TNFRGraph,
|
|
82
|
+
node: Any,
|
|
83
|
+
learning_rate: float = 1.0,
|
|
84
|
+
consolidation_threshold: float = 0.7,
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Initialize adaptive learning system."""
|
|
87
|
+
self.G = graph
|
|
88
|
+
self.node = node
|
|
89
|
+
self.learning_rate = learning_rate
|
|
90
|
+
self.consolidation_threshold = consolidation_threshold
|
|
91
|
+
|
|
92
|
+
def learn_from_input(
|
|
93
|
+
self,
|
|
94
|
+
stimulus: float,
|
|
95
|
+
consolidate: bool = True,
|
|
96
|
+
) -> None:
|
|
97
|
+
"""Execute learning cycle from external stimulus.
|
|
98
|
+
|
|
99
|
+
Implements canonical learning sequence following TNFR grammar:
|
|
100
|
+
- AL (Emission): Activate learning readiness
|
|
101
|
+
- EN (Reception): Receive stimulus
|
|
102
|
+
- IL (Coherence): Stabilize before dissonance (grammar requirement)
|
|
103
|
+
- OZ (Dissonance): If stimulus is dissonant
|
|
104
|
+
- T'HOL (SelfOrganization): Reorganize if needed
|
|
105
|
+
- NUL (Contraction): Close T'HOL block (grammar requirement)
|
|
106
|
+
- IL (Coherence): Consolidate if requested
|
|
107
|
+
- SHA (Silence): End sequence properly
|
|
108
|
+
|
|
109
|
+
Parameters
|
|
110
|
+
----------
|
|
111
|
+
stimulus : float
|
|
112
|
+
External input value to learn from.
|
|
113
|
+
consolidate : bool, default=True
|
|
114
|
+
Whether to stabilize after learning.
|
|
115
|
+
|
|
116
|
+
Notes
|
|
117
|
+
-----
|
|
118
|
+
Reuses run_sequence and existing operators for all transformations.
|
|
119
|
+
Dissonance detection uses current EPI from node attributes.
|
|
120
|
+
Sequences must follow TNFR grammar rules including T'HOL closure.
|
|
121
|
+
|
|
122
|
+
**Grammar compliance:**
|
|
123
|
+
|
|
124
|
+
- T'HOL (SelfOrganization) blocks require closure with NUL (Contraction) or SHA (Silence)
|
|
125
|
+
- Dissonance should be preceded by stabilization (Coherence)
|
|
126
|
+
"""
|
|
127
|
+
sequence: list[Operator] = [Emission(), Reception()]
|
|
128
|
+
|
|
129
|
+
# Check if stimulus is dissonant (requires reorganization)
|
|
130
|
+
if self._is_dissonant(stimulus):
|
|
131
|
+
# For dissonant input, follow grammar-compliant reorganization
|
|
132
|
+
# T'HOL block must be closed with SILENCE or CONTRACTION
|
|
133
|
+
sequence.extend(
|
|
134
|
+
[
|
|
135
|
+
Coherence(), # Stabilize before dissonance (grammar)
|
|
136
|
+
Dissonance(), # Introduce controlled instability
|
|
137
|
+
SelfOrganization(), # Autonomous reorganization
|
|
138
|
+
Silence(), # Close T'HOL block and end sequence (grammar requirement)
|
|
139
|
+
]
|
|
140
|
+
)
|
|
141
|
+
else:
|
|
142
|
+
# Non-dissonant: simpler path with optional consolidation
|
|
143
|
+
if consolidate:
|
|
144
|
+
sequence.append(Coherence())
|
|
145
|
+
sequence.append(Silence()) # Always end with terminal operator
|
|
146
|
+
|
|
147
|
+
# Execute using canonical run_sequence
|
|
148
|
+
run_sequence(self.G, self.node, sequence)
|
|
149
|
+
|
|
150
|
+
def _is_dissonant(self, stimulus: float) -> bool:
|
|
151
|
+
"""Determine if stimulus requires reorganization.
|
|
152
|
+
|
|
153
|
+
Parameters
|
|
154
|
+
----------
|
|
155
|
+
stimulus : float
|
|
156
|
+
External stimulus value.
|
|
157
|
+
|
|
158
|
+
Returns
|
|
159
|
+
-------
|
|
160
|
+
bool
|
|
161
|
+
True if stimulus differs significantly from current EPI.
|
|
162
|
+
|
|
163
|
+
Notes
|
|
164
|
+
-----
|
|
165
|
+
Reuses get_attr for accessing node EPI canonically.
|
|
166
|
+
"""
|
|
167
|
+
current_epi = float(get_attr(self.G.nodes[self.node], ALIAS_EPI, 0.0))
|
|
168
|
+
return abs(stimulus - current_epi) > self.learning_rate
|
|
169
|
+
|
|
170
|
+
def consolidate_memory(self) -> None:
|
|
171
|
+
"""Execute memory consolidation cycle.
|
|
172
|
+
|
|
173
|
+
Implements canonical consolidation sequence:
|
|
174
|
+
- AL (Emission): Reactivate for consolidation
|
|
175
|
+
- EN (Reception): Integrate memory
|
|
176
|
+
- IL (Coherence): Stabilize structure
|
|
177
|
+
- REMESH (Recursivity): Recursive consolidation
|
|
178
|
+
|
|
179
|
+
Notes
|
|
180
|
+
-----
|
|
181
|
+
Reuses run_sequence and existing operators for consolidation.
|
|
182
|
+
This sequence is useful for post-learning stabilization.
|
|
183
|
+
Follows TNFR grammar: must start with emission and include reception->coherence.
|
|
184
|
+
"""
|
|
185
|
+
sequence = [Emission(), Reception(), Coherence(), Recursivity()]
|
|
186
|
+
run_sequence(self.G, self.node, sequence)
|
|
187
|
+
|
|
188
|
+
def adaptive_cycle(self, num_iterations: int = 10) -> None:
|
|
189
|
+
"""Execute full adaptive learning cycle with exploration.
|
|
190
|
+
|
|
191
|
+
Implements iterative learning with conditional stabilization:
|
|
192
|
+
- Each iteration: AL -> EN -> IL -> THOL with closure
|
|
193
|
+
- Stabilizes with SILENCE if ΔNFR below threshold
|
|
194
|
+
- Continues exploring with DISSONANCE if ΔNFR above threshold
|
|
195
|
+
|
|
196
|
+
Parameters
|
|
197
|
+
----------
|
|
198
|
+
num_iterations : int, default=10
|
|
199
|
+
Number of learning iterations to execute.
|
|
200
|
+
|
|
201
|
+
Notes
|
|
202
|
+
-----
|
|
203
|
+
Reuses operators and _should_stabilize logic for adaptive behavior.
|
|
204
|
+
Each iteration applies a grammar-compliant sequence.
|
|
205
|
+
T'HOL requires proper context (AL -> EN -> IL) and closure (SILENCE/CONTRACTION).
|
|
206
|
+
"""
|
|
207
|
+
for _ in range(num_iterations):
|
|
208
|
+
# Grammar-compliant activation sequence
|
|
209
|
+
Emission()(self.G, self.node)
|
|
210
|
+
Reception()(self.G, self.node)
|
|
211
|
+
Coherence()(self.G, self.node)
|
|
212
|
+
|
|
213
|
+
# Self-organization: autonomous reorganization
|
|
214
|
+
SelfOrganization()(self.G, self.node)
|
|
215
|
+
|
|
216
|
+
# T'HOL requires closure
|
|
217
|
+
Silence()(self.G, self.node)
|
|
218
|
+
|
|
219
|
+
def _should_stabilize(self) -> bool:
|
|
220
|
+
"""Decide whether to stabilize based on current ΔNFR.
|
|
221
|
+
|
|
222
|
+
Returns
|
|
223
|
+
-------
|
|
224
|
+
bool
|
|
225
|
+
True if ΔNFR is below consolidation threshold.
|
|
226
|
+
|
|
227
|
+
Notes
|
|
228
|
+
-----
|
|
229
|
+
Reuses get_attr for accessing ΔNFR canonically.
|
|
230
|
+
Low ΔNFR indicates structure is settling and ready for consolidation.
|
|
231
|
+
"""
|
|
232
|
+
dnfr = abs(float(get_attr(self.G.nodes[self.node], ALIAS_DNFR, 0.0)))
|
|
233
|
+
return dnfr < self.consolidation_threshold
|
|
234
|
+
|
|
235
|
+
def deep_learning_cycle(self) -> None:
|
|
236
|
+
"""Execute deep learning with crisis and reorganization.
|
|
237
|
+
|
|
238
|
+
Implements canonical deep learning sequence:
|
|
239
|
+
AL -> EN -> IL -> OZ -> THOL -> IL -> (SHA or NUL)
|
|
240
|
+
|
|
241
|
+
The final operator (SHA/SILENCE or NUL/CONTRACTION) is selected by
|
|
242
|
+
the TNFR grammar based on structural conditions:
|
|
243
|
+
- SHA (SILENCE) if Si >= si_high (high sense index)
|
|
244
|
+
- NUL (CONTRACTION) if Si < si_high (low sense index)
|
|
245
|
+
|
|
246
|
+
This is canonical THOL closure behavior per TNFR sec.4.
|
|
247
|
+
|
|
248
|
+
Notes
|
|
249
|
+
-----
|
|
250
|
+
Reuses run_sequence with predefined deep learning pattern.
|
|
251
|
+
Grammar may adaptively select the appropriate THOL closure.
|
|
252
|
+
"""
|
|
253
|
+
sequence = [
|
|
254
|
+
Emission(),
|
|
255
|
+
Reception(),
|
|
256
|
+
Coherence(),
|
|
257
|
+
Dissonance(),
|
|
258
|
+
SelfOrganization(),
|
|
259
|
+
Coherence(),
|
|
260
|
+
Silence(), # Grammar may replace with Contraction if Si < si_high
|
|
261
|
+
]
|
|
262
|
+
run_sequence(self.G, self.node, sequence)
|
|
263
|
+
|
|
264
|
+
def exploratory_learning_cycle(self) -> None:
|
|
265
|
+
"""Execute exploratory learning with enhanced propagation.
|
|
266
|
+
|
|
267
|
+
Implements canonical exploratory learning sequence:
|
|
268
|
+
AL -> EN -> IL -> OZ -> THOL -> IL -> SHA
|
|
269
|
+
|
|
270
|
+
After self-organization, coherence stabilizes and closes T'HOL,
|
|
271
|
+
then silence terminates.
|
|
272
|
+
|
|
273
|
+
Notes
|
|
274
|
+
-----
|
|
275
|
+
Reuses run_sequence with predefined exploratory pattern.
|
|
276
|
+
This is similar to deep_learning_cycle but focuses on consolidation.
|
|
277
|
+
Supports operational fractality (nested THOL allowed per sec.3.7).
|
|
278
|
+
"""
|
|
279
|
+
sequence = [
|
|
280
|
+
Emission(),
|
|
281
|
+
Reception(),
|
|
282
|
+
Coherence(),
|
|
283
|
+
Dissonance(),
|
|
284
|
+
SelfOrganization(),
|
|
285
|
+
Coherence(), # Stabilize and close T'HOL
|
|
286
|
+
Silence(), # Terminal operator
|
|
287
|
+
]
|
|
288
|
+
run_sequence(self.G, self.node, sequence)
|
|
289
|
+
|
|
290
|
+
def adaptive_mutation_cycle(self) -> None:
|
|
291
|
+
"""Execute transformative learning with mutation.
|
|
292
|
+
|
|
293
|
+
Implements canonical adaptive mutation sequence:
|
|
294
|
+
AL -> EN -> IL -> OZ -> ZHIR -> NAV
|
|
295
|
+
|
|
296
|
+
Notes
|
|
297
|
+
-----
|
|
298
|
+
Reuses run_sequence with predefined mutation pattern.
|
|
299
|
+
This represents transformative learning with phase transitions.
|
|
300
|
+
Follows TNFR grammar: dissonance before mutation, ends with transition.
|
|
301
|
+
"""
|
|
302
|
+
sequence = [
|
|
303
|
+
Emission(),
|
|
304
|
+
Reception(),
|
|
305
|
+
Coherence(),
|
|
306
|
+
Dissonance(),
|
|
307
|
+
Mutation(),
|
|
308
|
+
Transition(),
|
|
309
|
+
]
|
|
310
|
+
run_sequence(self.G, self.node, sequence)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Type stubs for adaptive learning module."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from ..types import TNFRGraph
|
|
6
|
+
|
|
7
|
+
class AdaptiveLearningSystem:
|
|
8
|
+
"""System for adaptive learning using TNFR operators."""
|
|
9
|
+
|
|
10
|
+
G: TNFRGraph
|
|
11
|
+
node: Any
|
|
12
|
+
learning_rate: float
|
|
13
|
+
consolidation_threshold: float
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
graph: TNFRGraph,
|
|
18
|
+
node: Any,
|
|
19
|
+
learning_rate: float = ...,
|
|
20
|
+
consolidation_threshold: float = ...,
|
|
21
|
+
) -> None: ...
|
|
22
|
+
def learn_from_input(
|
|
23
|
+
self,
|
|
24
|
+
stimulus: float,
|
|
25
|
+
consolidate: bool = ...,
|
|
26
|
+
) -> None: ...
|
|
27
|
+
def _is_dissonant(self, stimulus: float) -> bool: ...
|
|
28
|
+
def consolidate_memory(self) -> None: ...
|
|
29
|
+
def adaptive_cycle(self, num_iterations: int = ...) -> None: ...
|
|
30
|
+
def _should_stabilize(self) -> bool: ...
|
|
31
|
+
def deep_learning_cycle(self) -> None: ...
|
|
32
|
+
def exploratory_learning_cycle(self) -> None: ...
|
|
33
|
+
def adaptive_mutation_cycle(self) -> None: ...
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"""Structural metabolism implementation for TNFR.
|
|
2
|
+
|
|
3
|
+
T'HOL (Self-Organization) as metabolic process: receiving external stimuli,
|
|
4
|
+
reorganizing them autonomously into internal structure, and stabilizing results.
|
|
5
|
+
|
|
6
|
+
This module implements metabolic cycles that use T'HOL as the engine of
|
|
7
|
+
structural transformation and adaptation.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import TYPE_CHECKING, Any
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from ..types import NodeId, TNFRGraph
|
|
16
|
+
|
|
17
|
+
from ..alias import get_attr
|
|
18
|
+
from ..constants.aliases import ALIAS_DNFR
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"StructuralMetabolism",
|
|
22
|
+
"digest_stimulus",
|
|
23
|
+
"adaptive_metabolism",
|
|
24
|
+
"cascading_reorganization",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class StructuralMetabolism:
|
|
29
|
+
"""Implements T'HOL-based structural metabolism cycles.
|
|
30
|
+
|
|
31
|
+
T'HOL is not just self-organization - it's **structural metabolism**:
|
|
32
|
+
the capacity to digest external experience and reorganize it into
|
|
33
|
+
internal structure without external instruction.
|
|
34
|
+
|
|
35
|
+
**Metabolic Characteristics:**
|
|
36
|
+
|
|
37
|
+
- **Reception (EN)**: Ingests external stimulus
|
|
38
|
+
- **Reorganization (THOL)**: Autonomously transforms stimulus to structure
|
|
39
|
+
- **Stabilization (IL)**: Consolidates new structural configuration
|
|
40
|
+
|
|
41
|
+
This creates a complete metabolic cycle: EN → THOL → IL
|
|
42
|
+
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
graph : TNFRGraph
|
|
46
|
+
Graph containing the metabolizing node
|
|
47
|
+
node : NodeId
|
|
48
|
+
Identifier of the node performing metabolism
|
|
49
|
+
|
|
50
|
+
Attributes
|
|
51
|
+
----------
|
|
52
|
+
G : TNFRGraph
|
|
53
|
+
Reference to the graph
|
|
54
|
+
node : NodeId
|
|
55
|
+
Reference to the node identifier
|
|
56
|
+
metabolic_rate : float
|
|
57
|
+
Scaling factor for metabolic intensity (default 1.0)
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
>>> from tnfr.structural import create_nfr
|
|
62
|
+
>>> from tnfr.dynamics.metabolism import StructuralMetabolism
|
|
63
|
+
>>> G, node = create_nfr("cell", epi=0.5, vf=1.0)
|
|
64
|
+
>>> metabolism = StructuralMetabolism(G, node)
|
|
65
|
+
>>> # Digest external stimulus
|
|
66
|
+
>>> metabolism.digest(0.3) # doctest: +SKIP
|
|
67
|
+
>>> # Result: stimulus integrated and reorganized structurally
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
def __init__(self, graph: TNFRGraph, node: NodeId) -> None:
|
|
71
|
+
"""Initialize structural metabolism for a node.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
graph : TNFRGraph
|
|
76
|
+
Graph containing the node
|
|
77
|
+
node : NodeId
|
|
78
|
+
Node identifier
|
|
79
|
+
"""
|
|
80
|
+
self.G = graph
|
|
81
|
+
self.node = node
|
|
82
|
+
self.metabolic_rate = 1.0
|
|
83
|
+
|
|
84
|
+
def digest(self, tau: float = 0.08) -> None:
|
|
85
|
+
"""Metabolize external stimulus through complete metabolic cycle.
|
|
86
|
+
|
|
87
|
+
Implements the canonical metabolic sequence: EN → THOL → IL
|
|
88
|
+
|
|
89
|
+
1. Reception (EN): Receives external stimulus from neighbors
|
|
90
|
+
2. Reorganization (THOL): Autonomously transforms into structure
|
|
91
|
+
3. Stabilization (IL): Consolidates the result
|
|
92
|
+
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
tau : float
|
|
96
|
+
Bifurcation threshold for THOL (default 0.08)
|
|
97
|
+
|
|
98
|
+
Notes
|
|
99
|
+
-----
|
|
100
|
+
The metabolic rate modulates the intensity of each operation.
|
|
101
|
+
Lower tau increases likelihood of bifurcation during reorganization.
|
|
102
|
+
"""
|
|
103
|
+
from ..operators.definitions import Reception, SelfOrganization, Coherence
|
|
104
|
+
|
|
105
|
+
# 1. Receive external stimulus
|
|
106
|
+
Reception()(self.G, self.node)
|
|
107
|
+
|
|
108
|
+
# 2. Reorganize metabolically (T'HOL with controlled bifurcation)
|
|
109
|
+
SelfOrganization()(self.G, self.node, tau=tau)
|
|
110
|
+
|
|
111
|
+
# 3. Stabilize result
|
|
112
|
+
Coherence()(self.G, self.node)
|
|
113
|
+
|
|
114
|
+
def adaptive_metabolism(self, stress_level: float) -> None:
|
|
115
|
+
"""Adapt metabolic response to stress level.
|
|
116
|
+
|
|
117
|
+
High stress (dissonance) triggers deeper reorganization with
|
|
118
|
+
increased bifurcation probability. Low stress allows gentler
|
|
119
|
+
metabolic cycles.
|
|
120
|
+
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
stress_level : float
|
|
124
|
+
Level of structural stress/dissonance (0.0 to 1.0+)
|
|
125
|
+
- < 0.5: Moderate stress, gentle reorganization
|
|
126
|
+
- >= 0.5: High stress, deep reorganization with dissonance
|
|
127
|
+
|
|
128
|
+
Notes
|
|
129
|
+
-----
|
|
130
|
+
This implements adaptive structural metabolism where the depth
|
|
131
|
+
of reorganization scales with environmental pressure.
|
|
132
|
+
"""
|
|
133
|
+
from ..operators.definitions import (
|
|
134
|
+
Dissonance,
|
|
135
|
+
SelfOrganization,
|
|
136
|
+
Coherence,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
if stress_level >= 0.5:
|
|
140
|
+
# High stress: dissonance + deep reorganization
|
|
141
|
+
# Apply operators individually to avoid grammar restrictions
|
|
142
|
+
Dissonance()(self.G, self.node) # Introduce controlled instability
|
|
143
|
+
SelfOrganization()(
|
|
144
|
+
self.G, self.node, tau=0.08
|
|
145
|
+
) # Deep reorganization (likely bifurcates)
|
|
146
|
+
Coherence()(self.G, self.node) # Stabilize new configuration
|
|
147
|
+
else:
|
|
148
|
+
# Moderate stress: gentle reorganization
|
|
149
|
+
# Higher tau reduces bifurcation probability
|
|
150
|
+
SelfOrganization()(self.G, self.node, tau=0.15)
|
|
151
|
+
|
|
152
|
+
def cascading_reorganization(self, depth: int = 3) -> None:
|
|
153
|
+
"""Execute recursive T'HOL cascade.
|
|
154
|
+
|
|
155
|
+
Applies T'HOL multiple times with progressively decreasing
|
|
156
|
+
bifurcation thresholds, creating nested structural reorganization.
|
|
157
|
+
|
|
158
|
+
This implements operational fractality: reorganization at multiple
|
|
159
|
+
scales simultaneously.
|
|
160
|
+
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
depth : int
|
|
164
|
+
Number of cascade levels (default 3)
|
|
165
|
+
|
|
166
|
+
Notes
|
|
167
|
+
-----
|
|
168
|
+
Each level uses tau = 0.1 * (0.8 ^ level), creating progressively
|
|
169
|
+
more sensitive bifurcation at deeper levels.
|
|
170
|
+
|
|
171
|
+
**Warning**: Deep cascades (depth > 5) may create highly complex
|
|
172
|
+
nested structures. Monitor structural complexity metrics.
|
|
173
|
+
"""
|
|
174
|
+
from ..operators.definitions import SelfOrganization
|
|
175
|
+
|
|
176
|
+
for level in range(depth):
|
|
177
|
+
# Decreasing threshold: deeper levels bifurcate more easily
|
|
178
|
+
tau = 0.1 * (0.8**level)
|
|
179
|
+
SelfOrganization()(self.G, self.node, tau=tau)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def digest_stimulus(G: TNFRGraph, node: NodeId, tau: float = 0.08) -> None:
|
|
183
|
+
"""Functional interface for single metabolic cycle.
|
|
184
|
+
|
|
185
|
+
Equivalent to `StructuralMetabolism(G, node).digest(tau)`.
|
|
186
|
+
|
|
187
|
+
Parameters
|
|
188
|
+
----------
|
|
189
|
+
G : TNFRGraph
|
|
190
|
+
Graph containing the node
|
|
191
|
+
node : NodeId
|
|
192
|
+
Node identifier
|
|
193
|
+
tau : float
|
|
194
|
+
Bifurcation threshold
|
|
195
|
+
|
|
196
|
+
Examples
|
|
197
|
+
--------
|
|
198
|
+
>>> from tnfr.structural import create_nfr
|
|
199
|
+
>>> from tnfr.dynamics.metabolism import digest_stimulus
|
|
200
|
+
>>> G, node = create_nfr("neuron", epi=0.4, vf=1.2)
|
|
201
|
+
>>> digest_stimulus(G, node, tau=0.1) # doctest: +SKIP
|
|
202
|
+
"""
|
|
203
|
+
metabolism = StructuralMetabolism(G, node)
|
|
204
|
+
metabolism.digest(tau)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def adaptive_metabolism(G: TNFRGraph, node: NodeId, stress: float) -> None:
|
|
208
|
+
"""Functional interface for adaptive metabolic response.
|
|
209
|
+
|
|
210
|
+
Equivalent to `StructuralMetabolism(G, node).adaptive_metabolism(stress)`.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
G : TNFRGraph
|
|
215
|
+
Graph containing the node
|
|
216
|
+
node : NodeId
|
|
217
|
+
Node identifier
|
|
218
|
+
stress : float
|
|
219
|
+
Stress level (0.0 to 1.0+)
|
|
220
|
+
|
|
221
|
+
Examples
|
|
222
|
+
--------
|
|
223
|
+
>>> from tnfr.structural import create_nfr
|
|
224
|
+
>>> from tnfr.dynamics.metabolism import adaptive_metabolism
|
|
225
|
+
>>> G, node = create_nfr("organism", epi=0.6, vf=1.0)
|
|
226
|
+
>>> adaptive_metabolism(G, node, stress=0.7) # doctest: +SKIP
|
|
227
|
+
"""
|
|
228
|
+
metabolism = StructuralMetabolism(G, node)
|
|
229
|
+
metabolism.adaptive_metabolism(stress)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def cascading_reorganization(G: TNFRGraph, node: NodeId, depth: int = 3) -> None:
|
|
233
|
+
"""Functional interface for cascading reorganization.
|
|
234
|
+
|
|
235
|
+
Equivalent to `StructuralMetabolism(G, node).cascading_reorganization(depth)`.
|
|
236
|
+
|
|
237
|
+
Parameters
|
|
238
|
+
----------
|
|
239
|
+
G : TNFRGraph
|
|
240
|
+
Graph containing the node
|
|
241
|
+
node : NodeId
|
|
242
|
+
Node identifier
|
|
243
|
+
depth : int
|
|
244
|
+
Cascade depth
|
|
245
|
+
|
|
246
|
+
Examples
|
|
247
|
+
--------
|
|
248
|
+
>>> from tnfr.structural import create_nfr
|
|
249
|
+
>>> from tnfr.dynamics.metabolism import cascading_reorganization
|
|
250
|
+
>>> G, node = create_nfr("system", epi=0.7, vf=1.1)
|
|
251
|
+
>>> cascading_reorganization(G, node, depth=3) # doctest: +SKIP
|
|
252
|
+
"""
|
|
253
|
+
metabolism = StructuralMetabolism(G, node)
|
|
254
|
+
metabolism.cascading_reorganization(depth)
|