4 ms·
Yep, it's currently the same hardcoded graph each time. The node starting positions are random so you get a slightly different layout each time. I was thinking
by dhotson 17y ago
Yep, it's currently the same hardcoded graph each time. The node starting positions are random so you get a slightly different layout each time.
I was thinking about making edges repel nodes in some way to avoid the problem you mentioned. I'll have to experiment some more..
- jonp 17y agoThat's really neat. I hit the same problem of crossing edges when doing this a while ago (in Python rather than JavaScript). Rather than trying to get everything done automatically by the code I added the ability to click and drag a point. So the algorithm gets you close to a good layout and you can then make adjustments to avoid unwanted crossings. It reminds me of an old HN comment "think cyborg, not robot" (http://news.ycombinator.com/item?id=164833 http://news.ycombinator.com/item?id=164833).
- dhotson 17y agoThanks jonp. :-) I think that's a good idea. The force directed layout algorithm isn't bullet proof, but it's a good approximate layout for a human to tweak.
- ableal 17y agoJust remembered this discussion http://news.ycombinator.com/item?id=1218376 http://news.ycombinator.com/item?id=1218376 also featured a force-directed graph layout algorithm, with brief paper and all. Just in case you missed it.