graph.setDirection(direction);
}
Map<AbstractGraphicalEditPart, Object> partsToNodes = new HashMap<AbstractGraphicalEditPart, Object>();
diagram.contributeNodesToGraph(graph, null, partsToNodes);
diagram.contributeEdgesToGraph(graph, partsToNodes);
new CompoundDirectedGraphLayout().visit(graph);
diagram.applyGraphResults(graph, partsToNodes);
diagram.setBoundsOnModel();
}