Posts tagged Node & Edge Data
Welcome to the third JUNG Tutorial developed by Game2Learn, a member of UNC-Charlotte’s Games + Learning Laboratory. This time we will address the issue of Storing our edge and node data in a hash-table then using that table to access our specific data. There are two advantages of this approach, the first is decoupling, a software engineering term used to describe reducing the interconnection of two portions of a program. If two components are highly coupled that means they depend on each other, if they have low coupling it means that they are more like individual items and can stand alone. In object oriented programming, the goal is generally to have low coupling when possible in order to make our programs more modular.
In this tutorial by storing our data in a hash table, we can decouple our data from both our graph and our visual representation, the visualizationViewer. The second benefit is, you as a programmer, can have quicker access to your data because hash-table look ups have an O(1), read as Big O of 1. In addition the process of decoupling our data from the other components makes sense when we have some feature of our application which only needs to interact with the data of some node, and not the graph topology, like changing the color of one of our nodes in our example program here. As you will see in this tutorial, some component of our program does not require the entire graph in order to change the color field of our nodeData object, it just needs to access our hash-table which stores all of the data specific to each node.
Click here to download the Node & Edge Hash-Table Demo associated with this tutorial.