Prefuse is a very nice visualization toolkit. It is written in Java, it uses Java2D APIs to draw nodes, edges, and other visual items. It also handles events, supports animations, and other things you need to make the visualization become interactive.
The visualization display is implemented on top of JComponent. So it is very easy to embed it on another application, like what I did in LuaDeskSpot (source).
Okay, enough for the introduction. The purpose of this post is I want to show you how to use Prefuse through Jython. Yes, to make Prefuse (er.. Java, actually) scriptable!
Prefuse is a very nice visualization toolkit. It is written in Java, it uses Java2D APIs to draw nodes, edges, and other visual items. It also handles events, supports animations, and other things you need to make the visualization become interactive.
The visualization display is implemented on top of JComponent. So it is very easy to embed it on another application, like what I did in LuaDeskSpot (source).
Okay, enough for the introduction. The purpose of this post is I want to show you how to use Prefuse through Jython. Yes, to make Prefuse (er.. Java, actually) scriptable!
Prefuse is a very nice visualization toolkit. It is written in Java, it uses Java2D APIs to draw nodes, edges, and other visual items. It also handles events, supports animations, and other things you need to make the visualization become interactive.
The visualization display is implemented on top of JComponent. So it is very easy to embed it on another application, like what I did in LuaDeskSpot (source).
Okay, enough for the introduction. The purpose of this post is I want to show you how to use Prefuse through Jython. Yes, to make Prefuse (er.. Java, actually) scriptable!
Setelah semalem nyobain Jython, jadi kepikiran tuk make Prefuse dari Jython. Ternyata bisa! Utak-atik dikit lagi, dan jadilah sesuatu yg lebih menarik. Silakan lihat di screencast berikut =P
Setelah semalem nyobain Jython, jadi kepikiran tuk make Prefuse dari Jython. Ternyata bisa! Utak-atik dikit lagi, dan jadilah sesuatu yg lebih menarik. Silakan lihat di screencast berikut =P
Yang sudah ada itu struktur data sangat sederhana untuk graph, node, dan edge. Selain itu, ada juga fungsi layouting dengan teknik force-directed layout dg algoritma Fruchterman Reingold yg di-port dari Prefuse.
Berhubung dibuat pakai Python dan lagi teringat pengen nyoba Jython, maka saya jg sekalian nyoba ngebandingin Python dan Jython. Jython yang dipake adalah Jython 2.5b0. Ujicoba dilakukan di atas Ubuntu 8.04 32bit, Intel Core Duo 1.83GHz, RAM 2GB, aplikasi lain yg nyala yg mungkin mempengaruhi hasil adalah Eclipse (gak dipake, lupa ditutup aja =P), Banshee, dan Firefox. Inilah hasilnya..
Edge
Node
Python
Jython
100
93
5.348
6.421
200
171
17.403
13.945
300
234
33.011
22.798
400
294
53.674
35.107
500
358
77.672
50.576
Waahh.. pake Jython hasilnya lebih cepet euy!
Oprek2 dikit, jadilah graph plotter yg dibuat pake Python Imaging Library. Source code udah ada di repo git yg disebut di atas. Berikut ini 5 gambar dari 5 graf yg dipake di uji coba di atas.
Yang sudah ada itu struktur data sangat sederhana untuk graph, node, dan edge. Selain itu, ada juga fungsi layouting dengan teknik force-directed layout dg algoritma Fruchterman Reingold yg di-port dari Prefuse.
Berhubung dibuat pakai Python dan lagi teringat pengen nyoba Jython, maka saya jg sekalian nyoba ngebandingin Python dan Jython. Jython yang dipake adalah Jython 2.5b0. Ujicoba dilakukan di atas Ubuntu 8.04 32bit, Intel Core Duo 1.83GHz, RAM 2GB, aplikasi lain yg nyala yg mungkin mempengaruhi hasil adalah Eclipse (gak dipake, lupa ditutup aja =P), Banshee, dan Firefox. Inilah hasilnya..
Edge
Node
Python
Jython
100
93
5.348
6.421
200
171
17.403
13.945
300
234
33.011
22.798
400
294
53.674
35.107
500
358
77.672
50.576
Waahh.. pake Jython hasilnya lebih cepet euy!
Oprek2 dikit, jadilah graph plotter yg dibuat pake Python Imaging Library. Source code udah ada di repo git yg disebut di atas. Berikut ini 5 gambar dari 5 graf yg dipake di uji coba di atas.