@@ -5,6 +5,7 @@ function Base.summary(io::IO, rels::GroupRelations{D,AG}) where {D,AG}
5
5
print (io, " GroupRelations{" , AG, " } ⋕" , rels. num, " (" , iuc (rels. num, D),
6
6
" ) with " , length (rels), " elements" )
7
7
end
8
+
8
9
function Base. summary (io:: IO , rel:: GroupRelation{D,AG} ) where {D,AG}
9
10
print (io, " GroupRelation{" , AG, " } ⋕" , rel. num)
10
11
printstyled (io, is_tgleiche (rel. kind) ? " ᵀ" : " ᴷ" ;
@@ -18,15 +19,24 @@ function Base.show(io::IO, ::MIME"text/plain", rels::GroupRelations{D,AG}) where
18
19
summary (io, rels)
19
20
print (io, " :" )
20
21
for rel in values (rels)
21
- print (io, ' \n ' )
22
+ print (io, " \n " )
22
23
_print_child (io, rel. num, rel. kind, rel. index)
23
24
end
24
25
end
25
26
26
- function _print_child (io:: IO , num:: Int , kind:: GleicheKind , index:: Int )
27
- print (io, " ⋕" , num)
28
- printstyled (io, is_tgleiche (kind) ? " ᵀ" : " ᴷ" , color = is_tgleiche (kind) ? :green : :red )
29
- print (io, " (index " , index, " )" )
27
+ function _print_child (
28
+ io:: IO ,
29
+ num:: Int ,
30
+ kind:: Union{Nothing, GleicheKind} ,
31
+ index:: Union{Nothing, Int} )
32
+ print (io, " ⋕" , num)
33
+ if ! isnothing (kind)
34
+ printstyled (io, is_tgleiche (kind) ? " ᵀ" : " ᴷ" ;
35
+ color = is_tgleiche (kind) ? :green : :red )
36
+ end
37
+ if ! isnothing (index)
38
+ printstyled (io, " (index " , index, " )" ; color= :light_black )
39
+ end
30
40
end
31
41
32
42
function Base. show (io:: IO , rels:: GroupRelations{D,AG} ) where {AG,D}
@@ -40,6 +50,7 @@ function Base.show(io::IO, rels::GroupRelations{D,AG}) where {AG,D}
40
50
end
41
51
print (io, " ]" )
42
52
end
53
+
43
54
function Base. show (io:: IO , :: MIME"text/plain" , g:: GroupRelation )
44
55
summary (io, g)
45
56
print (io, " :" )
@@ -48,6 +59,7 @@ function Base.show(io::IO, ::MIME"text/plain", g::GroupRelation)
48
59
print (io, ct)
49
60
end
50
61
end
62
+
51
63
function Base. show (io:: IO , t:: ConjugacyTransform{D} ) where D
52
64
print (io, " P = " )
53
65
if isnothing (t. P) && isnothing (t. p)
@@ -64,4 +76,69 @@ function Base.show(io::IO, t::ConjugacyTransform{D}) where D
64
76
replace (string (rationalize .(float (p))), r" //1([,|\] ])" => s "\1 " , " //" => " /" , " Rational{Int64}" => " " ))
65
77
end
66
78
end
79
+ end
80
+
81
+ function Base. summary (io:: IO , gr:: GroupRelationGraph{D, AG} ) where {D,AG}
82
+ print (io, " GroupRelationGraph" ,
83
+ " (" , gr. direction == SUPERGROUP ? " super" : " sub" , " groups)" ,
84
+ " of " , AG, " ⋕" , first (gr. nums),
85
+ " with " , length (gr. nums), " vertices" )
86
+ end
87
+ function Base. show (io:: IO , gr:: GroupRelationGraph )
88
+ summary (io, gr)
89
+ print (io, " :" )
90
+ num = first (gr. nums) # find "base" group number
91
+ _print_graph_leaves (io, gr, num, Bool[], nothing , nothing )
92
+ end
93
+ function _print_graph_leaves (
94
+ io:: IO ,
95
+ gr:: GroupRelationGraph ,
96
+ num:: Int ,
97
+ is_last:: Vector{Bool} ,
98
+ kind:: Union{Nothing, GleicheKind} ,
99
+ index:: Union{Nothing, Int}
100
+ )
101
+
102
+ # indicate "structure"-relationship of graph "leaves"/children via box-characters
103
+ indent = length (is_last)
104
+ print (io, " \n " )
105
+ if indent ≥ 2
106
+ for l in 1 : indent- 1
107
+ if ! is_last[l]
108
+ printstyled (io, " │" ; color= :light_black )
109
+ print (io, " " )
110
+ else
111
+ print (io, " " )
112
+ end
113
+ end
114
+ end
115
+ if indent > 0
116
+ printstyled (io, last (is_last) ? " └" : " ├" , " ─►" ; color= :light_black )
117
+ end
118
+
119
+ # print info about child
120
+ _print_child (io, num, kind, index)
121
+
122
+ # now move on to children of current child; print info about them, recursively
123
+ if ! isnothing (kind) && kind == KLASSENGLEICHE
124
+ # avoid printing recursively for klassengleiche as this implies infinite looping
125
+ # NB: in principle, this means we don't show the entire structure of
126
+ # `gr.infos`; but it is also really not that clear how to do this
127
+ # properly for klassengleiche relations which are not a DAG but often
128
+ # cyclic
129
+
130
+ # only one child and child is trivial group
131
+ elseif length (gr. infos[num]. children) == 1 && gr. infos[num]. children[1 ]. num == 1
132
+ child = gr. infos[num]. children[1 ]
133
+ printstyled (io, " ╌╌►" ; color= :light_black )
134
+ _print_child (io, child. num, child. kind, child. index)
135
+
136
+ # multiple children/nontrivial children
137
+ else
138
+ N_children = length (gr. infos[num]. children)
139
+ for (i,child) in enumerate (gr. infos[num]. children)
140
+ child_is_last = vcat (is_last, i== N_children)
141
+ _print_graph_leaves (io, gr, child. num, child_is_last, child. kind, child. index)
142
+ end
143
+ end
67
144
end
0 commit comments