Skip to content

Commit b2bd20f

Browse files
authored
fix graph printout with optional vertex properties (#8)
1 parent 3624dd1 commit b2bd20f

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

Diff for: parsing_graphs/src/auxiliary_functions.jl

+12-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,18 @@ function show_graph(G)
5050
println("Node: ")
5151
print("Node type: ")
5252
println(get_prop(G, v, :type))
53-
print("Node class (only for algorithms): ")
54-
println(get_prop(G, v, :class))
53+
if has_prop(G, v, :class)
54+
print("Node class: ")
55+
println(get_prop(G, v, :class))
56+
end
57+
if has_prop(G, v, :runtime_average_s)
58+
print("Average runtime [s]: ")
59+
println(get_prop(G, v, :runtime_average_s))
60+
end
61+
if has_prop(G, v, :size_average_B)
62+
print("Average size [B]: ")
63+
println(get_prop(G, v, :size_average_B))
64+
end
5565
print("Original name: ")
5666
println(get_prop(G, v, :original_id))
5767
print("Node name: ")

Diff for: parsing_graphs/src/parsing_graphs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using MetaGraphs
66
using Dagger
77
using DaggerWebDash
88
include("../../utilities/GraphMLReader.jl/src/GraphMLReader.jl")
9-
include("../../utilities/auxiliary_functions.jl")
9+
include("auxiliary_functions.jl")
1010

1111

1212
function main()

Diff for: utilities/functions.jl

+12-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ function show_graph(G)
5151
println("Node: ")
5252
print("Node type: ")
5353
println(get_prop(G, v, :type))
54-
print("Node class (only for algorithms): ")
55-
println(get_prop(G, v, :class))
54+
if has_prop(G, v, :class)
55+
print("Node class: ")
56+
println(get_prop(G, v, :class))
57+
end
58+
if has_prop(G, v, :runtime_average_s)
59+
print("Average runtime [s]: ")
60+
println(get_prop(G, v, :runtime_average_s))
61+
end
62+
if has_prop(G, v, :size_average_B)
63+
print("Average size [B]: ")
64+
println(get_prop(G, v, :size_average_B))
65+
end
5666
print("Original name: ")
5767
println(get_prop(G, v, :original_id))
5868
print("Node name: ")

0 commit comments

Comments
 (0)