Deletion in Networks¶
Nodes and Links that are members of Networks may be deleted. When a Network refers to a Node or Link by its latest version (a.k.a. unpinned references), when the Node or Link is deleted, the change will be visible at the Network level, but the element will still remain a part of the Network. For this reason, analysis request results are not affected by network element deletion.
Note
To have an effect on financial modelling output, the contents of the network must be modified using UpdateNetwork to add or remove elements.
API Examples¶
“Unpinned” references¶
Given elements above, assume a network is created using all of them such that all element references indicate the latest version (no revision provided):
Request¶
CreateNetwork(
links=[
{
"id": 4
}, {
"id": 6
}, {
"id": 7
},
],
nodes=[
{
"id": 1
},
{
"id": 2
},
{
"id": 3
},
{
"id": 4
}
]
)
Response¶
{ "id": 100, "revision": 100 }
A simple metric for the entire structure is established:
Request¶
RunAnalysis(
{
"trial_range": [1, 10000],
"reference": {
"id": 100,
"revision": 100,
}
"distribution_metrics": {
"aggregation": "AEP",
"windows": [{"min": 0.0, "max": 1.0}] // Expected loss or AAL
}
}
)
Response¶
2000000
Now, delete one of the elements:
Request¶
DeleteNode(
reference={
"id": 1
}
)
Inspect the result using ReadNetwork(id=100)
(result pictured):
Metrics on this structure have not changed
Request¶
RunAnalysis(
{
"trial_range": [1, 10000],
"reference": {
"id": 100,
"revision": 100,
}
"distribution_metrics": {
"aggregation": "AEP",
"windows": [{"min": 0.0, "max": 1.0}] // Expected loss or AAL
}
}
)
Response¶
2000000
“Pinned” references¶
In this case, the network and its elements will all use specific revisions for every element reference (a.k.a. pinned references). The difference from the previous example is that the deletions are no longer observable in the elements of the Network, because the revisions referenced by the Network are fixed.
Request¶
CreateNetwork(
links=[
{
"id": 4,
"revision": 4
}, {
"id": 6,
"revision": 6
}, {
"id": 7,
"revision": 7
},
],
nodes=[
{
"id": 1,
"revision": 1
},
{
"id": 2,
"revision": 2
},
{
"id": 3,
"revision": 3
},
{
"id": 4,
"revision": 4
}
]
)
Response¶
{ "id": 200, "revision": 200 }
Again, delete one of the elements:
Request¶
DeleteNode(
reference={
"id": 1
}
)
Inspecting the result using ReadNetwork(id=200)
(result pictured):
The elements visible via the Network have not changed, because it was created with references to specific revisions of those elements.