[Lemon-user] [Lemon::Graph]: release of version 0.99 of the Perl bindings to LEMON

Gabor Retvari retvari at tmit.bme.hu
Tue Sep 21 23:56:55 CEST 2010


Dear all,

I am glad to announce the v0.99 release of Lemon::Graph, the Perl bindings to 
LEMON. The code has been updated to compile with latest LEMON, some new 
features were implemented, many bugs were fixed, and additional documentation 
and tests were written (see the Changes file in the distribution).

The project page is at:

http://qosip.tmit.bme.hu/~retvari/Lemon-Graph.html

The code can be obtained from:

http://qosip.tmit.bme.hu/~retvari/perl-modules/Lemon-Graph-0.99.tar.gz

Additionally, a hg mirror of the development repository is available:

hg clone http://qosip.tmit.bme.hu/~retvari/perl-modules/Lemon-Graph

For a starter, enclosed is a sample code to compute the diameter of a directed 
Erdos-Renyi random graph.

Should you have any comments, do not hesitate to contact the author at:

retvari <AT> tmit <DOT> bme <DOT> hu

Best regards,
Gabor

-- 
Gábor Rétvári, Ph.D.
Research Fellow, BME-TMIT
Phone: +36-1-463-1060
Fax: +36-1-463-1763


######################################

use Lemon::Graph;
use List::Util qw(max);

# create a directed Erdos-Renyi random graph G(N,p)
$N = 300;
$p = .03;

$g = Lemon::Graph->new;
$g->addNode for 1..$N;

for $i ($g->nodeList) {
    for $j ($g->nodeList) {
        $i == $j and next;
        $g->addArc($i, $j) if rand(1) <= $p;
    }
}

# compute the diameter
for $i (@{ $g->nodeIt }) {
    $bfs = Lemon::Bfs->new($g);
    $bfs->run($i);
    $diameter = max($diameter,
                    max map {$bfs->dist($_)}
                        grep {$bfs->reached($_)}
                            $g->nodeList);
}

print "Graph diameter is $diameter\n";



More information about the Lemon-user mailing list