AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
MULTIGRAPH ONTOLOGY
Kireth Semantic Library | Mathematical Entities | Graph and Network Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/graph-and-network-entities/multigraph-ontology.html
Version: 1.0 | Date: 2026-10-14 | Language: en-GB
Authors: Mark Higgins — Sky (Recursive AI)
Status: Proposed formalisation; source page wording not independently verified.
1. ENTITY DECLARATION
ENTITY Multigraph : GraphStructure
DEFINITION: A graph G=(V,E,inc) in which distinct edges may have the same endpoints. E is an edge-identity set; inc assigns endpoints to each edge.
CONTEXT: Graph theory, networks, transportation, knowledge representation, communication systems.
2. TYPED ENTITIES
Vertex : Node
Edge : IdentifiedRelation
UndirectedMultigraph : Multigraph
DirectedMultigraph : Multigraph
ParallelEdgeClass : Set[Edge]
Loop : Edge
IncidenceFunction : Edge -> EndpointPair
Multiplicity : NonNegativeInteger
Degree : NonNegativeInteger
Walk : Sequence[Vertex,Edge]
3. FORMAL STRUCTURE
UNDIRECTED: G=(V,E,inc), inc:E -> {{u,v} : u,v in V}, allowing u=v when loops are permitted.
DIRECTED: G=(V,E,src,dst), src:E -> V, dst:E -> V.
PARALLEL(e1,e2) := e1 != e2 AND inc(e1)=inc(e2) (undirected).
DIRECTED_PARALLEL(e1,e2) := e1 != e2 AND src(e1)=src(e2) AND dst(e1)=dst(e2).
MULTIPLICITY(u,v) := |{e in E : inc(e)={u,v}}| for an undirected multigraph.
SIMPLE_GRAPH_CONSTRAINT := no loops AND multiplicity(u,v) <= 1 for distinct u,v.
NOTE: Terminology varies: some definitions of multigraph exclude loops; record loop_policy explicitly.
4. AXIOMS AND INVARIANTS
A1: Every edge has a unique identity, even if endpoints coincide.
A2: Every edge endpoint belongs to V.
A3: Parallel edges are distinct edge entities, not duplicate records to collapse.
A4: For finite undirected multigraphs, sum(v in V) degree(v) = 2|E|; each loop contributes two to degree.
A5: For finite directed multigraphs, sum(v) indegree(v) = sum(v) outdegree(v) = |E|.
A6: Edge multiplicities are nonnegative integers.
A7: Reversing an arc generally changes its ordered endpoints; opposite arcs are not directed-parallel.
5. RELATIONSHIPS
Multigraph HAS_VERTEX Vertex
Multigraph HAS_EDGE Edge
Edge INCIDENT_TO Vertex
Edge HAS_SOURCE Vertex [directed only]
Edge HAS_TARGET Vertex [directed only]
Edge PARALLEL_TO Edge [same endpoint specification, distinct identities]
Multigraph SPECIALISES GraphStructure
Multigraph MAY_HAVE Loop [subject to loop_policy]
Multigraph SUPPORTS Walk
Multigraph HAS_MULTIPLICITY Multiplicity
6. FLOW OPERATIONS
flow AddVertex(G,v): require v not in V; return G with v included.
flow AddEdge(G,e,u,v): require u,v in V and e not in E; retain any existing parallel edges; return updated G.
flow CountMultiplicity(G,u,v): count edge identities with corresponding endpoint pair.
flow RemoveEdge(G,e): remove exactly edge identity e, not all edges sharing endpoints.
flow ProjectSimple(G): optionally remove loops and collapse each parallel-edge class to one adjacency; mark as information-losing.
flow CalculateDegree(G,v): count incident edge ends, with undirected loops counted twice.
flow Traverse(G,start): traverse edge identities and maintain their endpoints; do not assume unique edge per vertex pair.
7. INFERENCE RULES
R1: IF two distinct undirected edges share the same unordered endpoints THEN infer PARALLEL_TO.
R2: IF multiplicity(u,v)>1 THEN infer HAS_PARALLEL_EDGES(G).
R3: IF an edge has identical source and target THEN infer LOOP(e), where loops are permitted.
R4: IF a finite undirected multigraph is supplied THEN validate handshake identity.
R5: IF a simple-graph projection is applied THEN flag LOSS_OF_EDGE_IDENTITY and LOSS_OF_MULTIPLICITY.
R6: IF directed edges have opposite endpoints THEN do not infer directed parallelism.
8. SEMANTIC DISTINCTIONS
Multigraph != SimpleGraph: a simple graph forbids parallel edges and loops.
Multigraph != Hypergraph: a hyperedge can connect more than two vertices.
Multigraph != WeightedGraph: weights annotate edges; multiplicity denotes distinct edge identities. A graph may be both.
ParallelEdges != DuplicateData: equal endpoints do not imply identical edges.
DirectedMultigraph != UndirectedMultigraph: ordered versus unordered endpoint semantics.
9. VALIDATION
CHECK all edge identifiers unique.
CHECK endpoint membership in V.
CHECK loop_policy in {allowed,forbidden}.
CHECK directedness in {directed,undirected}.
CHECK multiplicities consistent with edge identity records.
CHECK degree sums against edge count for finite graphs.
CHECK edge deletion removes one identified edge only.
CHECK graph projection reports information loss.
10. CONFIDENCE AND PROVENANCE
CONFIDENCE: mathematical definitions and identities = high, subject to declared graph conventions.
SOURCE_STATUS: URL supplied; page text not independently verified.
PROVENANCE: Kireth Semantic Library target URL and formal mathematical graph theory.
SEMANTIC_EQUIVALENCE: only assert equivalence when directedness, loop policy, edge identity and multiplicity semantics agree.
11. FLOW HASH AND UPDATE MODEL
FLOW_HASH: SHA-256 of canonical UTF-8 representation after normalising line endings and excluding the FLOW_HASH value itself.
HASH_STATUS: specification only; no digest claimed.
UPDATE_MODEL: versioned; changing edge semantics, directedness or loop policy is a breaking change.
12. AI CONSUMPTION
AI_CONSUMPTION:
entity: Multigraph
graph_model: edge-identified
requires: [vertices, edges, endpoint_mapping, directedness, loop_policy]
preserves: [parallel_edge_identity, multiplicity, loops_if_allowed]
validates: [endpoint_integrity, degree_invariants, edge_identity]
inference_mode: typed_rules_with_explicit_assumptions
output: [validated_graph, derived_relationships, provenance, confidence]
END FLOW ALGEBRA