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

Function add_edge

utils/bntextutils.py:38–46  ·  view source on GitHub ↗
(path, edge)

Source from the content-addressed store, hash-verified

36 print "%s" % (v)
37
38def add_edge(path, edge):
39 _validate(path)
40 with open(path, "r") as f:
41 j = json.load(f)
42 assert edge[0] in j["V"] and edge[1] in j["V"], "bad edge"
43 if edge not in j["E"]:
44 j["E"].append(edge)
45 with open(path, "w") as f:
46 json.dump(j, f, indent=2)
47
48def remove_edge(path, edge):
49 _validate(path)

Callers

nothing calls this directly

Calls 2

_validateFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected