liveBook · Manning

Shortest-path detection

As explained in Knowledge Graphs and LLMs in Action

Shortest-path detection is the computation of minimum-cost routes between nodes in a graph.

Shortest-path detection finds the shortest graph connections between candidate biomedical entities and supplies relational context for named entity disambiguation. The pipeline excludes highly connected hub nodes, searches paths of one or two relationships, and formats retained paths as readable relationship strings. section 8.4.3

A practical detection pipeline performs these operations:

  • Calculate node degree with `gds.degree.stream` and collect highly connected nodes for exclusion as generic hubs. section 8.4.3
  • Unwind each path, collect its nodes and relationships, and render directional strings such as `(n1)-[:REL_TYPE]->(n2)`. section 8.4.3

SNOMED candidate context

A detected path links Congenital Zika virus infection to Congenital through an OCCURRENCE relationship, then links Congenital to Micrencephaly, Acrocephaly, and other congenital malformations. Summarizing these links gives the LLM shared biomedical context for disambiguation.

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains degree filtering, one- or two-hop searches, path formatting, and downstream translation, but not graph algorithm internals.
Examples
Demonstrates SNOMED paths linking Congenital Zika virus infection, Micrencephaly, and Acrocephaly through Congenital.
What it assumes
Assumes graph nodes, relationships, candidate entities, and ontology identifiers while demonstrating path formatting for LLM consumption.
What you can do after
Apply it via Neo4j GDS to extract filtered ontology paths and provide structured context for entity disambiguation.
How it connects
Connects Neo4j GDS, graph databases, ontologies, named entity disambiguation, large language models, and path-to-text translation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.