Hi everybody,
This email aims to present "officially" a new implementation of igraph basic layer : "igraphdb".
I already spoke about it here :
http://lists.gnu.org/archive/html/igraph-help/2009-03/msg00164.html
I wrote it last month with 4 others students (M. Anquetin, P. Baudemont, T. Franville-Lafargue, G. Racineux) as a school project (Enseeiht, Toulouse, France); project
supervised by Bruno Gaume.
We start from.5.1 version, but I just merge changing to 0.6, so far I create 2 branches on Launchpad :
lp:~enavarro222/igraph/0.6-db
(do "bzr branch lp:~enavarro222/igraph/0.6-db" to get it)Follow a rapid documentation just to get starting. Fell free to ask me any question.
Installation from bazaar
=================
You will need ODBC and it's development package. With linux, we only test with unixODBC (
http://www.unixodbc.org/). On ubuntu install : unixodbc, unixodbc-bin and unixodbc-dev.
Then you can run classic compilation process :
./bootstrap.sh
./configure
make
make install
What does it install ?
===============
lib/pkgconfig/igraphdb.pc
lib/libigraphdb.so
lib/
libigraphdb.la lib/libigraphdb.a
and
include/igraphdb/every_igraph.h
"igraph.h" still names "igraph.h" (as all .h files) but it goes to "include/igraphdb/" no more to "include/igraph/".
This way you can choose to compile your programs with igraph or igraphdb :
either "gcc -ligraph my_prog.c -o my_exe" or "gcc -ligraphdb my_prog.c -o my_exe"
or/and force the version to use in include line :
either "#include <igraph/igraph.h>" or "#include <igraphdb/igraph.h>"
How to set up the database ?
====================
You need to install ODBC drivers for your DB system, and then set up a DSN. To do small tests SQLite is great. On ubuntu simply install libsqliteodbc package. Then run ODBCConfig, add a user DSN using SQLite driver and pointing to a somewhere empty file.
By default igraphdb use the DSN named "igraphdb_dsn". But you can change it by setting up the IGRAPHDB_DSN environment variable.
Note that, it's easy to monitor sqlite database with firefox extension : sqlitemanager (
http://code.google.com/p/sqlite-manager )
New functions
===========
We introduce 2 new functions specific to DB implementations :
int igraph_open_connection(igraph_t * graph, char * dsn, long int graph_id);
int igraph_destroy_in_db(igraph_t *graph);
igraph_open_connection is a igraph_t constructor which permit to use an existing graph stored in the database pointed by the given DSN.
igraph_destroy_in_db entirely removes the graph from the DB (igraph_destroy doesn't).
DataBase structure
==============
- one index table : graphs_index
which registers graphs present in the DB. here is an example :
graph_id | is_directed | nb_vertices _________|_____________|____________
0 | 0 | 1055 1 | 1 | 560
2 | 0 | 10500456- one table by graph : graph_edges_#GRAPH
which contains the graph it self, for example :
edge_id | source | target 1 | 1 | 2
2 | 2 | 3 3 | 2 | 4
4 | 3 | 5 5 | 4 | 5"edge_id" field is the PRIMARY_KEY.
Two additional indexes are created for source and target fields (named : index_source_#GRAPH and index_target_#GRAPH)
Python interface
============
An adapted python interface is available in
lp:~enavarro222/igraph/0.6-db/interface/python
It generate a python module named igraphdb. So it's possible to use in the same time igraph and igraphdb.
I did really quickly python interface hack, they may still have a lot of bugs. Every feedback are welcome !
I wrote a wrapper for igraph_open_connection but not yet for igraph_destroy_in_db.
I hope this igraph version will interest some people. It's might be a solution for work on really large graphs.
But for sure it's not the miracle solution. Furthermore there is still a lot of work to have a really efficient "database based" library, like attributes management and memory caching.
Again any feedback or question are welcome !
Best regards,
Emmanuel Navarro