Graph::GML - Perl extension for reading GML files and creating a Graph object
use Graph::GML; my $Obj = new Graph::GML(file=>"file.gml");
The Graph Modelling Language (see http://en.wikipedia.org/wiki/Graph_Modelling_Language> ) is an ASCII file format for describing graphs. It is quite extensive, not only defining the graph itself but including tags for graphics. This perl module is concerned with reading in a GML file and then creating a Graph module for use in operations on the graph. It does not handle the graphics section as defined in the standard.
An example GML file is:
Creator "Leigh Metcalf December 30, 2011" graph [ directed 0 comment "Hi there!" node [ id 1 label "Chocolate" value 3 ] node [ id 2 label "Chip" value 0 ] node [ id 3 label "Peanut butter" value 2 ] node [ id 4 label "Nutella" value 2 ] edge [ source 1 target 2 value 3 ] edge [ source 3 target 4 value 0 ] edge [ source 2 target 3 value 1 ] ]
Note that in creating the Graph perl module, the vertices are labeled not with the id given in the node section, but with the label. If a label is not given, it defaults to the id. The value given in the node section is used as the vertex weight and the value given in the edge section is the edge weight. I have not found the directed keyword in the GML specification, however, since it seems to be used I support it and created the graph accordingly.
One caveat. This perl module works by reading in the entire GML file and operating on the given text at this time. If the GML file is 'large', this could cause a problem.
None by default.
All of the GML files found at http://www-personal.umich.edu/~mejn/netdata/ were used to test this perl module. It is a very good source of network data.
Leigh Metcalf, <leigh@fprime.net>
Copyright (C) 2011 by Leigh Metcalf
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.
To install Graph::GML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::GML
CPAN shell
perl -MCPAN -e shell install Graph::GML
For more information on module installation, please visit the detailed CPAN module installation guide.