Sample JUNG graph with details similar to GraphViz


Today i managed to create a graph with details as shown above. The vertices has the state values as their label and edges contain the code line of Java which executed.

PS: In the previous post i got the bug because i have not put my JUNG libraries inside the jpf-core/lib folder. But once it moved it went well.

First Steps of Grabbing Correct Data from StateSpaceDot



I managed to crack though the code of StateSpaceDot and got the following results. Above graph is the one which is already generated using GraphViz.


Edge Id    ===TEST====>>>>0---(8---13)---1
Edge Id    ===TEST====>>>>1---(13---18)---2
Edge Id    ===TEST====>>>>1---(13---18)---2
Edge Id    ===TEST====>>>>1---(13---16)---1

+The first number denotes the starting state,
+Then the next two numbers in brackets shows the set of code which is corporate with the state transition. Here i used
trans.getStep(0).getInstruction().getLineNumber();
trans.getStep(trans.getStepCount()-1).getInstruction().getLineNumber();
to get the above data.
+ Third denotes the next state of the process.

As the next step i started to put those values into a JUNG graph. But when i try to create a very simple graph using JUNG, at the build phase it started generating some bugs as follows.

Buildfile: /root/workspace/jpf-core/build.xml
-init:
-compile-annotations:
-compile-main:
    [javac] Compiling 1 source file to /root/workspace/jpf-core/build/main
    [javac] /root/workspace/jpf-core/src/main/gov/nasa/jpf/listener/JUNGGraphCreater.java:6: package edu.uci.ics.jung.graph does not exist
    [javac] import edu.uci.ics.jung.graph.Graph;
    [javac]                              ^
    [javac] 1 error
BUILD FAILED

But i have already imported all the jar files related to JUNG and when im coding in eclipse it gives coding tips from the imported libraries as well. I think its a problem with the build.xml which is currently using only for JPF. Now im waiting to see some update :).

Proposing UI feature

Recently i worked with some codes in JUNG and found out some cool features:
+ Its possible to work with Mouse activities
+ Possible to Zoom and Pan

So by using the mouse activities i propose a part of UI as follows. Once the graph is draw from the process, the labels near the graph will be similar to what we have now. But when ever user clicks on the specific node it will display code part which is really relevant for that.

But if user needs to take the graph as output. ill give a selection for the user to select whether to print the codes as labels near the nodes (states).

So in this image user has selected the node shown in yellow. And below the graph it is shown the related java code chunk.

Findings on JUNG

Correction :: 

There's is something wrong with what i have mentioned in the previous post. We do not need to generate a Java code and run it separately again. We can Just create objects using JUNG and we can execute them though JPF too. 

Update :: 
I went though JUNG and found out some interesting facts. So by using JUNG we can do two type of things as our final outcome.

1.) We can out put the graphs into a JFrame which is possible to zoom and pan ::


If we are going to output it to a JFrame, as i figured it out its possible to animate it as well. We can just add the nodes  (states) in the way they appear in the actual program (but slowly to make it easy to understand).

2.) We can output the final graph in to a  .jpg or kind of a file format as the final result too.

And what i figured about JUNG is we can compile the JUNG codes to our source as set of external libraries. Still i have not found any text against that. Other than JUNG's code it users 
*) Larvalabs' generics version of Apache's Commons Collections libraries: http://larvalabs.com/collections/ 
*) The CERN Colt libraries (for some algorithms and I/O operations): http://www-itg.lbl.gov/~hoschek/colt/ 
Those libraries are already bundled inside the complete JUNG library set. 

Please comment if you have any concerns and ideas. Thank you.

1st result on Playing with JUNG


I have started with JUNG and up to now i was able to create a simple Graph by coding some Java codes.

But it seems the output graphic is generated by running a Java class. So for now i think we need to take an approach as follows.

JPF Listner---(write)---> Graph.java -----(Javac) -----> Graph.calss ----(run)--->Graphic

Or else we can use a separate class with methods to create the graph and that object will be responsible of making the final graphical result. In this case i need to find more about the resulting formats too.

And also i feel we can make the graphic animated, so it will help the person to understand the process easily.

Generating the Graphviz Graphs

I guess this is the final stage of configuration and testing of the current JPF for my project topic. Here i have generated graphs for very simple test applications the Racer and the Random.


 My next goal is to start researching much on JUNG toolkit for genarating graphs. Specially need to look at genarating cooler graphs with many number of nodes and details.

Proposal - Big Bang of State Space


Title
Create program execution diagrams using JUNG

Description
About Me:
========
I'm a final year Masters student of Faculty of Technology, University of Oulu, Finland. And also I completed a four year B.Sc degree in Computer Science and Engineering in University of Moratuwa, Sri Lanka. Currently Im specializing in Intelligent Systems.

Programming Experience
===================
From  2005 onwards i have engaged in programing with different programming languages and with different types of technologies.During my bachelors studies i have involved in various projects as subject requirements, individual projects and in group projects. Following is a list of projects I've involved in during my bachelors studies and onwards.

*) Programming Project (B.Sc. 3rd Year / 2006 / Individual / 12 weeks) ::
A simple mobile application created in J2ME for some server database access.

 *) Industrial Training (B.Sc. 3rd Year / 2006-2007 / Group Work / 24 weeks) ::
Worked in researching about Ajax technologies and about possible adaption of open source Ajax tools to the company.

*) Programming Project (B.Sc. 4th Year/ 2007-2008 / Individual / 12 weeks) ::
A concurrent racer was developed to describe the features of concurrent programming. I used java for implementing this application.

*) Final Year Project (B.Sc. 4th Year / 2007-2008 / Group Work / 48 weeks) ::
Created a home Automation and Monitoring tool. The research we conducted for this project was published at the IEEE conference NGMAST 2009. (See project Video:http://dsmartdraw.blogspot.com/). Here I contributed to the development of the Web Administration tool and the home client. Here i have used JavaScript, JSP, Java and Dynamic C as programming languages.

*) Industrial Training (2008-2009 / 52 weeks) ::
I underwent a one year research internship at MediaTeam,Oulu (http://www.mediateam.oulu.fi/). Here I have contributed to the development of the infrastructure of the project Ubi Program for Oulu City (http://www.ubioulu.fi/en/node). Here i have created a web based and standalone Hotspot(set of large display computers fixed in the city) administration tools. I have used Java, JavaScript, JSP for programming. And for data collection from the Hotspots i have used Nagios server (http://www.nagios.org/). 

So as a summary I'am confident with working in Java and other technologies and I'm good fast learner.

JPF knowledge
============
I'm a new person to this JPF project. I have found about the project JPF by searching through the project ideas given in GSoC 2010. I selected this project because of two reasons. One reason is that it involves truly engineering aspects instead of development of some codes in an ad-hoc manner. The other reason is  that this project had some project topics for JPF beginners. I consider this as a great opportunity to work while learning.

At the moment, i have installed JPF though eclipse and verified the sample jpf files. And i have started with JUNG to check the graphing features as well.

Topic : Create program execution diagrams using JUNG
=========================================
I am planning to work in this project in 3 simple phases.

1) Understanding and Background Search (up to end of May) ::
Here i will be do some sample works and test on both JPF and on JUNG to get familiarize with both technologies. At the end of this phase I will prepare a detailed  and precise design for the development in next two phases.

2) 1st Half of Development ::
Up to now i don't have a clear definition to break the project into two parts. But in this phase i will pay more attention into the class developments by JPF extension. Here i will pay less attention to the JUNG other than the basics.

3) End of Project
In the final stage i will finish the project with complete development of execution diagram generator using JUNG.

Thank you.