Building Graphs from Input Records
Input records can describe vertices, connections, and attributes. A validation step resolves which named endpoints exist and which repeats are allowed.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Resolve two data passes
Import station IDs first, then read links from A to B. Both endpoints must refer to known stations. Two-pass indexing allows a link to appear earlier in the file than the record it names.
Treat repeat links deliberately
A duplicated A-to-B row might repeat a measurement or represent a separate train service. A graph allowing parallel edges needs distinct service identities to preserve that distinction.[1]
Validate IDs before linking endpoints
Suppose the vertex records declare A and C, while an edge row connects A to B. B has no declared record. Depending on the format, the input either creates B implicitly or causes a dangling-reference error. Decide before running reachability. See two-pass index construction.
Declared IDs: A,C
Edge row: (A,B)
Strict schema: unknown endpoint B
Implicit schema: add vertex B and retain isolated C
Maintain edge attributes and duplicate policy during conversion
Several lines may report one edge repeated, or distinct edges with the same endpoints. A simple graph can merge them if the data model allows it. A weighted or labeled edge list may need to retain both. Test duplicate vertex IDs and repeated endpoints separately.