我必须在java中得到这样的输出
digraph G
{
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
我试过这个
PrintStream out = new PrintStream(new FileOutputStream("graph.gv"));
for(int i=0;i<1;i++)
{
System.out.println("digraph G {");
for (String node : visited)
{
System.out.print(node);
System.out.print("->");
out.write(node);
out.flush();
}
out.close();
System.out.println();
}
System.out.println("}");
}
这是我的输出
digraph G {
A->B->E->
}
digraph G {
A->B->D->E->
}
digraph G {
A->B->C->E->
}
digraph G {
A->B->C->D->E->
}
digraph G {
A->D->E->
}
但输出未正确打印