List<DependencyGraphNode> nodes = graph.getNodes();
List<DependencyGraphEdge> edges = getInternalSubGraphRelations(nodes);
DependencyGraphNode centerNode = getCenterNodeOfSubgraph();
Point centerPosition = calculatePositionOfCenterNode(windowWidth, windowHeight);
centerNode.setLocation(centerPosition.x,centerPosition.y);
int offset = 0;
int distanceFromCenter = calculateDistanceFromCenterNode(nodes,edges);
float angle = 0.0f;
float angleOffset = 360.0f / ((float)(nodes.size()-1));
for(int i = 0; i < nodes.size(); i++)
{
if( nodes.get(i).isLocalRoot() )
{
offset++;
continue;
}
angle = (float)(i-offset) * angleOffset;
angle = (float)(angle * Math.PI / 180.0f);
int posX = (int)(Math.cos(angle) * distanceFromCenter);
int posY = (int)(Math.sin(angle) * distanceFromCenter);
Point position = new PrecisionPoint(posX, posY);
normalizeNodePositions(centerPosition, position, angle);
nodes.get(i).setLocation(position.x,position.y);
}