Question: I have a collection of directed *acyclic* graphs that are *nearly* trees, in the following sense: each graph has a *root*, and the vertices are organized into *levels* such that if *v*1 and *v*2 are vertices, then if the level of *v*1 is less than the level of *v*2, then there is no edge from *v*2 to *v*1 in the graph, although there may be many edges from *v*1 to vertices at the same or a greater level. For example, an expression tree, a function call graph, or a linear class hierarchy, would be examples of such graphs. Here is an example of such a graph:

```
              A1            
             /  \           A1 -> A4, A3
            /    \          A3 -> A2, A6, A7
          A4  A2--A3        A2 -> A6
              | \ / \
              A6 \_ A7

```

There are a plethora of graph-drawing algorithms, and I can't determine which is optimal for this situation. Some preliminary research indicates that algorithms for drawing Hasse diagrams might be appropriate, but it seems that the output of such algorithms isn't geared toward the type of data structures that I'm trying to model. There are also several algorithms for modeling hierarchical data, but I'm not sure which would balance ease of implementation with efficiency. One problem with the former approach is that these graphs have a root, as well as a direction. If possible, the algorithm would support *cyclic* graphs, and minimize the number of numeric computations, but this isn't necessary. For these reasons, I would prefer to avoid force-directed algorithms, and if possible, the GraphViz algorithms such as *dot*.

Answer: 
This should work:

```
double px = x1 + (x2-x1)*position;
double py = y1 + (y2-y1)*position;
DoublePoint C = new DoublePoint(px, py);

```

`px` is the `x` coordinate between `x1` and `x2` at the distance from `x1` proportional to the value of `position`; `py` is the corresponding `y` coordinate.
```
DoublePoint C = new DoublePoint( position * (A.x + B.x), position * (A.y + B.y) );

```