The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Graph::Easy::As_graph6 - stringize Graph::Easy in graph6 format

SYNOPSIS

 use Graph::Easy;
 my $graph = Graph::Easy->new;
 $graph->add_edge('foo','bar');

 use Graph::Easy::As_graph6;
 print $graph->as_graph6;

DESCRIPTION

Graph::Easy::As_graph6 adds an as_graph6() method to Graph::Easy to give a graph as a string of graph6, sparse6 or digraph6. These formats are per

graph6 format is an undirected graph without 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.

sparse6 format is an undirected graph possibly with multi-edges and self loops. If $graph is directed then an edge in either direction is written. If there's edges both ways then a multi-edge is written.

digraph6 format is a directed graph, possibly with self-loops but no multi-edges. Any multi-edges in $graph are written just once. If $graph is undirected then an edge in written in both directions (though usually graph6 or sparse6 would be preferred in that case).

The formats have no vertex names and no attributes. In the current implementation nodes are sorted alphabetically ($graph->sorted_nodes('name')) to give a consistent (though slightly arbitrary) vertex numbering.

See Graph::Graph6 for further notes on the formats.

FUNCTIONS

The following new method is added to Graph::Easy.

$str = $graph->as_graph6 (key => value, ...)

Return a string which is the graph6, sparse6 or digraph6 representation of $graph.

The string returned is printable ASCII. It includes a final newline "\n" so is suitable for writing directly to a file or similar. The only key/value options are

    format   => "graph6", "sparse6" or "digraph6",
                  string, default "graph6"
    header   => boolean (default false)

If header is true then write a header >>graph6<<, >>sparse6<< or >>digraph6<< as appropriate.

SEE ALSO

Graph::Easy, Graph::Easy::As_sparse6, Graph::Easy::Parser::Graph6

Graph::Graph6, nauty-showg(1), nauty-copyg(1)

HOME PAGE

http://user42.tuxfamily.org/graph-graph6/index.html

LICENSE

Copyright 2015, 2016, 2017, 2018 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/.