Trait fera_graph::choose::Choose

source ·
pub trait Choose: WithEdge {
    fn choose_vertex<R: Rng>(&self, rng: R) -> Option<Vertex<Self>>;
    fn choose_out_neighbor<R: Rng>(
        &self,
        v: Vertex<Self>,
        rng: R
    ) -> Option<Vertex<Self>>; fn choose_edge<R: Rng>(&self, rng: R) -> Option<Edge<Self>>; fn choose_out_edge<R: Rng>(
        &self,
        v: Vertex<Self>,
        rng: R
    ) -> Option<Edge<Self>>; fn choose_vertex_iter<R: Rng>(&self, rng: R) -> ChooseVertexIter<'_, Self, R> { ... } fn choose_out_neighbor_iter<R: Rng>(
        &self,
        v: Vertex<Self>,
        rng: R
    ) -> ChooseOutNeighborIter<'_, Self, R> { ... } fn choose_edge_iter<R: Rng>(&self, rng: R) -> ChooseEdgeIter<'_, Self, R> { ... } fn choose_out_edge_iter<R: Rng>(
        &self,
        v: Vertex<Self>,
        rng: R
    ) -> ChooseOutEdgeIter<'_, Self, R> { ... } fn random_walk<R: Rng>(&self, rng: R) -> RandomWalk<'_, Self, R> { ... } }
Expand description

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

See the module documentation for examples.

Required Methods

Returns a random vertex of this graph or None if the graph has no vertices.

Returns a random neighbor vertex of v or None if v has no neighbors.

Returns a random edge of this graph or None if the graph has no edges.

Returns a random out edge of v or None if v has no out edges.

Provided Methods

Returns an iterator that repeatedly calls choose_vertex.

Returns an iterator that repeatedly calls choose_out_neighbor(v).

Returns an iterator that repeatedly calls choose_edge.

Returns an iterator that repeatedly calls choose_out_edge(v).

Returns a iterator that produces a sequence of random edges that forms a walk, that is, the target vertex of the previous edge is the source vertex of the next edge.

Implementations on Foreign Types

Implementors