Relational vs. Graph Data Model Side-by-Side
Description
Click a table key cell or graph edge to highlight the corresponding relationship in both models. The relationship selector provides the same actions with a keyboard. Count the Hops traces the provider-to-facility-to-payer question in three timed steps. Reset stops the traversal and removes the added payer.
Modeling Notes
The source specification lists four tables but also refers to an Encounters row and a payer absent from that list. The implementation adds the encounter bridge table, then reveals Payers and the facility payer_id for the traversal exercise. Join conditions match foreign keys to primary keys, not two foreign keys in every case. The sample provider is Dr. Patel; the payer relationship is a simplified teaching model, not a complete billing schema. Logical operation counts are not performance benchmarks.
Lesson Plan
Audience: undergraduate students and healthcare data practitioners. Allow 10–15 minutes. Prerequisites: nodes, edges, labels, and properties; for the comparison, also primary and foreign keys.
Learning objective: Given the same four healthcare facts modeled two ways, the learner can differentiate how a relational schema and a graph data model each represent an identical relationship, and can trace the extra steps the relational version requires.
- Explore: Select WORKS_AT from both sides and explain the matching primary-key and foreign-key values. Predict the number of joins and graph hops needed for the payer question, then run Count the Hops.
- Explain: Explain why this encounter bridge requires two joins for the patient–provider fact, while the graph stores one TREATED_BY edge. Report the complete route: four joins and three graph hops.
- Transfer: Sketch a different healthcare example using the same concept and explain one modeling assumption.
Assessment: use the explanation prompt above as an exit ticket. A complete response names the relevant graph elements, traces the displayed evidence, and distinguishes a modeling assumption from a general claim.
Embed This MicroSim
Copy this iframe to your website:
1 | |
Quality Checks
Validated September 7, 2026. Completeness rubric: 100/100. Browser interaction tests passed at 400, 800, and 1200 px, including reset and keyboard controls; no JavaScript errors were observed. Iframe visibility and visual layout checks passed. The iframe resizes to its rendered content, with the declared height serving as a fallback.
Specification
The full specification below is extracted from Chapter 2: Data Modeling: Graphs vs. Relational Databases.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Related Resources
References
- Source chapter — supplied learning objective and teaching example.
- p5.js canvas reference — rendering and interaction reference (accessed September 7, 2026).
- p5.js web editor — paste the JavaScript source to experiment; no hosted sketch has been published.