NAME

Graph::Writer::Graph6 - write Graph in graph6 format

SYNOPSIS

use Graph::Writer::Graph6;
my $writer = Graph::Writer::Graph6->new;
$writer->write_graph($graph, 'filename.txt');
$writer->write_graph($graph, $filehandle);

CLASS HIERARCHY

Graph::Writer::Graph6 is a subclass of Graph::Writer.

Graph::Writer
  Graph::Writer::Graph6

DESCRIPTION

Graph::Writer::Graph6 writes a Graph.pm graph to a file in graph6 format. This file format is per

The format represents an undirected graph with no self-loops or multi-edges. Any self-loops in $graph are ignored. Multi-edges are written just once, and if $graph is directed then an edge of either direction is written.

The format has no vertex names and no attributes. 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::Graph6->new (key => value, ...)

Create and return a new writer object. The only key/value option is

header   => boolean (default false)

If header is true then include a header >>graph6<<.

$writer->write_graph($graph, $filename_or_fh)

Write $graph to $filename_or_fh in the selected format. A final newline "\n" is included so this is suitable for writing multiple graphs one after the other.

$graph is either Graph.pm object or something sufficiently compatible. There's no check on the actual class of $graph. (Don't mistakenly pass a Graph::Easy here. It's close enough that it runs, but doesn't give a consistent vertex order and may miss edges on undirected graphs.)

BUGS

The current implementation uses Graph.pm method has_edge() which as of its version 0.96 is a bit slow on large graphs.

SEE ALSO

Graph, Graph::Writer, Graph::Writer::Sparse6

nauty-showg(1), Graph::Graph6

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/.