liveBook · Manning

Graph schema

As explained in Graph Algorithms for Data Science

A graph schema is a specification of the permissible node categories, relationship types, properties, and structural constraints in a graph.

A graph schema specifies the node labels, relationship types, properties, and structural choices permitted in a graph. It grows iteratively as modeling decisions accumulate and may change to support important queries. section 2.3.4 section 2.4.4

Represent an LPG graph schema by:

  • Drawing one node for each node label, then attaching properties and optionally showing example values or data types. section 2.3.4
  • Drawing relationships between label nodes; relationships between the same label appear as self-loops. section 2.3.4
  • Reading direction and constraints carefully, because no agreed visualization convention indicates semantic direction, optional properties, or unique identifiers. section 2.3.4
  • Leaving inferred relationships out until the assumptions behind their instantiation are established. section 2.4.4

Twitter network schema

A final Twitter graph schema can contain four node labels—users, tweets, hashtags, and links—and six relationship types. Direct relationships may later represent transformations such as user amplification inferred from tweet retweets, but those inferred edges remain outside the initial schema. section 2.4.4

Figure 2.28 Final Twitter social network graph schema representation
02-28

Inspect the final Twitter schema representation to see how node labels and relationship types combine into a complete graph design. section 2.4.4

How Graph Algorithms for Data Science covers it

How deep it goes
Explains LPG schema notation and practical omissions, but stops short of formal standards for direction, optionality, or uniqueness.
Examples
Uses Twitter users, tweets, hashtags, links, follows, retweets, and inferred amplification relationships.
What you can do after
Build it from scratch by combining modeling decisions into a self-describing schema and reserving inferred edges for later validation.
How it connects
Connects labeled-property graphs with graph models, inferred relationships, graph-pattern query languages, and network projections.

Also explained in

Compare how 2 books explain graph schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.