Page MenuHomeSoftware Heritage

graph API: add endpoint to return the leaves of a subgraph
Closed, MigratedEdits Locked

Description

To handle some of the provenance-related use cases of the graph service, we need to be able to perform visits on specific graph sub-graphs, but we are only interested in returning the final nodes of the visit.

One example is the following use case (others are described in P461):

  • complete commit provenance: given a content or directory node, return all commits whose directory (recursively) contains it

We could in theory add another query parameter to the various visit methods, but this corresponds to a well defined notion, so it probably deserves a dedicated endpoint. What we want is to return all leaves of the subgraph rooted at the starting node and identified by the given edge restrictions. So, concrete proposal:

  • method: /graph/leaves/:src
  • return: list of PIDs of the leaves of the subgraph rooted at :src
  • query params: edges, direction with the usual semantics and default values