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
pub fn add_hyperedge(
&mut self,
vertices: &[usize],
weight: HE
) -> Option<WeightedHyperedgeIndex>
[src]
pub fn add_hyperedge(
&mut self,
vertices: &[usize],
weight: HE
) -> Option<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.
Returns the number of hyperedges in the hypergraph.
pub fn get_hyperedges_connections(
&self,
from: VertexIndex,
to: VertexIndex
) -> Vec<VertexIndex>
[src]
pub fn get_hyperedges_connections(
&self,
from: VertexIndex,
to: VertexIndex
) -> Vec<VertexIndex>
[src]Gets the list of all hyperedges containing a matching connection from one vertex to another.
Gets the hyperedge’s vertices.
pub fn get_hyperedge_weight(
&self,
[hyperedge_index, weight_index]: WeightedHyperedgeIndex
) -> Option<&HE>
[src]
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_hyperedges_intersections(
&self,
hyperedges: &[HyperedgeIndex]
) -> HyperedgeVertices
[src]
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 remove_hyperedge(
&mut self,
[hyperedge_index, weight_index]: WeightedHyperedgeIndex
) -> bool
[src]
pub fn remove_hyperedge(
&mut self,
[hyperedge_index, weight_index]: WeightedHyperedgeIndex
) -> bool
[src]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.
pub fn update_hyperedge_weight(
&mut self,
[hyperedge_index, weight_index]: WeightedHyperedgeIndex,
weight: HE
) -> bool
[src]
pub fn update_hyperedge_weight(
&mut self,
[hyperedge_index, weight_index]: WeightedHyperedgeIndex,
weight: HE
) -> bool
[src]Updates the weight of a hyperedge based on its weighted 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.
pub fn get_dijkstra_connections(
&self,
from: VertexIndex,
to: VertexIndex
) -> Option<Vec<VertexIndex>>
[src]
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
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 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
impl<'a, V, HE> Default for Hypergraph<V, HE> where
V: SharedTrait + ExtendedDebug<'a>,
HE: SharedTrait + ExtendedDebug<'a>,
[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,