From adf82fd08de1c2b5d7ab2b2bced24aeb8332f137 Mon Sep 17 00:00:00 2001 From: Koki Fushimi Date: Mon, 29 May 2023 16:53:27 +0900 Subject: [PATCH 1/6] Add quotations. --- src/persistence.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/persistence.jl b/src/persistence.jl index 7bb6bd3..cf7fd8e 100644 --- a/src/persistence.jl +++ b/src/persistence.jl @@ -70,18 +70,24 @@ function savedot(io::IO, meta_graph::MetaGraph) for label in keys(meta_graph.vertex_properties) write(io, " ") + write(io, '"') write(io, label) + write(io, '"') show_meta_list(io, meta_graph[label]) write(io, '\n') end for (label_1, label_2) in keys(edge_data) write(io, " ") + write(io, '"') write(io, label_1) + write(io, '"') write(io, ' ') write(io, dash) write(io, ' ') + write(io, '"') write(io, label_2) + write(io, '"') show_meta_list(io, edge_data[arrange(meta_graph, label_1, label_2)]) write(io, "\n") end From 93a3a081342a68658d2dd33da7ca622fdcc56fa2 Mon Sep 17 00:00:00 2001 From: Koki Fushimi Date: Tue, 30 May 2023 09:55:38 +0900 Subject: [PATCH 2/6] Add and fix tests. --- test/tutorial/3_files.jl | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/tutorial/3_files.jl b/test/tutorial/3_files.jl index f5372d5..a3fd631 100644 --- a/test/tutorial/3_files.jl +++ b/test/tutorial/3_files.jl @@ -35,7 +35,7 @@ simple_str = mktemp() do file, io end print(simple_str) #md -@test simple_str == "graph T {\n a\n b\n a -- b\n}\n" #src +@test simple_str == "graph T {\n \"a\"\n \"b\"\n \"a\" -- \"b\"\n}\n" #src #- @@ -60,4 +60,32 @@ end print(complicated_str) #md @test complicated_str == #src - "digraph G {\n tagged = true\n a [code_1 = 1, code_2 = 2]\n b [code = 2]\n a -> b [code = 12]\n}\n" #src + "digraph G {\n tagged = true\n \"a\" [code_1 = 1, code_2 = 2]\n \"b\" [code = 2]\n \"a\" -> \"b\" [code = 12]\n}\n" #src + +with_spaces = MetaGraph( + DiGraph(); + label_type=String, + vertex_data_type=Dict{Symbol,String}, + edge_data_type=Dict{Symbol,String}, +) + +with_spaces["a b"] = Dict(:label => "A B") + +with_spaces["c d"] = Dict(:label => "C D") + +with_spaces["a b", "c d"] = Dict(:label => "A B to C D") + +with_spaces_str = mktemp() do file, io + savegraph(file, with_spaces, DOTFormat()) + read(file, String) +end + +print(with_spaces_str) +@test with_spaces_str == +""" +digraph G { + "a b" [label = "A B"] + "c d" [label = "C D"] + "a b" -> "c d" [label = "A B to C D"] +} +""" \ No newline at end of file From c0d29fb851348f1bfa24290378ad15d88a94a1f6 Mon Sep 17 00:00:00 2001 From: Koki Fushimi Date: Tue, 30 May 2023 15:43:20 +0900 Subject: [PATCH 3/6] Format. --- test/tutorial/3_files.jl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/tutorial/3_files.jl b/test/tutorial/3_files.jl index a3fd631..912a867 100644 --- a/test/tutorial/3_files.jl +++ b/test/tutorial/3_files.jl @@ -81,11 +81,10 @@ with_spaces_str = mktemp() do file, io end print(with_spaces_str) -@test with_spaces_str == -""" -digraph G { - "a b" [label = "A B"] - "c d" [label = "C D"] - "a b" -> "c d" [label = "A B to C D"] -} -""" \ No newline at end of file +@test with_spaces_str == """ + digraph G { + "a b" [label = "A B"] + "c d" [label = "C D"] + "a b" -> "c d" [label = "A B to C D"] + } + """ From ce336d9b21dca9815b237a52e1c3c65b08cbe235 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 30 May 2023 10:05:24 +0200 Subject: [PATCH 4/6] Fix docs --- src/MetaGraphsNext.jl | 2 +- test/tutorial/3_files.jl | 45 ++++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/MetaGraphsNext.jl b/src/MetaGraphsNext.jl index a23271b..a0998e7 100644 --- a/src/MetaGraphsNext.jl +++ b/src/MetaGraphsNext.jl @@ -1,7 +1,7 @@ """ MetaGraphsNext -A package for graphs with vertex labels and metadata in Julia. Its main export is the [`MetaGraph`](@ref) type. +A package for graphs with vertex labels and metadata in Julia. Its main export is the `MetaGraph` type. """ module MetaGraphsNext diff --git a/test/tutorial/3_files.jl b/test/tutorial/3_files.jl index 912a867..0aeaf44 100644 --- a/test/tutorial/3_files.jl +++ b/test/tutorial/3_files.jl @@ -34,8 +34,16 @@ simple_str = mktemp() do file, io read(file, String) end -print(simple_str) #md -@test simple_str == "graph T {\n \"a\"\n \"b\"\n \"a\" -- \"b\"\n}\n" #src +simple_str_true = """ +graph T { + "a" + "b" + "a" -- "b" +} +""" + +simple_str == simple_str_true +@test simple_str == simple_str_true #src #- @@ -58,9 +66,18 @@ complicated_str = mktemp() do file, io read(file, String) end -print(complicated_str) #md -@test complicated_str == #src - "digraph G {\n tagged = true\n \"a\" [code_1 = 1, code_2 = 2]\n \"b\" [code = 2]\n \"a\" -> \"b\" [code = 12]\n}\n" #src +complicated_str_true = """ +digraph G { + tagged = true + "a" [code_1 = 1, code_2 = 2] + "b" [code = 2] + "a" -> "b" [code = 12] +} +""" + +@test complicated_str == complicated_str_true + +#- with_spaces = MetaGraph( DiGraph(); @@ -80,11 +97,13 @@ with_spaces_str = mktemp() do file, io read(file, String) end -print(with_spaces_str) -@test with_spaces_str == """ - digraph G { - "a b" [label = "A B"] - "c d" [label = "C D"] - "a b" -> "c d" [label = "A B to C D"] - } - """ +with_spaces_str_true = """ +digraph G { + "a b" [label = "A B"] + "c d" [label = "C D"] + "a b" -> "c d" [label = "A B to C D"] +} +""" + +with_spaces_str == with_spaces_str_true +@test with_spaces_str == with_spaces_str_true #src From 2e0fb4d23e2a64f0f3c69de34e7b1f3c1815effc Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 30 May 2023 10:09:33 +0200 Subject: [PATCH 5/6] Fix fix docs --- test/tutorial/3_files.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tutorial/3_files.jl b/test/tutorial/3_files.jl index 0aeaf44..f4442f7 100644 --- a/test/tutorial/3_files.jl +++ b/test/tutorial/3_files.jl @@ -75,7 +75,7 @@ digraph G { } """ -@test complicated_str == complicated_str_true +@test complicated_str == complicated_str_true #src #- From a650dc0b2b513a9ee4201f18afa50cdcc1cb4613 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 30 May 2023 10:19:08 +0200 Subject: [PATCH 6/6] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index eabf91f..6755835 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "MetaGraphsNext" uuid = "fa8bd995-216d-47f1-8a91-f3b68fbeb377" -version = "0.5.0" +version = "0.6.0-DEV" [deps] Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"