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
|
from typing import Any, Dict
def nodedict(parent, children=[], previous=None, next=None) -> Dict[str, Any]:
return dict(parent_heading=parent,
children_heading=children,
previous_same_level_heading=previous,
next_same_level_heading=next)
data = [nodedict(*args) for args in [
# G0
(None, [], None, 'G1-H1'),
# G1
(None, ['G1-H2'], 'G0-H1', 'G2-H1'),
('G1-H1', ['G1-H3']),
('G1-H2',),
# G2
(None, ['G2-H2', 'G2-H3'], 'G1-H1', 'G3-H1'),
('G2-H1',),
('G2-H1',),
# G3
(None, ['G3-H2', 'G3-H3'], 'G2-H1', 'G4-H1'),
('G3-H1',),
('G3-H1',),
# G4
(None, ['G4-H2', 'G4-H3', 'G4-H4'], 'G3-H1', 'G5-H1'),
('G4-H1',),
('G4-H1',),
('G4-H1',),
# G5
(None, ['G5-H2', 'G5-H4'], 'G4-H1', 'G6-H1'),
('G5-H1', ['G5-H3'], None, 'G5-H4'),
('G5-H2',),
('G5-H1', [], 'G5-H2'),
# G6
(None, ['G6-H2', 'G6-H5'], 'G5-H1', 'G7-H1'),
('G6-H1', ['G6-H3', 'G6-H4'], None, 'G6-H5'),
('G6-H2',),
('G6-H2',),
('G6-H1', [], 'G6-H2'),
# G7
(None, [], 'G6-H1'),
]]
|