MCPcopy Create free account
hub / github.com/CyberPoint/libpgm / remove_node

Function remove_node

utils/bntextutils.py:66–79  ·  view source on GitHub ↗
(path, node)

Source from the content-addressed store, hash-verified

64 json.dump(j, f, indent=2)
65
66def remove_node(path, node):
67 _validate(path)
68 with open(path, "r") as f:
69 j = json.load(f)
70 assert node in j["V"], "node not present"
71 j["V"].remove(node)
72 # delete associated Vdata and edges
73 if node in j["Vdata"]:
74 del j["Vdata"][node]
75 for edge in j["E"]:
76 if edge[0] == node or edge[1] == node:
77 edges.remove(edge)
78 with open(path, "w") as f:
79 json.dump(j, f, indent=2)
80
81def alter_vdata(path, node):
82 _validate(path)

Callers

nothing calls this directly

Calls 2

_validateFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected