5 releases

0.1.1 May 16, 2023
0.1.0 May 15, 2023
0.0.2 May 15, 2023
0.0.1 May 15, 2023
0.0.0 May 14, 2023

#2886 in Parser implementations

Download history 7/week @ 2024-09-19 4/week @ 2024-09-26

63 downloads per month

MPL-2.0 license

13KB
311 lines

G6

Pure rust parser for graph6, digraph6 formats.

Import

  • import undirected graph6 from text
use g6::Graph6;
use std::str::FromStr;

#[test]
fn import_graph6() {
    let graph = Graph6::from_str("E?Bw").unwrap();
    assert_eq!(graph.nodes(), 5);
    assert_eq!(graph.edges(), 6);
}
  • import undirected graph6 from text
use g6::DiGraph6;
use std::str::FromStr;

#[test]
fn import_digraph6() {
    let digraph = DiGraph6::from_str("&B|o").unwrap();
    assert_eq!(digraph.nodes(), 3);
    assert_eq!(digraph.edges(), 7);
}
  • import large sparse6 from text
use g6::Sparse6;
use std::str::FromStr;

#[test]
fn import_sparse6() {
    let digraph = Sparse6::from_str(":Fa@x^").unwrap();
    assert_eq!(digraph.nodes(), 7);
    assert_eq!(digraph.edges(), 4);
}

Export

  • to text format

todo

  • to wolfram mathematica

todo

Test Cases

http://users.cecs.anu.edu.au/~bdm/data

Dependencies

~81KB