tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/5742-co-occurrance-networkNodeBox: Discussion 2016-08-21T22:00:57Ztag:support.nodebox.net,2012-11-01:Comment/401889362016-06-25T05:40:25Z2016-06-25T05:40:25ZCo-occurrance network?<div><p>Hi Rob,</p>
<p>Yes, you definitely could create a co-occurrance network with
Nodebox. NodeBox would have some advantages and disadvantages for
such a project.</p>
<p>First, it would be best if your csv file already has individual
terms isolated and organized by neighborhood (or whatever) so that
you can easily filter them. In theory you could build up organized
tables from raw text directly in NodeBox, but doing so would be
painful and inefficient.</p>
<p>In my experience, NodeBox can easily handle csv files with
thousands of terms, but would choke or slow to a crawl at 100,000
terms; it's not a big data tool. But for making individual charts I
assume this would not be an issue.</p>
<p>The main thing about using NodeBox for this purpose would be you
would have to start from scratch. There is no pre-existing
co-occuance network library (that I know of) to plug and play. This
will require a little more initial work but would also give you
much more flexibility and control, allowing you to experiment with
new and better ways of visualizing a particular dataset.</p>
<p>It is very easy in NodeBox to suck in a few hundred words from a
csv file, render each word in the font and size of your choice,
draw each word inside its own circle, set the size of each circle,
color the circles any way you want, position the circles on the
page, and connect them with lines that could be solid or dotted or
colored in a variety of ways.</p>
<p>I think the biggest challenge you would face would be
automatically positioning those circles in a pleasing and
meaningful way. NodeBox does not have a D3-style force layout
algorithm built in. And it would be difficult to define your own
force layout algorithm because NodeBox doesn't do recursion or
L-system generation. You could easily scatter the circles at
random, but minimizing (or even detecting) overlap would be
tricky.</p>
<p>So you need to think about how to automatically calculate an X,Y
position for each term in a more deterministic way. Once you devise
the algorithm, implementing it should be straightforward. It would
be even easier if the positions were already coded in (or could be
easily derived from) your csv file.</p>
<p>One strong advantage of NodeBox is that you can produce
high-quality PDFs or animations with elements that can vary in size
across seven orders of magnitude. I regularly create 12,000 by
9,000 scale PDFs which produce nice printouts and allow deep
zooming to see fine details. It is particularly nice to pan across
and zoom into such diagrams on an iPad.</p>
<p>The thing I love about NodeBox is the way it lets you fluidly
experiment with ideas, shaping them like clay and instantly seeing
the effects of any changes you make. And all of this without
writing a single line of code in the normal sense. There is a bit
of a learning curve but it's a lot of fun - and the results can be
quite impressive.</p>
<p>Good luck! If you decide to give NodeBox a try please don't
hesitate to ask for help or share your cool creations.</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/401889362016-06-25T13:43:05Z2016-08-18T09:15:45ZCo-occurrance network?<div><p>Hello John,</p>
<p>I would be very happy if I could duplicate the zip map example
on <a href="https://www.nodebox.net/node/documentation/using/data-visualization.html#a-zipmap-example">
https://www.nodebox.net/node/documentation/using/data-visualization...</a>.</p>
<p>I followed the instructions and duplicated the node
configuration in the screenshots, but to no avail. My csv is pretty
simple: a Source column and a Target column.</p>
<p>Attached are example files if you want to take a look. (The
actual csv file will be about 1100 rows with two columns.) When I
try to render the combine node nothing happens</p>
<p>Rob</p></div>Rob Bosstag:support.nodebox.net,2012-11-01:Comment/401889362016-06-25T14:42:03Z2016-06-25T14:42:05ZCo-occurrance network?<div><p>Thank you, John. I will keep experimenting with Nodebox.</p></div>Rob Bosstag:support.nodebox.net,2012-11-01:Comment/401889362016-08-18T11:10:48Z2016-08-18T11:10:48ZCo-occurrance network?<div><p>Hi Rob,</p>
<p>Your post 2 just appeared in my inbox, timestamped 2:15 AM
August 18 2016. But when I come to this thread, the same comment is
timestamped June 25. Did you post this comment last June or just
now?</p>
<p>I took a quick look at your example file and found a number of
mistakes that explain why you were not getting any output. This is
not surprising; that zipmap example is very hard to follow. I'm not
on the staff, but if I were I would clean it up.</p>
<p>Are you trying to create a diagram where each source number is
randomly positioned and surrounded by its target strings? Do you
still need help or did you figure it out on your own?</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/401889362016-08-18T11:50:16Z2016-08-18T11:50:17ZCo-occurrance network?<div><p>Hi John,</p>
<p>I posted the comment on June 25.</p>
<p>Yes, if each source number could be randomly positioned and
surrounded by its target strings, that would be great. I did not
figure it out.</p>
<p>Thanks,<br>
Rob</p></div>Rob Bosstag:support.nodebox.net,2012-11-01:Comment/401889362016-08-19T21:24:50Z2016-08-19T21:24:50ZCo-occurrance network?<div><p>Hi Rob,</p>
<p>Sorry I didn't see your comment in June.</p>
<p>I am attaching a (zipped) network which can create co-occurrance
rings from a csv file with two columns, Source and Target. I
simplified the confusing example you were trying to follow; you
don't actually need a zipmap for this case.</p>
<p>As you can see from the attached screenshot, the network is
fairly simple with just 12 nodes. One of these, make_ring, is a
subnetwork of 8 additional nodes; I have outlined it in red.
Make_ring takes the csv file and, for each Source value, produces a
ring of associated words.</p>
<p>The rest of the main network just calculates a random position
for each distinct source value and then draws both the source
number and the associated word ring at those positions.</p>
<p>When you replace the csv file with your 1100-row file, you will
have to make some adjustments so that all the words don't land on
top of each other.</p>
<ul>
<li>
<p>You can increase the overall area of your chart by increasing
the height and width of the rect node; if you want to save your
chart as a PNG or PDF, be sure to also increase the document size
(Document Properties under the File menu).</p>
</li>
<li>
<p>The scatter node uses a seed to randomize the positions. You can
step through different seed values until you find one that reduces
overlaps.</p>
</li>
<li>
<p>If it's too hard to find a scattering pattern that doesn't
overlap rings, you might consider using a grid node instead to
place the rings in evenly-spaced rows and columns. Add a slice node
set to the total number of source values if the grid produces more
positions than you need.</p>
</li>
</ul>
<p>You can adjust the size and density of the rings by making
several other adjustments inside the make_ring subnetwork (control
or right click on the node and choose "Edit Children"):</p>
<ul>
<li>
<p>In the textpath node you and adjust the font size of the words
and increase the diameter of each ring by increasing the first (x)
position value.</p>
</li>
<li>
<p>Adjust the value in the multiply node to increase or decrease
how tightly the words wrap around the center of the ring.</p>
</li>
</ul>
<p>I hope this helps. Good luck!</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/401889362016-08-19T21:29:58Z2016-08-19T21:30:00ZCo-occurrance network?<div><p>Thank you for your help, John. This is great!</p>
<p>-Rob</p></div>Rob Boss