Struct hypergraph::Hypergraph[][src]

pub struct Hypergraph<V, HE> {
    pub vertices: IndexMap<V, IndexSet<usize>>,
    pub hyperedges: IndexSet<HyperedgeKey<HE>>,
    // some fields omitted
}
Expand description

A directed hypergraph composed of generic vertices and hyperedges.

Fields

vertices: IndexMap<V, IndexSet<usize>>

Vertices are stored as a map whose unique keys are the weights and the values are a set of the hyperedges indexes which include

hyperedges: IndexSet<HyperedgeKey<HE>>

Hyperedges are stored as a set whose unique keys are a combination of vertices indexes and a weight. Two or more hyperedges can contain the exact same vertices (non-simple hypergraph).

Implementations

Adds a hyperedge as an array of vertices indexes and a custom weight in the hypergraph. Returns the weighted index of the hyperedge.

Clears all the hyperedges from the hypergraph.

Contracts a set of the vertices of a hyperedge into one single vertex. Returns the updated vertices. Based on https://en.wikipedia.org/wiki/Edge_contraction

Returns the number of hyperedges in the hypergraph.

Gets the vertices of a hyperedge.

Gets the weight of a hyperedge from its index.

Gets the hyperedges directly connecting a vertex to another.

Gets the intersections of a set of hyperedges as a vector of vertices.

Removes a hyperedge by index.

Updates the vertices of a hyperedge by index.

Updates the weight of a hyperedge by index.

Adds a vertex with a custom weight to the hypergraph. Returns the index of the vertex.

Returns the number of vertices in the hypergraph.

Gets the list of all vertices connected from a given vertex.

Gets the list of all vertices connected to a given vertex.

Gets a list of the shortest path of vertices between two vertices. The implementation of the algorithm is based on https://doc.rust-lang.org/std/collections/binary_heap/#examples

Gets the hyperedges of a vertex as a vector of vectors of VertexIndex.

Gets the hyperedges of a vertex as a vector of HyperedgeIndex.

Gets the weight of a vertex from its index.

Removes a vertex by index.

Updates the weight of a vertex by index.

Hypergraph implementations.

Clears the hypergraph.

Creates a new hypergraph with no allocation.

Creates a new hypergraph with the specified capacity.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.