i want to use flex to draw a flowchart basis on XML

I defined some rules in xml and want to read the xml to draw flowchart. In flowchart, i can drag and drop a logic component ex. if A to another if component B. Who can help me how to solve the collision of two components. B can expand his width and height automaticlly. There is any Algorithm for that? who has any idea? Thanks a lot!!!