(path, edge)
| 36 | print "%s" % (v) |
| 37 | |
| 38 | def 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 | |
| 48 | def remove_edge(path, edge): |
| 49 | _validate(path) |