Skip to content

GID Graph format

Mihhail Sokolov edited this page Jun 1, 2020 · 2 revisions

This page briefly describes the format of the GID Graph which is produced by the Metadata Plugin and consumed by Graph Plugin.

GID Graph represents a graph with both internal and external nodes and edges between them. GID stands for Global Identifier which means that all nodes in the graph are globally unique because they were generated by Metadata Database (PostgreSQL).

Below is the example of the GID Graph that is used to communicate between Metadata and Graph Plugins:

{
    "index": 1,
    "product": "test",
    "version": "0.0.1",
    "nodes": [0, 1, 2],
    "numInternalNodes": 2,
    "edges": [[0, 1], [1, 2]]
}
  • index is the ID of the package version of the product generated by the Metadata Database. It is needed to be able to retrieve a graph from the Graph Database by its corresponding global index of package version.
  • product is the name of the package which is being saved i.e <groupId>.<artifactId>
  • version is the version of the package that is being saved
  • nodes is the array of GIDs of corresponding nodes. Important! In the array of nodes, there must be first listed all internal nodes, and only then all external. This order is important to be able to differentiate between internal and external nodes
  • numInternalNodes is the number of the internal nodes listed in the nodes array
  • edges is the array of arrays (pairs) of nodes that represents edges of the graph. NB! If there are any nodes in the edges which weren't listed in the nodes array, IllegalArgumentException will be thrown in Graph Plugin upon consumption of such GID graph