Module fera_graph::choose [] [src]

Random selection of vertices and edges.

Examples

extern crate rand;
extern crate fera_graph;

use fera_graph::prelude::*;
use fera_graph::choose::Choose;

let g = CompleteGraph::new(5);
let iter = g.choose_vertex_iter(rand::weak_rng()).take(100);

let mut saw = g.default_vertex_prop(false);
for v in iter {
    saw[v] = true;
}
// or saw.set_values(iter, true);

// The probability of this test failing is left as an exercise for the reader.
assert!(g.vertices().all(|v| saw[v]));

Structs

ChooseEdgeIter

An iterator that produces random selected edges of a graph.

ChooseOutEdgeIter

An iterator that produces random selected out edges of a vertex.

ChooseOutNeighborIter

An iterator that produces random selected neighbors of a vertex.

ChooseVertexIter

An iterator that produces random selected vertices of a graph.

RandomWalk

An iterator that produces a sequence of edges that forms a walk.

Traits

Choose

A graph from which vertices and edges can be randomly selected.