@@ -130,26 +130,58 @@ function GNNHeteroGraph(data::EDict;
130
130
ntypes, etypes)
131
131
end
132
132
133
+ function show_sorted_Dict (io:: IO , d:: Dict , compact:: Bool )
134
+ if compact
135
+ print (io, " Dict" )
136
+ end
137
+ print (io, " (" )
138
+ if ! isempty (d)
139
+ if length (keys (d)) == 1
140
+ show (io, keys[1 ])
141
+ print (io, " => $(d[keys[1 ]]) " )
142
+ else
143
+ sorted_keys = sort! (collect (keys (d)))
144
+ for key in sorted_keys[1 : end - 1 ]
145
+ show (io, key)
146
+ print (io, " => $(d[key]) , " )
147
+ end
148
+ show (io, sorted_keys[end ])
149
+ print (io, " => $(d[sorted_keys[end ]]) " )
150
+ end
151
+ end
152
+ print (io, " )" )
153
+ end
133
154
134
155
function Base. show (io:: IO , g:: GNNHeteroGraph )
135
- print (io, " GNNHeteroGraph($(g. num_nodes) , $(g. num_edges) )" )
156
+ print (io, " GNNHeteroGraph(" )
157
+ show_sorted_Dict (io, g. num_nodes, true )
158
+ print (io, " , " )
159
+ show_sorted_Dict (io, g. num_edges, true )
160
+ print (io, " )" )
136
161
end
137
162
138
163
function Base. show (io:: IO , :: MIME"text/plain" , g:: GNNHeteroGraph )
139
164
if get (io, :compact , false )
140
- print (io, " GNNHeteroGraph($(g. num_nodes) , $(g. num_edges) )" )
165
+ print (io, " GNNHeteroGraph(" )
166
+ show_sorted_Dict (io, g. num_nodes, true )
167
+ print (io, " , " )
168
+ show_sorted_Dict (io, g. num_edges, true )
169
+ print (io, " )" )
141
170
else
142
- print (io, " GNNHeteroGraph:\n num_nodes: $((g. num_nodes... ,)) \n num_edges: $((g. num_edges... ,)) " )
171
+ print (io, " GNNHeteroGraph:\n num_nodes: " )
172
+ show_sorted_Dict (io, g. num_nodes, false )
173
+ print (io, " \n num_edges: " )
174
+ show_sorted_Dict (io, g. num_edges, false )
143
175
g. num_graphs > 1 && print (io, " \n num_graphs: $(g. num_graphs) " )
144
176
if ! isempty (g. ndata)
145
177
print (io, " \n ndata:" )
146
- for k in keys (g. ndata)
178
+ for k in sort ( collect ( keys (g. ndata)) )
147
179
print (io, " \n\t " , _str (k), " => $(shortsummary (g. ndata[k])) " )
148
180
end
149
181
end
150
182
if ! isempty (g. edata)
151
183
print (io, " \n edata:" )
152
- for k in keys (g. edata)
184
+ for k in sort ( collect ( keys (g. edata)) )
153
185
print (io, " \n\t $k => $(shortsummary (g. edata[k])) " )
154
186
end
155
187
end
0 commit comments