I am trying to make a sort of geneology type program in swing. The basics of the program are this: user chooses 2 or more elements. Each element combines with another to make a unique child element. A recursive algorithm tries all different permutations of combinations to find the one that results in the best final element.

But that part's done. My problem is that I'm trying to find a way to represent this graphically. In all the JTree interfaces, children have one parent. In my case, every element has, and must have, two parents. I was thinking about having a JDialog with a html table, with descendants represented by merged cells (i.e. P1 and P2 would be two cells in the first row, and C1 would be one cell colspan=2 in the second row).

When the algorithm is done, I get back a set of 3-size arrays (parent, parent, child) that lead into each other. So one permutation might look like this:

Starting elements: A1, A2, A3, A4, A5

[A1, A2, B1], [B1, A3, C1], [A4, A5, B2], [C1, B2, D1] (with D1 representing the final result)

As a table, it would look like this:

Two problems:
-What's the best way to represent this type of structure in java GUI
-How do I get this kind of data into a tree structure I can use to make into something graphical? I'm having trouble figuring out how to loop through my results when the results may not always follow a logical structure for building breadth-first, since the algorithm is depth first.

I think you're not on the right track. A genealogy "tree", as you call it, is not a tree in the computer science world. In that kind of tree, each node except the root has a single parent. As you observe, genealogy doesn't follow that rule.

But HTML does follow that rule. So it isn't really going to be helpful.

Sorry, I don't have a good idea of how to make a genealogy GUI. You could look at some other genealogy programs and steal borrow ideas from them.