JuliaGraphs / Graphs.jl

An optimized graphs package for the Julia programming language
http://juliagraphs.org/Graphs.jl/
Other
465 stars 92 forks source link

Canonical output when printing a graph #139

Open etiennedeg opened 2 years ago

etiennedeg commented 2 years ago

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.

gdalle commented 2 years ago

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