1

I will try to be explicit.

I have to place several tables in a screen, but I have to correctly place the tables, based on existing relations.

At the moment, I can get the tables and theirs relation, but that's all :

 HashMap<MMTable, Set<Relation>> tableRelations = new HashMap<MMTable, Set<Relation>>();
   List<MMTable> tables = find(project);

    //set relations for each table
    for(MMTable table : tables)
        tableRelations.put(table, findRelations(table));

I can also get positions of each table, change the position, update in the DB,...

Random rand = new Random();
for (Entry<MMTable, Set<Relation>> e : tableRelations.entrySet()) {
    e.getKey().setTableX(rand.nextInt(500));
    e.getKey().setTableY(400);

    update(e.getKey());
}

My goal wil be to obtain something like that : http://www.hostingpics.net/viewer.php?id=780099863.png

Is there an algorithm to solve this problem ?

StanislavL
  • 56,971
  • 9
  • 68
  • 98
Simulacre
  • 89
  • 6

0 Answers0