graflo.architecture.evolution.merge_core¶
Pure merge helpers for logical vertices and edges.
Attributes¶
Classes¶
EdgeMergeError
¶
Bases: Refusal
Two declarations of one logical edge that disagree on what it is.
edge_id leaves type and by out so two sources can describe one
logical edge, which is what makes the disagreement expressible at all.
Source code in graflo/architecture/evolution/merge_core.py
VertexMergeError
¶
Bases: Refusal
Two vertex declarations that cannot be unioned into one.
Identity is the subject of every rule here. The four modes are mutually exclusive by construction, a funnel's branch order is its key, and a secondary identity's name is what an edge step selects by -- so none of them has a weaker-wins ordering the union could apply on the author's behalf.
into_name is the merged vertex the union was heading for, and
properties the offending names where the rule has them (the hash
properties, a secondary identity's field-set). subjects is empty: this
layer has no notion of left, right or merged -- it is reached from
merge, from merge_vertices and from a per-side canonicalize alike --
so the caller that knows the scope builds the ids.
Source code in graflo/architecture/evolution/merge_core.py
Functions:¶
merge_edge_pair(a, b)
¶
Merge two edges with the same :attr:~graflo.architecture.schema.edge.Edge.edge_id.
type / by must agree: edge_id leaves them out so two sources can
describe one logical edge, but a DIRECT edge and an INDIRECT one via
some vertex are different physical things with no weaker-wins ordering
between them (unlike directed), so disagreement raises rather than
keeping one side's silently.
Source code in graflo/architecture/evolution/merge_core.py
merge_vertex_models(vertices, into_name)
¶
Merge vertex definitions into a single :class:Vertex.
Identity mode is carried through the merge: blank / assigned propagate when
any source declares them, and hash_identity_properties / secondary_identities
are unioned. The mutual exclusions enforced by :meth:Vertex.set_identity are
checked here so the failure names the merge rather than surfacing from pydantic.
Source code in graflo/architecture/evolution/merge_core.py
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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
redirect_and_merge_edges(edges, mapping)
¶
Apply vertex mapping to endpoints, then merge duplicate edge identities.
Source code in graflo/architecture/evolution/merge_core.py
remap_relation_and_merge_edges(edges, relation_map)
¶
Remap edge relation names and merge duplicate edge identities.