Grappa Graphviz dot-Visualization Problem and Questions

微笑、不失礼 提交于 2019-12-05 20:47:44

You have to "ask" graphviz (any of the tools, "dot", "neato"...) to "format" the graph before you can display it (in an appealing way) in a GrappaPanel. Before you construct the GrappaPanel, you need to do the following:

String [] processArgs = {"dot"}; // You can use "neato" or whatever formatter you want
Process formatProcess = Runtime.getRuntime().exec(processArgs, null, null);
GrappaSupport.filterGraph(graph, formatProcess);
formatProcess.getOutputStream().close();

Where "graph" in GrappaSupport.filterGraph is your graph. After that, your graph is formatted properly and you can use the GrappaPanel to view it. The result will be more pleasant than what you posted in the link.

Hope that helps, regards.

PS: In order for the above code to work, you have to have "dot" (or any other formatter you use) to be in the path, otherwise you need to give it the full path of the executable file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!