Module fera_graph::arbitrary

source ·
Expand description

Generate arbitrary graphs to be use in quickcheck tests.

This requires enabling quickcheck feature.

Examples:

Testing WithBuilder::new_gn_connected against Components::is_connected:

#[macro_use]
extern crate quickcheck;
extern crate fera_graph;

use fera_graph::prelude::*;
use fera_graph::algs::Components;
use fera_graph::arbitrary::GnConnected;
use quickcheck::quickcheck;

fn main() {
    fn tree(g: GnConnected<StaticGraph>) -> bool {
        let GnConnected(g) = g;
        g.is_connected()
    }

    quickcheck(tree as fn(GnConnected<StaticGraph>) -> bool);
}

Structs

A wrapper to create arbitrary graphs using WithBuilder::new_gn.
A wrapper to create arbitrary graphs using WithBuilder::new_gn_connected.
A wrapper to create arbitrary graphs with an edge property using WithBuilder::new_gn_connected.
A wrapper to create arbitrary graphs with a vertex property using WithBuilder::new_gn_connected.
A wrapper to create arbitrary graphs with an edge property using WithBuilder::new_gn.
A wrapper to create arbitrary graphs with a vertex property using WithBuilder::new_gn.