Module fera_graph::choose
source · Expand description
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
An iterator that produces random selected edges of a graph.
An iterator that produces random selected out edges of a vertex.
An iterator that produces random selected neighbors of a vertex.
An iterator that produces random selected vertices of a graph.
An iterator that produces a sequence of edges that forms a walk.
Traits
A graph from which vertices and edges can be randomly selected.