Removing duplicate vertices in a graph using JGraphX

Viewed 271

I have a single vertex (vertex A)being connected to two different vertices(B & C) . But it gets duplicated and shows the same vertex (A)being connected to the two different vertices(B & C). How can I make a single vertex (A) with 2 edges coming out and being connected to B & C.

    for (int i = 0; i < cardList.getSize(); i++) {
        try {

            Object v1 = graph.insertVertex(graph.getDefaultParent(), null, Card, x, y, cardWidth, cardHeight);
            Object v2 = graph.insertVertex(graph.getDefaultParent(), null, card.getConnectedCard(i), x + cardWidth + 50, y, cardWidth, cardPanelHeight);
            Object e1 = graph.insertEdge(graph.getDefaultParent(), null, "", v1, v2);

        } finally {
            graph.getModel().endUpdate();
        }
    }
1 Answers
Related