Skip to content

Commit e4d5837

Browse files
committed
Print information about static nature of graph in display
The `show` function is only overloaded for inline printing, but when displaying the graph, the information about its static nature is missing, potentially confusing users: ``` julia> g {58089, 120148} directed simple Int32 graph julia> (g, nothing) ({58089, 120148} directed simple static {Int32, Int32} graph, nothing) ``` This PR fixes that.
1 parent e15ade5 commit e4d5837

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/StaticGraphs.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ function show(io::IO, g::AbstractStaticGraph)
6161
print(io, "{$(nv(g)), $(ne(g))} $dir simple static {$(vectype(g)), $(indtype(g))} graph")
6262
end
6363

64+
function show(io::IO, ::MIME"text/plain", g::AbstractStaticGraph)
65+
dir = is_directed(g) ? "directed" : "undirected"
66+
print(io, "{$(nv(g)), $(ne(g))} $dir simple static {$(vectype(g)), $(indtype(g))} graph")
67+
end
68+
6469
@inline function _fvrange(g::AbstractStaticGraph, s::Integer)
6570
@inbounds r_start = g.f_ind[s]
6671
@inbounds r_end = g.f_ind[s + 1] - 1

0 commit comments

Comments
 (0)