The hierarchical structure of nodes is as follows:
{
"nodes":[
{
"assetId":"cfe-3a2b-47e7-b7e9-e2e090ca0d34",
"assetName":"IRCTC",
"assetType":"Company"
},
{
"assetId":"32d9-05b8-4293-af55-2ee4617c6ffe",
"assetName":"Northern Railway Fleet",
"assetType":"Fleet"
},
{
"assetId":"15-b76c-426c-a272-6485359c5836",
"assetName":"Vande Bharat Express",
"assetType":"Train"
}
],
"edges":[
{
"source":"cfe-3a2b-47e7-b7e9-e2e090ca0d34",
"destination":"32d9-05b8-4293-af55-2ee4617c6ffe",
"relation":"HAS"
},
{
"source":"32d9-05b8-4293-af55-2ee4617c6ffe",
"destination":"15-b76c-426c-a272-6485359c5836",
"relation": "HAS"
}
]
}
Essentially, the nodes contain a list of assets and the edges represent their relationships or mappings. To traverse the nodes, let's consider an example where I create a function called
generateTrail("15-b76c-426c-a272-6485359c5836");
This function should search for the given node ID in the edges object and fetch its parent.
The breadcrumb trail would be:
"IRCTC > Northern Railway Fleet > Vande Bharat Express"