My team needs to build a flowchart generator in JavaScript, using either HTML5 Canvas or the D3 library (or anything else more suitable, suggestions welcome). The flowchart will be generated from a directed graph defined in a JSON document. My question is the following: which standard algorithm could we use to facilitate the automated placement of shapes in the flowchart (nodes in the graph) in order to minimize the number of overlapping connections and their lengths?