[][src]Struct hypergraph::Hypergraph

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

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 a IndexSet of weights allows having two or more hyperedges containing the same set of vertices (non-simple hypergraph).

Implementations

impl<V, HE> Hypergraph<V, HE> where
    V: SharedTrait,
    HE: SharedTrait
[src]

Hypergraph implementations.

pub fn new() -> Self[src]

Creates a new hypergraph with no allocation.

pub fn with_capacity(vertices: usize, hyperedges: usize) -> Self[src]

Creates a new hypergraph with the specified capacity.

pub fn add_vertex(&mut self, weight: V) -> VertexIndex[src]

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

pub fn get_vertex_weight(&self, index: VertexIndex) -> Option<&V>[src]

Gets the weight of a vertex from its index.

pub fn count_vertices(&self) -> usize[src]

Returns the number of vertices in the hypergraph.

pub fn add_hyperedge(
    &mut self,
    vertices: &[usize],
    weight: HE
) -> WeightedHyperedgeIndex
[src]

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

pub fn count_hyperedges(&self) -> usize[src]

Returns the number of hyperedges in the hypergraph.

pub fn get_hyperedge_weight(
    &self,
    (hyperedge_index, weight_index): WeightedHyperedgeIndex
) -> Option<&HE>
[src]

Gets the weight of a hyperedge from its weighted index.

pub fn get_hyperedge_vertices(
    &self,
    index: HyperedgeIndex
) -> Option<&HyperedgeVertices>
[src]

Gets the hyperedge's vertices.

pub fn get_hyperedges_intersections(
    &self,
    hyperedges: &[HyperedgeIndex]
) -> HyperedgeVertices
[src]

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

pub fn get_hyperedges_connections(
    &self,
    from: VertexIndex,
    to: VertexIndex
) -> Vec<HyperedgeIndex>
[src]

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

pub fn get_vertex_connections(&self, from: VertexIndex) -> Vec<VertexIndex>[src]

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

pub fn get_dijkstra_connections(
    &self,
    from: VertexIndex,
    to: VertexIndex
) -> Option<Vec<VertexIndex>>
[src]

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

pub fn render_to_graphviz_dot(&self)[src]

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

impl<V: Eq + Hash + Debug, HE: Debug> Debug for Hypergraph<V, HE>[src]

impl<'a, V, HE> Default for Hypergraph<V, HE> where
    V: SharedTrait + ExtendedDebug<'a>,
    HE: SharedTrait + ExtendedDebug<'a>, 
[src]

Auto Trait Implementations

impl<V, HE> RefUnwindSafe for Hypergraph<V, HE> where
    HE: RefUnwindSafe,
    V: RefUnwindSafe

impl<V, HE> Send for Hypergraph<V, HE> where
    HE: Send,
    V: Send

impl<V, HE> Sync for Hypergraph<V, HE> where
    HE: Sync,
    V: Sync

impl<V, HE> Unpin for Hypergraph<V, HE> where
    HE: Unpin,
    V: Unpin

impl<V, HE> UnwindSafe for Hypergraph<V, HE> where
    HE: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,