Skip to content

Instantly share code, notes, and snippets.

View cbrandolino's full-sized avatar
👁️
👄. . 👁

Claudio Brandolino cbrandolino

👁️
👄. . 👁
  • Consultant, Front-end technologies
  • London, United Kingdon
View GitHub Profile
@cbrandolino
cbrandolino / README.md
Created October 27, 2016 12:02 — forked from bobbydavid/README.md
DAG visualization

taken from https://github.com/bobbydavid/dag-visualization at 6/22/13.

The algorithm is:

Create a random DAG (topographically sorted).

Determine X-positions. For each node, find it's minimum X-position. Then, in reverse order, find the maximum X-position of nodes that can be moved forward.

Determine Y-positions. For each node, place it as near as possible to the mean Y-position of its parents. Give preference to placing nodes that have a single parent with a single child (a 1-1 relationship), so that these will always be shown in a straight line.