Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOT format exporter can't treat strings that have spaces #61

Closed
Paalon opened this issue May 29, 2023 · 0 comments · Fixed by #62
Closed

DOT format exporter can't treat strings that have spaces #61

Paalon opened this issue May 29, 2023 · 0 comments · Fixed by #62

Comments

@Paalon
Copy link
Contributor

Paalon commented May 29, 2023

For example, the following gives ill-formed DOT format file.

using Graphs
using MetaGraphsNext

complicated = MetaGraph(
    DiGraph();
    label_type=String,
    vertex_data_type=Dict{Symbol, String},
    edge_data_type=Dict{Symbol, String},
    graph_data=(tagged=true,)
);

complicated["lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -"] = Dict(:label => "初期局面")

complicated["lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w -"] = Dict(:label => "☗26歩");

complicated["lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -", "lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w -"] = Dict(:label => "2g2f");

complicated_str = mktemp() do file, io
    savegraph(file, complicated, DOTFormat())
    read(file, String)
end

print(complicated_str)
digraph G {
    tagged = true
    lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - [label = "初期局面"]
    lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w - [label = "☗26歩"]
    lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - -> lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w - [label = "2g2f"]
}

because it requires quotations "

digraph G {
    tagged = true
    "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -" [label = "初期局面"]
    "lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w -" [label = "☗26歩"]
    "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b -" -> "lnsgkgsnl/1r5b1/ppppppppp/9/9/7P1/PPPPPPP1P/1B5R1/LNSGKGSNL w -" [label = "2g2f"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant