I am facing the problem of visualizing this string:
"=IF(A2=1;0;IF(D2=D3;IF(C2=1;TRUE;FALSE);4))";
As you can see the general syntax is similar to an excel formula, so that I have IF(TEST; TRUE; FALSE)
My problem is that I want to visulize this string in a binary search tree format with the libary JUNG2. Below you can see an example of how the tree should look like:

Here is some code which visualizes the vertex at the moment.
public class SimpleGraphView {
    Graph<Integer, String> g;
    Graph<String, String> n;
    /** Creates a new instance of SimpleGraphView */
    String text = "=IF(A2=1;0;IF(D2=D3;IF(C2=1;TRUE;FALSE);4))";
    public SimpleGraphView() {
        n = new SparseMultigraph<String, String>();
        String str = text;
        String delim = ";";
        StringTokenizer tok = new StringTokenizer(str, delim, true);
        text = text.replace("(", " ");
        String s = text.replace(")", " ");
        String[] r = s.split(";");
        for (int i = 0; i < r.length; i++) {
            //Vertex
            if(r.equals("=IF(")) {
                n.addVertex(r[i].toString());
            }
            if(i % 2==0){
                n.addVertex(r[i].toString());
            } else {
                n.addVertex(r[i].toString());
            }
        }
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        SimpleGraphView sgv = new SimpleGraphView(); // Creates the graph...
        // Layout<V, E>, VisualizationViewer<V,E>
        Layout<Integer, String> layout = new CircleLayout(sgv.n);
        layout.setSize(new Dimension(300,300));
        VisualizationViewer<Integer,String> vv = new VisualizationViewer<Integer,String>(layout);
        vv.setPreferredSize(new Dimension(350,350));
        // Show vertex and edge labels
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
        // Create our "custom" mouse here. We start with a PluggableGraphMouse
        // Then add the plugins you desire.
        PluggableGraphMouse gm = new PluggableGraphMouse(); 
        gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON1_MASK));
        gm.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1.1f, 0.9f));
        vv.setGraphMouse(gm); 
        JFrame frame = new JFrame("Interactive Graph View 3");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(vv);
        frame.pack();
        frame.setVisible(true);       
    }
}
I can render all vertexes out of the string in the array r. My problem is that I do not know how to connect all these vertexes with the proper edges. Any recommendations, how to connect all vertexes with the right edges?
I really appreciate your answer!