diff --git a/src/MetaGraphs.jl b/src/MetaGraphs.jl index cb16816..a21f273 100644 --- a/src/MetaGraphs.jl +++ b/src/MetaGraphs.jl @@ -49,11 +49,7 @@ abstract type AbstractMetaGraph{T} <: AbstractGraph{T} end function show(io::IO, g::AbstractMetaGraph) dir = is_directed(g) ? "directed" : "undirected" - if nv(g) == 0 - print(io, "empty $dir $(eltype(g)) metagraph with $(weighttype(g)) weights defined by :$(g.weightfield) (default weight $(g.defaultweight))") - else - print(io, "{$(nv(g)), $(ne(g))} $dir $(eltype(g)) metagraph with $(weighttype(g)) weights defined by :$(g.weightfield) (default weight $(g.defaultweight))") - end + print(io, "{$(nv(g)), $(ne(g))} $dir $(eltype(g)) metagraph with $(weighttype(g)) weights defined by :$(g.weightfield) (default weight $(g.defaultweight))") end @inline fadj(g::AbstractMetaGraph, x...) = fadj(g.graph, x...) diff --git a/test/metagraphs.jl b/test/metagraphs.jl index aa2481d..8d5d993 100644 --- a/test/metagraphs.jl +++ b/test/metagraphs.jl @@ -145,7 +145,7 @@ importall MetaGraphs mg = MetaGraph(g) T = eltype(mg) U = weighttype(mg) - @test sprint(show, mg) == "empty undirected $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" + @test sprint(show, mg) == "{0, 0} undirected $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" @test @inferred(add_vertices!(g, 5)) == 5 @test sprint(show, mg) == "{5, 0} undirected $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" end @@ -154,7 +154,7 @@ importall MetaGraphs mg = MetaDiGraph(g) T = eltype(mg) U = weighttype(mg) - @test sprint(show, mg) == "empty directed $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" + @test sprint(show, mg) == "{0, 0} directed $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" @test @inferred(add_vertices!(mg, 5)) == 5 @test sprint(show, mg) == "{5, 0} directed $T metagraph with $U weights defined by :$(mg.weightfield) (default weight $(mg.defaultweight))" end