Problema y preguntas de visualización de puntos de Grappa Graphviz

i am using this dot-Code for my Test:

digraph G { edge [dir=none];
p1 [shape=circle,style=filled,label="",height="0.01",width="0.01"];
q1 [shape=circle,style=filled,label="",height="0.01",width="0.01"];
q2 [shape=circle,style=filled,label="",height="0.01",width="0.01"];
q3 [shape=circle,style=filled,label="",height="0.01",width="0.01"];
{rank=same; father->p1; mother->p1};
{rank=same; q1->q2->q3};
{rank=same; son1; daughter1; daughter2};

My Java Code to create the Graph is the following:

Graph graph = null;

    graph = program.getGraph();

    JScrollPane jsp = new JScrollPane();

    GrappaPanel gp = new GrappaPanel(graph);
    gp.addGrappaListener(new GrappaAdapter());

The Output is this: Enlace

Why is the Tree formatted so wrong? And is there an possibility to let the Tree display from left to right?

preguntado el 27 de agosto de 11 a las 20:08

1 Respuestas

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);

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.

contestado el 14 de mayo de 12 a las 05:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.