Files
lucidia-main/codex/mirror/README_graph_network.md
Alexa Amundson 855585cb0e sync: update from blackroad-operator 2026-03-14
Synced from BlackRoad-OS-Inc/blackroad-operator/orgs/personal/lucidia
BlackRoad OS — Pave Tomorrow.

RoadChain-SHA2048: fe729062952871e7
RoadChain-Identity: alexa@sovereign
RoadChain-Full: fe729062952871e77147cf6d938b799096e87d9024d7005a14c9e209e12e8ad0c825b624c7bc649fc7eeb4c284fdcab8231af77980065cc04d9f36fca479ffc2346ed3c1b73de6f240d8f9485f47c995ad5b81142f7179b84932c67914dff1c08db039349ba28fca36cb57688093bf0199268dd1c2f3448c9383000bc77cc9663066ff57b834370afc8838b18466ea9029908018b961555cccaabf2ce21649cf3cabc7f64bdcc4abdf2da259b210c342835a2cecf92bdd3b4e109b4d6e622f6934e13b2b123607bd61ce3d0f20454c9ab594f9284cffe18716619c52db57ce5f4ee2856cb96e1fa3748fe1fe65435bec297c5ab3ab58d570ec1064aea29931dd
2026-03-14 15:09:52 -05:00

2.5 KiB
Raw Blame History

Graph/Network Mirror Module

This document describes the graph_network_mirror.py module in the mirror directory.

Purpose

The graph network mirror implements a mirror operator for directed graphs represented by adjacency matrices. The mirror split decomposes a square adjacency matrix into a symmetric part (undirected edges) and an antisymmetric part (edge orientations). The breath operator evolves the adjacency matrix by taking two-hop connectivity and normalizing each row to preserve the original out-degree distribution. A delta-kick randomly toggles edges to model perturbations and tests the system's resilience.

Features

  • mirror_split_network(A) returns the symmetric (A + A.T)/2 and antisymmetric (A - A.T)/2 parts of the adjacency matrix.
  • degree_distribution(A) computes the out-degree distribution of the graph by summing each row of the adjacency matrix.
  • breath_update(A, target_deg) squares the adjacency matrix to compute two-step connectivity, then renormalizes rows to match a target degree distribution, preserving the invariant.
  • delta_kick(A, strength) randomly toggles strength directed edges (excluding self-loops) to simulate perturbations.
  • run_network_demo(...) demonstration function that creates a random directed graph, applies breath updates, introduces a delta-kick, records variance of the degree distribution over time, and saves results to an out_network/ directory as CSV and JSON.

Running the module

From the repository root, run:

python codex/mirror/graph_network_mirror.py

This will generate a random directed graph, apply the mirror/breath updates with a perturbation, and write degree_variance.csv and degree_variance.json in the out_network/ directory.

Dependencies

This module uses only the Python standard library and numpy for array operations. It writes outputs using csv, json, and creates directories with os.

Interpretation

The graph network mirror extends the mirror friend framework to network dynamics. Splitting the adjacency matrix into symmetric and antisymmetric parts corresponds to separating undirected connectivity from the orientation of edges. The breath update acts as a degree-preserving smoothing of connectivity, analogous to combining present and past states without losing the invariant. The delta-kick demonstrates how local perturbations (adding or removing edges) shift the network yet the overall invariants recover through subsequent breath steps.