We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsWebsite,  Documentation,  Book Bugs › Bug in the Graph Layout example
Page Index Toggle Pages: 1
Bug in the Graph Layout example (Read 1836 times)
Bug in the Graph Layout example
May 25th, 2008, 2:25am
 
Hello,

I found a small bug the code for the Graph Demo in chapter 8 of Visualizing Data.

In the setup() function loadData() is called before textFont() which causes an error in the Node class when it tries to call textWidth().

Here is the corrected version:

void setup() {
 size(600, 600);  
 font = createFont("SansSerif", 10);
 textFont(font);
 loadData();
 println(edgeCount);  
 smooth();
}

Thanks,

Jason
Re: Bug in the Graph Layout example
Reply #1 - Nov 13th, 2008, 7:54pm
 
Thanks for posting this, Jason.  I'm just experimenting with the graph layout example and, for what it's worth, I didn't get that error.

I am, however, seeing weird behavior in which the relax() layout is causing all the nodes to squish together too close to each other horizontally, making the layout too vertical.  See this image:

http://alignedleft.com/projects/2008/graph-layout.png

Weird, right?  I have double-checked that I typed the code exactly as written in the book.  Any thoughts?  I would expect something more balanced, as in the screenshot on page 229.
Page Index Toggle Pages: 1