Graphs.jl icon indicating copy to clipboard operation
Graphs.jl copied to clipboard

Canonical output when printing a graph

Open etiennedeg opened this issue 3 years ago • 1 comments

discussion started here: #121

With #121, the new form of printing will be canonical. I think the show function with plain/text should also be canonical. Here are some propositions on what the output could look like:

julia> path_graph(5)
{5, 4} undirected simple Int64 graph
Edge 1 => 2, Edge 2 => 3, Edge 3 => 4, Edge 4 => 5
julia> path_graph(5)
{5, 4} undirected simple Int64 graph
Edge 1 => 2
Edge 2 => 3
Edge 3 => 4 
Edge 4 => 5
julia> path_graph(5)
{5, 4} undirected simple Int64 graph
1 => [2]
2 => [1, 3]
3 => [2, 4]
4 => [3, 5]
5 => [4]

We should implement summary to output the old behavior with eltype, number of vertices and number of edges (currently, it output the default "SimpleGraph{Int64}", which is less satisfactory.

etiennedeg avatar May 30 '22 12:05 etiennedeg

I like the last one best, and it is closest to the actual adjacency list storage

gdalle avatar Jun 19 '22 20:06 gdalle