spatial_graph_algorithms.verify
One-call pipeline runner that bundles simulation, reconstruction, and all output artefacts into a single directory.
Output artefacts
| File | Contents |
|---|---|
report.csv |
Graph properties, shortest-path stats, false-edge stats |
degree_distribution.csv |
Per-degree node counts and proportions |
run_parameters.csv |
The simulation_kwargs dict as a single CSV row |
reconstruction_quality.csv |
CPD, KNN, distortion per method |
{prefix}_network.png |
2-D graph layout with false-edge colouring |
{prefix}_edge_length_histogram.png |
Edge-length distribution |
comparison_{method}.png |
Original vs reconstructed side-by-side |
API Reference
spatial_graph_algorithms.verify.VerifyConfig
dataclass
Configuration for :func:~spatial_graph_algorithms.verify.run_report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_root
|
Path
|
Root directory under which a subdirectory named run_id is created
for all output artefacts. Default is
|
Path('.planning/artifacts/verification_runs')
|
run_id
|
str
|
Identifier for this run. If |
None
|
prefix
|
str
|
Filename prefix for generated plots. Default is |
'verify'
|
reconstruct_methods
|
list of str
|
Reconstruction methods to run. Each element must be a valid method
name accepted by :func: |
list()
|
Examples:
>>> from spatial_graph_algorithms.verify import VerifyConfig
>>> cfg = VerifyConfig(
... output_root="results/",
... run_id="experiment_01",
... reconstruct_methods=["mds", "strnd"],
... )
Source code in src/spatial_graph_algorithms/verify/config.py
spatial_graph_algorithms.verify.run_report
End-to-end pipeline: simulate → visualise → reconstruct → evaluate → report.
Classes
Functions
run_report(*, simulation_kwargs, config=None)
Run a full simulation + analysis pipeline and write all artefacts to disk.
Generates a synthetic graph, computes graph properties, optionally runs reconstruction and quality evaluation, and saves everything to a timestamped run directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
simulation_kwargs
|
dict
|
Keyword arguments forwarded to :func: |
required |
config
|
VerifyConfig
|
Pipeline configuration. If |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary with keys:
|
Notes
The following files are always written to run_dir:
report.csv— graph properties + shortest-path stats + false-edge stats.degree_distribution.csv— per-degree counts and proportions.run_parameters.csv— thesimulation_kwargsdict as a single row.{prefix}_network.png— 2-D graph layout plot.{prefix}_edge_length_histogram.png— edge-length distribution.
When :attr:~VerifyConfig.reconstruct_methods is non-empty, these are also written:
reconstruction_quality.csv— CPD, KNN, distortion per method.comparison_{method}.png— original vs reconstructed side-by-side.
Examples:
>>> from spatial_graph_algorithms.verify import VerifyConfig, run_report
>>> out = run_report(
... simulation_kwargs=dict(n=300, mode="delaunay_corrected", seed=42),
... config=VerifyConfig(
... output_root="results/",
... run_id="demo",
... reconstruct_methods=["mds", "strnd"],
... ),
... )
>>> out["run_dir"].exists()
True
Source code in src/spatial_graph_algorithms/verify/run_report.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |