Introductory Lab for SoNIA
Aim: to provide a brief practical introduction to SoNIA and some conceptual background on dynamic network visualization. This document was written by Dan McFarland for use in demonstrating SoNIA in his classrooms.
For full functionality, SoNIA requires at least Java 1.3.1, QuickTime, and QTJava be installed on your computer. To download SoNIA, and for full details and installation instructions, please visit http://sonia.stanford.edu/documentation/install.html
1. Starting SoNIA
SoNIA can be launched by double clicking on the sonia.jar file, but will not provide full information about errors. It is better to launch SoNIA directly by using the java command in the terminal window (the dos "C/" prompt on windows machines). Navigate to the directory containing SoNIA and type:
java -cp sonia.jar sonia.SoniaController
2. Loading the Newcomb data
Click the "Load Files..." button. Navigate to the "necomb1.net" file and open it. Click OK in the window that pops up. If the file loads successfully, some information about the file will be printed in the "SoNIA Session Log" window, otherwise an error message will appear details the problem.
The log tells how many node and arc events (how many individual records there are in the data, not the number present at one time). It also displays the smallest and largest time values in the data, this gives overall time range you may want to examine. The Newcomb data consists of an acquaintance network sampled at 15 time points, so the data are in discrete waves.
3. Creating a Layout (for Newcomb)
Click the "Create Layout..." button. This will bring up a window allowing to make decisions about what range of the data to work with, the layout technique, etc. "Create Layout" always applies to the most recently loaded network, but multiple networks can be loaded, and/or multiple layouts for the same network created. "Start Time" and "End Time" give the temporal range for the layout. Enter 1 and 15. "Slice duration" gives the length of time to be used for each bin when constructing the "slice" networks.
The "phase plot" button brings up a window which shows a time map of the data you are working with. Dark blue indicates arc events, light blue indicates nodes, and the length of lines indicates their position in time. The purple square is a preview of a slice. The window will update when you return while editing one of the layout slice fields.
Because Newcomb is discrete "integer time" data, it is "binned" when the data was collected. If you want each frame to correspond to the original waves, you will probably want to enter 1. "Slice Delta" controlled the offset between successive slices, set this to the same as the slice size (1) , for non-overlapping slices (more on this later). Set the "Slice aggregation settings to "Avg. of i->j ties." Set the layout type to "Multi Component Kamada-Kawai". Click "Create Layout". A layout window should appear. All the nodes will be drawn in the top left because no layout has been applied.
4. Applying a Layout algorithm (MultiComponent Kamada-Kawai)
Click "Apply Layout.." to bring up the layout settings dialog. Set the starting coordinates to "Randomize" or "Circular". Click Apply. The Kamada-Kawai "spring embedder" layout will be applied to the first slice (slice 0).
The green dots on the "Schedule" window give information on the algorithms convergence (the change in the "energy" of the layout after each iteration of the algorithm.) In some rare cases, the layout will fail to converge, this will show as a cycle (parallel lines) in the "schedule plot". Or it may need more iterations to arrive at a solution, in which case set the value of "Max. Passes" higher.
The layout drawn in the window will be fairly "crunched." It doesn't take advantage of much of the screen space, and it is hard to see the ties. The "optimal distance" between nodes that the layout is aiming for can be adjusted. Click on "Apply Layout" again. Enter 50 in the "Opt. Dist." field, and click "apply." The layout should be much larger. To adjust the display further, click on "View Options" to bring up the graphic settings dialog. Un-check "Transparency", and set Node and Arc scale factors to 0.5.
At this point, a layout has only been created for the first "slice" network. To create the remaining networks, enter 1 in the "Layout slice" field and hit return, or click the ">|" button to advance to the next slice. All the nodes will appear in the upper left corner, at the origin of the coordinate axes. At this point you could click "Re-Apply" to apply the same layout settings to this slice. However, KK usually gives the best results when each layout is started from the coordinates of the previous layout, as this helps the algorithm find an optimia that is close in coordinate space to the previous layout. Click "Apply Layout", and set the starting coordinates to "From Previous Slice", then click "Apply to Remaining" to apply these layout settings to all the rest of the slices. When it has finished, use the "|<" and ">|" buttons to step through the "movie" one slice at a time, or go back to the beginning and press ">" to watch the whole thing. (you can also navigate by bringing up the phase plot window and clicking on slices) To make the animation smoother/slower, enter a larger number in the "interp. frames field" - this controls how many frames will be rendered between the slices (you will need to set the "duration" field back to 1).
5. Evaluating the "Stress" of the layout
Most social networks require a high dimensional layout in order to accurately represent the relative distances. Projecting down to the two dimensions of the screen usually results in some degree of distortion. To get a sense of how distorted a given layout is, click the "Stress.." button. This brings up a "Shepard's Stress Plot" window. The desired distances for each arc in the network matrix (in the case of KK, the distance matrix is created by converting the adjacency values to dissimilarities, and then finding the all-pairs-shortest-path or "Geodesic distance" between each of the nodes) are plotted against the arc's length on the screen layout. In a hypothetical zero-distortion layout, all of the points would lie on the white diagonal, so the scatter gives a qualitative measure of the distortion. The dark blue points indicate the direct ties (the arcs actually drawn on screen) and the light blue points indicate the multiple step relations. The "stress" value given is an adaptation of "Kruskal's Stress" from MDS. Values below 0.2 are generally considered to be "acceptable".
To see how node positions effect the stress, click the "move nodes" button in the layout to turn on the manual adjustment mode. Drag one of the nodes to a new position on the screen, and recalculate the stress. Be sure to click the "Stop Moving" button to end the adjustment mode when you are finished.
6. Saving the network animation as a QuickTime movie
When an animation is viewed in SoNIA, the rate of movement is controlled by the speed at which Java can draw each of the frames to the screen. So networks with many arcs and edges will take longer, and appear to move more slowly. Also, it is often useful to store the results of a layout, show it over the web, etc. To export an animation as a QuickTime movie, click the "Export Movie..." button in the main controller window. Choose the layout to export (if you have created more than one). Chose a name and location for the movie file (file name should end in .mov). Click OK. A window will popup showing the movie export frame by frame as it saves out. When it has finished, the movie can be played in the QuickTime MoviePlayer, or in most web browsers. Because the movie is literally a sequence of pictures of the network, the file will be quite large, and it is not possible to further edit the network. There will be some loss of image quality due to compression, we hope to eventually use a better compressor.
8. Saving out the log file
The log file records (most of) the parameters, settings, and the sequence of actions used to create your layout. Generally it is a good idea to save out the log file at the same time you save the movie. That way you will have enough information to reconstruct the movie at a later date, and will be able to remember the exact details. Click the "Write Log to File" button in the Log window, choose a name and location for the file.
----- For more information on how to use additional layout algorithms, configuring data for input, etc. please check the website at http://sonia.stanford.edu/ or email email@example.com.