pub struct Hypergraph<V, HE> { /* private fields */ }
Expand description

A directed hypergraph composed of generic vertices and hyperedges.

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.

Joins two or more hyperedges from the hypergraph into one single entity. All the vertices are moved to the first hyperedge in the provided order.

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 cheapest path of vertices between two vertices as a vector of tuples of the form (VertexIndex, Option<HyperedgeIndex>) where the second member is the hyperedge that has been traversed to reach the vertex. Please note that the initial tuple holds None as hyperedge since none has been traversed yet. The implementation of the algorithm is partially based on: https://doc.rust-lang.org/std/collections/binary_heap/#examples

Gets the list of all vertices connected from a given vertex as tuples of the form (VertexIndex, Vec).

Gets the list of all vertices connected to a given vertex as tuples of the form (VertexIndex, Vec).

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.