mbostock/d3 — pull request #1093 by leonardseymore (2013-02-22 09:30:39+00:00)
Title: Layered layout

This checkin includes:
- Basic layered layout (layer.js)
- Layered layout test case (layer-test.js)

## Use case

Sometimes it is desirable to draw a graph structure as a tree. The nature of a graph structure makes it hard to represent it generically as a tree. If we annotate the structure with "levels" we can render it as a hierarchy. This is useful in cases where you have a structure in which a child node can have many parents.

## Example

![graphpreview](https://f.cloud.github.com/assets/1201248/184212/e208af60-7cd1-11e2-9dd2-8c5f1b13e138.jpg)

```javascript
{
nodes: [
{name: "Level1a", level: 1}/*0*/,
{name: "Level2a", level: 2}/*1*/, {name: "Level2b", level: 2},/*2*/
{name: "Level3a", level: 3}/*3*/, {name: "Level3b", level: 3}/*4*/
],
links: [
{source: 0, target: 1}, // Level1a -> Level2a
{source: 0, target: 2}, // Level1a -> Level2b
{source: 1, target: 3}, // Level2a -> Level3a
{source: 2, target: 3}, // Level2b -> Level3a
{source: 1, target: 4}, // Level2a -> Level3b
{source: 2, target: 4} // Level2b -> Level3b
]
}
```