Struct hypergraph::core::Hypergraph[][src]

pub struct Hypergraph<V, HE> {
    pub vertices: IndexMap<V, IndexSet<HyperedgeVertices>>,
    pub hyperedges: IndexMap<HyperedgeVertices, IndexSet<HE>>,
}
Expand description

A directed hypergraph composed of generic vertices and hyperedges.

Fields

vertices: IndexMap<V, IndexSet<HyperedgeVertices>>

Vertices are stored as an IndexMap whose keys are the weights and values are an IndexSet containing the hyperedges which are including the current vertex.

hyperedges: IndexMap<HyperedgeVertices, IndexSet<HE>>

Hyperedges are stored as an IndexMap whose keys are a vector of vertices indexes and values are an IndexSet of weights. Having an IndexSet of weights allows having two or more hyperedges containing the same set of 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.

Returns the number of hyperedges in the hypergraph.

Gets the list of all hyperedges containing a matching connection from one vertex to another.

Gets the hyperedge’s vertices.

Gets the weight of a hyperedge from its weighted index.

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

Removes a hyperedge based on its index. IndexMap doesn’t allow holes by design, see: https://github.com/bluss/indexmap/issues/90#issuecomment-455381877 As a consequence, we have two options. Either we use shift_remove and it will result in an expensive regeneration of all the indexes in the map or we use swap_remove and deal with the fact that the last element will be swapped in place of the removed one and will thus get a new index. We use the latter solution for performance reasons.

Updates the weight of a hyperedge based on its weighted index.

Updates the vertices of a hyperedge based on its index.

Adds a vertex as a custom weight in the hypergraph. Returns the index of the vertex.

Returns the number of vertices in the hypergraph.

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 list of all vertices connected to a given vertex.

Gets the hyperedges as vectors of vertices of a vertex from its index.

Gets the weight of a vertex from its index.

Removes a vertex based on its index. IndexMap doesn’t allow holes by design, see: https://github.com/bluss/indexmap/issues/90#issuecomment-455381877 As a consequence, we have two options. Either we use shift_remove and it will result in an expensive regeneration of all the indexes in the map or we use swap_remove and deal with the fact that the last element will be swapped in place of the removed one and will thus get a new index. We use the latter solution for performance reasons.

Updates the weight of a vertex based on its index.

Hypergraph implementations.

Creates a new hypergraph with no allocation.

Creates a new hypergraph with the specified capacity.

Renders the hypergraph to Graphviz dot format. Due to Graphviz dot inability to render hypergraphs out of the box, unaries are rendered as vertex peripheries which can’t be labelled.

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.