# Graph Design Patterns

# Graph Design Patterns

This page collects practical graph modeling patterns that tend to work well for Curiosity Workspace applications.

# Pattern: Entity-centric navigation

Design around “hub” entities users care about:

  • customer, product, ticket, document, case

Ensure each hub has:

  • stable key
  • meaningful outgoing edges
  • a small set of high-signal properties (for display/search)

# Pattern: Relationship as first-class signal

If users frequently ask “show items related to X”, model that as an edge:

  • Ticket -> ForCustomer -> Customer
  • Document -> Mentions -> Entity
  • Case -> HasStatus -> Status

This enables:

  • fast traversal and exploration
  • graph-constrained search
  • related facets

# Pattern: Attributes as nodes (selectively)

Convert a property into a node when you need:

  • cross-type filtering (shared status taxonomy)
  • navigation (“click status to see all items”)
  • metadata on the attribute (owner, definition, lifecycle)

Don’t overuse this: many attributes are best kept as properties.

# Pattern: Mention → resolve → link

When important concepts appear inside text:

  1. extract mentions via NLP
  2. resolve to canonical entities (or create entities)
  3. link into the graph

This pattern turns unstructured text into navigable structure.

# Pattern: Graph + search together

Search retrieves candidates; the graph provides context:

  • use search to find starting nodes
  • use graph traversal for “next clicks” and constrained neighborhoods
  • use facets and related facets to keep results meaningful

# Pattern: Many-to-Many relationships

Model many-to-many relationships using edges with properties:

  • User -> AssignedToProject -> Project: A user can be on many projects, and projects have many users.
  • Use edge properties to store metadata about the relationship (e.g., role_on_project, date_assigned).

# Pattern: Hierarchical structures

Represent hierarchies (org charts, folder structures) using recursive edges:

  • Employee -> ReportsTo -> Employee
  • Category -> SubCategoryOf -> Category
  • Use path queries to traverse up or down the hierarchy.

# Pattern: Versioned data and time-travel

Handle data that changes over time without losing history:

  • Snapshot Pattern: Create a new node for each version, linked to a "canonical" node.
  • Validity Dates: Use properties like valid_from and valid_to on nodes or edges.
  • Activity Log: Model changes as a series of event nodes linked to the subject entity.

# Next steps