-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_functions.py
594 lines (441 loc) · 17.6 KB
/
test_functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
"""
pytest -v tests/test_functions.py
"""
import logging
import pytest
import wayfarer
from wayfarer import loader, functions, Edge, WITH_DIRECTION_FIELD
import networkx
@pytest.mark.parametrize("use_reverse_lookup", [(True), (False)])
def test_get_edge_by_key(use_reverse_lookup):
recs = [{"EDGE_ID": 1, "LEN_": 100, "NODEID_FROM": 0, "NODEID_TO": 100}]
net = loader.load_network_from_records(recs, use_reverse_lookup=use_reverse_lookup)
# print(net.graph.keys())
if use_reverse_lookup:
assert "keys" in net.graph.keys() # dict_keys(['name', 'keys'])
edge = functions.get_edge_by_key(net, 1, with_data=False)
assert edge == (0, 100, 1, {})
edge = functions.get_edge_by_key(net, 1, with_data=True)
assert edge == (
0,
100,
1,
{"NODEID_FROM": 0, "LEN_": 100, "EDGE_ID": 1, "NODEID_TO": 100},
)
def test_get_edge_by_key_missing():
recs = [{"EDGE_ID": 1, "LEN_": 100, "NODEID_FROM": 0, "NODEID_TO": 100}]
net = loader.load_network_from_records(recs)
with pytest.raises(KeyError):
functions.get_edge_by_key(net, -1)
def test_to_edge():
edge = wayfarer.to_edge((0, 1, 1, {"LEN_": 10}))
assert edge == Edge(start_node=0, end_node=1, key=1, attributes={"LEN_": 10})
def test_to_edge_no_attributes():
"""
If no attributes are supplied in a tuple then an empty dict is returned
"""
edge = wayfarer.to_edge((0, 1, 1))
assert edge == Edge(start_node=0, end_node=1, key=1, attributes={})
def test_get_multiple_edges_by_attribute():
net = networkx.MultiGraph()
net.add_edge(0, 0, key=1, **{"EDGE_ID": 1, "LEN_": 100})
net.add_edge(0, 0, key=2, **{"EDGE_ID": 1, "LEN_": 100})
edges = list(functions.get_edges_by_attribute(net, "EDGE_ID", 1))
assert edges == [
(0, 0, 1, {"EDGE_ID": 1, "LEN_": 100}),
(0, 0, 2, {"EDGE_ID": 1, "LEN_": 100}),
]
def test_get_single_path_from_nodes():
net = networkx.MultiGraph()
net.add_edge(0, 1, key=1, **{"EDGE_ID": 1, "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [[1]]
def test_get_all_paths_from_nodes():
net = networkx.MultiGraph()
net.add_edge(0, 1, key=1, **{"EDGE_ID": 1, "LEN_": 100})
net.add_edge(1, 2, key=2, **{"EDGE_ID": 2, "LEN_": 100})
net.add_edge(2, 3, key=3, **{"EDGE_ID": 3, "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1, 2, 3])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [[1, 2, 3]]
def test_get_all_paths_from_nodes_with_direction():
net = networkx.MultiGraph()
net.add_edge(
0, 1, key=1, **{"EDGE_ID": 1, "LEN_": 100, "NODEID_FROM": 0, "NODEID_TO": 1}
)
# add a reversed edge in the middle of the path
net.add_edge(
1, 2, key=2, **{"EDGE_ID": 2, "LEN_": 100, "NODEID_FROM": 2, "NODEID_TO": 1}
)
net.add_edge(
2, 3, key=3, **{"EDGE_ID": 3, "LEN_": 100, "NODEID_FROM": 2, "NODEID_TO": 3}
)
paths = list(
functions.get_all_paths_from_nodes(net, [0, 1, 2, 3], with_direction_flag=True)
)
path = paths[0]
key_list = [e.key for e in path]
assert key_list == [1, 2, 3]
assert path[0].attributes["WITH_DIRECTION"] is True
assert path[1].attributes["WITH_DIRECTION"] is False
assert path[2].attributes["WITH_DIRECTION"] is True
def test_get_all_complex_paths():
"""
D- shape
"""
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A")
net.add_edge(1, 1, key="B") # self-loop
node_list = [0, 1]
paths = functions.get_all_complex_paths(net, node_list)
assert paths == [[0, 1], [0, 1, 1]]
def test_get_all_complex_paths2():
"""
D-D shape
"""
net = networkx.MultiGraph()
net.add_edge(0, 0, key="A")
net.add_edge(0, 1, key="B")
net.add_edge(1, 1, key="C")
node_list = [0, 1]
paths = functions.get_all_complex_paths(net, node_list)
assert paths == [[0, 1], [0, 0, 1], [0, 1, 1], [0, 0, 1, 1]]
def test_get_all_complex_paths3():
"""
Self-loop in middle
"""
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A")
net.add_edge(1, 2, key="B")
net.add_edge(2, 2, key="C")
net.add_edge(2, 3, key="D")
node_list = [0, 1, 2, 3]
paths = functions.get_all_complex_paths(net, node_list)
assert paths == [[0, 1, 2, 3], [0, 1, 2, 2, 3]]
def test_get_all_paths_from_nodes_loop():
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 1, key="B", **{"EDGE_ID": "B", "LEN_": 100}) # self-loop
paths = functions.get_all_paths_from_nodes(net, [0, 1])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [["A"], ["A", "B"]]
def test_get_all_paths_from_nodes_loop2():
net = networkx.MultiGraph()
net.add_edge(0, 0, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(0, 1, key="B", **{"EDGE_ID": "B", "LEN_": 100})
net.add_edge(1, 1, key="C", **{"EDGE_ID": "C", "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1])
key_list = [[e.key for e in p] for p in paths]
print(key_list)
assert key_list == [["B"], ["A", "B"], ["B", "C"], ["A", "B", "C"]]
def test_get_all_paths_from_nodes_loop3():
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
net.add_edge(2, 2, key="C", **{"EDGE_ID": "C", "LEN_": 100})
net.add_edge(2, 3, key="D", **{"EDGE_ID": "D", "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1, 2, 3])
key_list = [[e.key for e in p] for p in paths]
print(key_list)
assert key_list == [["A", "B", "D"], ["A", "B", "C", "D"]]
def test_get_all_paths_from_nodes_loop4():
# with parallel edge
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
net.add_edge(2, 1, key="B2", **{"EDGE_ID": "B2", "LEN_": 100}) # parallel edge
net.add_edge(2, 2, key="C", **{"EDGE_ID": "C", "LEN_": 100}) # self-loop
net.add_edge(2, 3, key="D", **{"EDGE_ID": "D", "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1, 2, 3])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [
["A", "B", "D"],
["A", "B2", "D"],
["A", "B", "C", "D"],
["A", "B2", "C", "D"],
]
def test_get_all_paths_from_nodes_roundabout():
"""
Get both the full and broken paths of a roundabout
"""
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
net.add_edge(2, 3, key="C", **{"EDGE_ID": "C", "LEN_": 100})
net.add_edge(3, 0, key="D", **{"EDGE_ID": "D", "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1, 2, 3])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [["A", "B", "C"], ["A", "B", "C", "D"]]
def test_get_all_paths_from_roundabout_with_loops():
net = networkx.MultiGraph()
net.add_edge(0, 0, key="AA", **{"EDGE_ID": "AA", "LEN_": 100})
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
net.add_edge(2, 3, key="C", **{"EDGE_ID": "C", "LEN_": 100})
net.add_edge(3, 0, key="D", **{"EDGE_ID": "D", "LEN_": 100})
paths = functions.get_all_paths_from_nodes(net, [0, 1, 2, 3])
key_list = [[e.key for e in p] for p in paths]
assert key_list == [
["A", "B", "C"],
["AA", "A", "B", "C"],
["A", "B", "C", "D"],
["AA", "A", "B", "C", "D"],
]
def test_get_unattached_node():
net = networkx.MultiGraph()
edge1 = (0, 1)
edge2 = (1, 2)
net.add_edge(*edge1)
net.add_edge(*edge2)
n = functions.get_unattached_node(net, edge1)
assert n == 0
n = functions.get_unattached_node(net, edge2)
assert n == 2
def test_get_unattached_node2():
net = networkx.MultiGraph()
edge1 = (0, 1)
edge2 = (1, 2)
edge3 = (2, 3)
net.add_edge(*edge1)
net.add_edge(*edge2)
net.add_edge(*edge3)
n = functions.get_unattached_node(net, edge1)
assert n == 0
n = functions.get_unattached_node(net, edge2)
assert n is None
n = functions.get_unattached_node(net, edge3)
assert n == 3
def test_get_multiconnected_nodes():
edges = [Edge(0, 1, "A", {}), Edge(1, 2, "B", {})]
nodes = functions.get_multiconnected_nodes(edges, connections=2)
assert nodes == [1]
def test_get_ordered_end_nodes():
edges = [Edge(1, 2, "A", {}), Edge(0, 1, "B", {})]
nodes = [0, 1]
end_nodes = functions.get_ordered_end_nodes(edges, nodes)
assert end_nodes == [1, 0]
def test_get_edges_from_nodes():
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(
1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100, "NODEID_FROM": 1, "NODEID_TO": 2}
)
net.add_edge(2, 3, key="C", **{"EDGE_ID": "C", "LEN_": 100})
node_list = [1, 2]
edges = functions.get_edges_from_nodes(net, node_list)
assert len(edges) == 1
assert edges[0].key == "B"
edges = functions.get_edges_from_nodes(net, [2, 1], with_direction_flag=True)
assert len(edges) == 1
assert edges[0].key == "B"
assert edges[0].attributes[WITH_DIRECTION_FIELD] is False
def test_get_edges_from_nodes_non_unique():
net = networkx.MultiGraph()
net.add_edge(1, 2, key="A", **{"EDGE_ID": "A", "LEN_": 100})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
node_list = [1, 2, 1] # a loop
edges = functions.get_edges_from_nodes(net, node_list, return_unique=True)
assert len(edges) == 1
# as edge A is the "first" key it will be returned
assert edges[0].key == "A"
edges = functions.get_edges_from_nodes(net, node_list, return_unique=False)
assert len(edges) == 2
assert edges[0].key == "A"
assert edges[1].key == "A"
def test_get_edges_from_nodes_all_lengths():
net = networkx.MultiGraph()
net.add_edge(1, 2, key="A", **{"EDGE_ID": "A", "LEN_": 50})
net.add_edge(1, 2, key="B", **{"EDGE_ID": "B", "LEN_": 100})
node_list = [1, 2]
edges = functions.get_edges_from_nodes(net, node_list, shortest_path_only=False)
assert len(edges) == 2
assert edges[0].key == "A"
assert edges[1].key == "B"
def test_edges_to_graph():
edges = []
net = functions.edges_to_graph(edges)
assert len(net.edges()) == 0
edges = [Edge(0, 1, key=1, attributes={}), Edge(1, 2, key=2, attributes={})]
net = functions.edges_to_graph(edges)
assert len(net.edges()) == 2
assert list(net.edges(keys=True)) == [(0, 1, 1), (1, 2, 2)]
def test_edges_to_graph_no_keys():
tuples = [(0, 1), (1, 2)]
net = functions.edges_to_graph(tuples)
assert len(net.edges()) == 2
# when no keys are set networkx uses 0 for all keys
assert list(net.edges(keys=True)) == [(0, 1, 0), (1, 2, 0)]
def test_get_shortest_edge():
edges = {
"A": {"EDGE_ID": "A", "LEN_": 100, "NODEID_FROM": 1, "NODEID_TO": 2},
"B": {"EDGE_ID": "B", "LEN_": 20, "NODEID_FROM": 2, "NODEID_TO": 3},
}
res = functions.get_shortest_edge(edges)
assert res[0] == "B"
def test_get_shortest_edge_identical():
"""
If two edges have identical lengths always
return whichever key is first in the dict
"""
edges = {
1: {"EDGE_ID": 1, "LEN_": 100},
-1: {"EDGE_ID": 2, "LEN_": 100},
}
res = functions.get_shortest_edge(edges)
assert res[0] == 1
def test_get_shortest_edge_mixed_keys():
edges = {
1: {"EDGE_ID": "A", "LEN_": 100, "NODEID_FROM": 1, "NODEID_TO": 2},
"A": {"EDGE_ID": "B", "LEN_": 20, "NODEID_FROM": 2, "NODEID_TO": 3},
}
res = functions.get_shortest_edge(edges)
assert res[0] == "A"
def test_get_shortest_edge_no_length():
edges = {
"A": {"EDGE_ID": "A", "LEN_": 100, "NODEID_FROM": 1, "NODEID_TO": 2},
"B": {"EDGE_ID": "B", "LEN_": 20, "NODEID_FROM": 2, "NODEID_TO": 3},
}
res = functions.get_shortest_edge(edges, length_field=None)
assert res[0] == "A"
def test_get_unique_ordered_list():
lst = [2, 2, 1, 1, 4, 4, 1, 2, 3]
res = functions.get_unique_ordered_list(lst)
print(res)
assert res == [2, 1, 4, 3]
def test_get_edges_from_node_pair():
net = networkx.MultiGraph()
net.add_edge(0, 1, key="A", val="foo")
net.add_edge(0, 1, key="B", val="bar")
tpls = functions.get_edges_from_node_pair(net, start_node=0, end_node=1)
assert tpls == {"A": {"val": "foo"}, "B": {"val": "bar"}}
def test_get_path_length():
edges = [Edge(0, 1, "A", {"LEN_": 5}), Edge(1, 2, "B", {"LEN_": 5})]
assert functions.get_path_length(edges) == 10
def test_has_overlaps():
edges = [
Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 0, "LEN_": 10}),
Edge(1, 2, "B", {"EDGE_ID": 2, "OFFSET": 0, "LEN_": 10}),
Edge(2, 3, "C", {"EDGE_ID": 3, "OFFSET": 0, "LEN_": 10}),
Edge(2, 3, "C", {"EDGE_ID": 2, "OFFSET": 0, "LEN_": 10}),
Edge(2, 3, "C", {"EDGE_ID": 4, "OFFSET": 0, "LEN_": 10}),
]
assert functions.has_overlaps(edges) is True
def test_has_no_overlaps():
edges = [
Edge(0, 1, "A", {"EDGE_ID": 1}),
Edge(1, 2, "B", {"EDGE_ID": 2}),
Edge(2, 3, "C", {"EDGE_ID": 3}),
Edge(2, 3, "C", {"EDGE_ID": 4}),
]
assert functions.has_overlaps(edges) is False
def test_has_no_overlaps_loop():
edges = [
Edge(0, 1, "A", {"EDGE_ID": 1}),
Edge(1, 2, "B", {"EDGE_ID": 2}),
Edge(2, 3, "C", {"EDGE_ID": 3}),
Edge(0, 1, "D", {"EDGE_ID": 1}),
]
assert functions.has_overlaps(edges) is False
def test_has_no_overlaps_loop_with_split():
edges = [
Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10}),
Edge(1, 2, "B", {"EDGE_ID": 2, "OFFSET": 0, "LEN_": 10}),
Edge(1, 2, "B", {"EDGE_ID": 2, "OFFSET": 10, "LEN_": 10}),
Edge(2, 3, "C", {"EDGE_ID": 3, "OFFSET": 0, "LEN_": 10}),
Edge(3, 0, "C", {"EDGE_ID": 4, "OFFSET": 0, "LEN_": 5}),
]
assert functions.has_overlaps(edges) is False
def test_add_edge():
net = networkx.MultiGraph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
functions.add_edge(net, edge.start_node, edge.end_node, edge.key, edge.attributes)
assert len(net.edges()) == 1
def test_add_edge_shorthand():
"""
As above, but unpacking the Edge into kwargs
"""
net = networkx.MultiGraph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
functions.add_edge(net, **edge._asdict())
assert len(net.edges()) == 1
def test_add_single_edge():
net = networkx.MultiGraph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
functions.add_single_edge(net, edge)
assert len(net.edges()) == 1
def test_remove_edge():
net = networkx.MultiGraph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
net.add_edge(edge.start_node, edge.end_node, edge.key, **edge.attributes)
assert len(net.edges()) == 1
functions.remove_edge(net, edge)
assert len(net.edges()) == 0
def test_remove_edge_and_key():
net = loader.create_graph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
functions.add_edge(net, **edge._asdict())
assert len(net.edges()) == 1
assert net.graph["keys"]["A"] == (0, 1)
functions.remove_edge(net, edge)
assert len(net.edges()) == 0
assert len(net.graph["keys"].keys()) == 0
def test_remove_edge_by_key():
net = loader.create_graph()
edge = Edge(0, 1, "A", {"EDGE_ID": 1, "OFFSET": 5, "LEN_": 10})
functions.add_edge(net, **edge._asdict())
assert len(net.edges()) == 1
assert net.graph["keys"]["A"] == (0, 1)
functions.remove_edge_by_key(net, "A")
assert len(net.edges()) == 0
assert len(net.graph["keys"].keys()) == 0
def test_get_source_edges():
net = networkx.MultiDiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": 1})
net.add_edge(1, 2, key="B", **{"EDGE_ID": 2})
net.add_edge(2, 3, key="C", **{"EDGE_ID": 3})
edges = functions.get_source_edges(net)
assert edges["A"] == {"EDGE_ID": 1}
def test_get_sink_edges():
net = networkx.MultiDiGraph()
net.add_edge(0, 1, key="A", **{"EDGE_ID": 1})
net.add_edge(1, 2, key="B", **{"EDGE_ID": 2})
net.add_edge(2, 3, key="C", **{"EDGE_ID": 3})
edges = functions.get_sink_edges(net)
assert edges["C"] == {"EDGE_ID": 3}
def test_doctest():
import doctest
print(doctest.testmod(functions))
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
# test_get_edges_from_nodes()
# test_edges_to_graph()
# test_get_edges_from_nodes()
# test_edges_to_graph()
# test_get_shortest_edge()
# test_get_shortest_edge_identical()
# test_get_shortest_edge_mixed_keys()
# test_get_unique_ordered_list()
# test_get_edges_from_node_pair()
# test_to_edge()
# test_to_edge_no_attributes()
# test_edges_to_graph_no_keys()
# test_get_edge_by_key_missing()
# test_get_all_paths_from_nodes_with_direction()
# test_get_path_length()
# test_doctest()
# test_get_edges_from_nodes_non_unique()
# test_has_no_overlaps()
# test_has_no_overlaps_loop()
# test_has_overlaps()
# test_has_no_overlaps_loop_with_split()
# test_get_edges_from_nodes_all_lengths()
# test_remove_edge()
# test_remove_edge_and_key()
# test_remove_edge_by_key()
# test_add_edge_shorthand()
# test_add_single_edge()
# test_get_shortest_edge_no_length()
test_get_source_edges()
test_get_sink_edges()
print("Done!")