NAME
Graph::Writer::Sparse6 - write Graph.pm in sparse6 format
SYNOPSIS
use Graph::Writer::Sparse6;
my $writer = Graph::Writer::Sparse6->new;
$writer->write_graph($graph, 'filename.txt');
$writer->write_graph($graph, $filehandle);
CLASS HIERARCHY
Graph::Writer::Sparse6
is a subclass of Graph::Writer
.
Graph::Writer
Graph::Writer::Sparse6
DESCRIPTION
Graph::Writer::Sparse6
writes a Graph.pm
graph to a file in sparse6 format. This file format is per
The format represents an undirected graph possibly with multi-edges and self-loops. If a given $graph
is directed then an edge in either direction is written. If there's edges both ways then a multi-edge is written.
There are no vertex names and no attributes in the output. In the current implementation $graph->vertices()
is sorted alphabetically (sort
) to give a consistent (though slightly arbitrary) vertex numbering.
See Graph::Graph6 for further notes on the formats.
FUNCTIONS
$writer = Graph::Writer::Sparse6->new ()
-
Create and return a new writer object.
$writer->write_graph($graph, $filename_or_fh)
-
Write
$graph
to$filename_or_fh
in sparse6 format. A final newline"\n"
is included so this is suitable for writing multiple graphs one after the other to a file handle.$graph
should be aGraph.pm
object or something compatible. There's no check on the actual class of$graph
.
BUGS
Graph.pm
0.96 had a bug on undirected multiedged graphs where its edges()
method sometimes did not return all the edges of the graph, causing Graph::Writer::Sparse6
to write only those edges. Use version 0.97 for such a graph, or undirected countedged was ok.
SEE ALSO
Graph, Graph::Writer, Graph::Writer::Graph6
Graph::Graph6, nauty-showg(1), nauty-copyg(1)
HOME PAGE
http://user42.tuxfamily.org/graph-graph6/index.html
LICENSE
Copyright 2015 Kevin Ryde
Graph-Graph6 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Graph-Graph6 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Graph-Graph6. If not, see http://www.gnu.org/licenses/.