Posted by kyle on July 28, 2006 12:17 AM | bookmark / share: |
I've got a whole bunch of stuff to share and I'm super busy so I'll share bits whenever I can post. This little self-organizing graph project now has a name, JSViz, and a whole new design that I hope will satisfy the OO geeks and new-to-scripting crowds alike. I'm sharing code in this post so you can get a sneak peek. I'll post about the overall design and usage details later. Let's talk about throttles!
New Refresh Throttle for Tree and Force Directed Graphs
No more CPU red-lining while your graph is in a settled state! I've added some rudimentary refresh throttling to the graph engines. In short, the refresh rate is slowed as entropy in the graph decreases. Below are some examples (and some geeky discussion):
In a Tree Graph, we can recognize that the system is settling as nodes in the graph reach their target positions. Here, entropy is estimated by counting the number of nodes within a tolerance of their target.
Since there are no "targets" in Force Directed Graphs, the implementation is a little more complex. We compare the variance in the forces applied in the current iteration against the variance from the previous iteration. As this difference approaches zero, less movement occurs in the graph, so we apply the throttle when this difference gets very close to zero.
In these demos an observer is attached to the Timer that drives animation of the graphs. The message in the upper left will indicate when the throttle has kicked in. Try moving a node once the graph has settled. You'll notice that the refresh rate will increase due to the increase in entropy. There's certainly some room for improvement. I'm sure we can halt the graph altogether when we've established a history of low entropy.