Skip to main content

BcsrHypergraph

Struct BcsrHypergraph 

Source
pub struct BcsrHypergraph<'view, W: BcsrWords> { /* private fields */ }
Expand description

Borrowed bipartite compressed-sparse-row hypergraph view.

BcsrHypergraph borrows the eight section payloads supplied through BcsrSections without copying or allocating. The single BcsrWords parameter selects the word family — NativeWords for host-order build-path views, LeWords for little-endian snapshot-backed views. Construction validates the borrowed slices according to the chosen BcsrValidation level. Once constructed, every traversal is O(degree) in either direction.

§Performance

Construction is O(P_head + P_tail + P_outgoing + P_incoming) at BcsrValidation::Layout. BcsrValidation::Strict adds an O((P_head + P_tail) · log d) cross-direction walk where d is the maximum vertex outgoing or incoming degree.

Implementations§

Source§

impl<'view, VertexIndex, RelationIndex, IncidenceIndex> BcsrHypergraph<'view, LeWords<VertexIndex, RelationIndex, IncidenceIndex>>
where VertexIndex: BcsrSnapshotIndex, RelationIndex: BcsrSnapshotIndex, IncidenceIndex: BcsrSnapshotIndex,

Source

pub fn from_snapshot( snapshot: &Snapshot<'view>, ) -> Result<Self, BcsrSnapshotError>

Opens a BcsrHypergraph backed by sections from snapshot.

§Errors

Returns BcsrSnapshotError when any required section is missing, has the wrong width for the requested typed view, or fails bipartite-CSR validation.

§Performance

O(s + P_head + P_tail + P_outgoing + P_incoming) for s snapshot sections and the four payload counts.

Source

pub fn from_snapshot_with( snapshot: &Snapshot<'view>, level: BcsrValidation, ) -> Result<Self, BcsrSnapshotError>

Opens a BcsrHypergraph from snapshot at the requested validation level.

§Errors

Returns BcsrSnapshotError for missing or wrong-width sections, and any crate::BcsrError surfaced through validation.

§Performance

As Self::from_snapshot at BcsrValidation::Layout; with BcsrValidation::Strict, adds O((P_head + P_tail) * log d) for the cross-direction walk.

Source§

impl<'view, W: BcsrWords> BcsrHypergraph<'view, W>

Source

pub fn open( sections: BcsrSections<'view, W::OffsetWord, W::VertexWord, W::RelationWord>, ) -> Result<Self, BcsrError>

Validates sections at BcsrValidation::Layout and returns a view.

§Errors

Returns BcsrError when any layout invariant fails. See BcsrValidation::Layout for the full list.

§Performance

O(P_head + P_tail + P_outgoing + P_incoming).

Source

pub fn open_with( sections: BcsrSections<'view, W::OffsetWord, W::VertexWord, W::RelationWord>, level: BcsrValidation, ) -> Result<Self, BcsrError>

Validates sections at the requested level and returns a view.

§Errors

Returns BcsrError when any invariant visible at level fails.

§Performance

O(P_head + P_tail + P_outgoing + P_incoming) at BcsrValidation::Layout; adds O((P_head + P_tail) · log d) at BcsrValidation::Strict.

Source

pub const fn vertex_count(&self) -> usize

Returns the number of vertices in this view.

§Performance

This method is O(1).

Source

pub const fn hyperedge_count(&self) -> usize

Returns the number of hyperedges in this view.

§Performance

This method is O(1).

Source

pub const fn outgoing_incidence_count(&self) -> usize

Returns the number of outgoing incidences (P_head == P_outgoing).

§Performance

This method is O(1).

Source

pub const fn incoming_incidence_count(&self) -> usize

Returns the number of incoming incidences (P_tail == P_incoming).

§Performance

This method is O(1).

Trait Implementations§

Source§

impl<W: BcsrWords> Clone for BcsrHypergraph<'_, W>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<W: BcsrWords> ContainsElement for BcsrHypergraph<'_, W>

Source§

fn contains_element(&self, element: BcsrVertexId<W::VertexIndex>) -> bool

Returns whether element is valid and visible in this view. Read more
Source§

impl<W: BcsrWords> ContainsIncidence for BcsrHypergraph<'_, W>

Source§

fn contains_incidence( &self, incidence: BcsrParticipantId<W::IncidenceIndex>, ) -> bool

Returns whether incidence is valid and visible in this view. Read more
Source§

impl<W: BcsrWords> ContainsRelation for BcsrHypergraph<'_, W>

Source§

fn contains_relation(&self, relation: BcsrHyperedgeId<W::RelationIndex>) -> bool

Returns whether relation is valid and visible in this view. Read more
Source§

impl<W: BcsrWords> Copy for BcsrHypergraph<'_, W>

Source§

impl<W: BcsrWords> Debug for BcsrHypergraph<'_, W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W: BcsrWords> DenseElementIndex for BcsrHypergraph<'_, W>

Source§

fn element_bound(&self) -> usize

Returns the exclusive upper bound for element indexes in this view. Read more
Source§

fn element_index(&self, element: BcsrVertexId<W::VertexIndex>) -> usize

Returns the dense index for element in this view. Read more
Source§

impl<W: BcsrWords> DenseIncidenceIndex for BcsrHypergraph<'_, W>

Source§

fn incidence_bound(&self) -> usize

Returns the exclusive upper bound for incidence indexes in this view. Read more
Source§

fn incidence_index( &self, incidence: BcsrParticipantId<W::IncidenceIndex>, ) -> usize

Returns the dense index for incidence in this view. Read more
Source§

impl<W: BcsrWords> DenseRelationIndex for BcsrHypergraph<'_, W>

Source§

fn relation_bound(&self) -> usize

Returns the exclusive upper bound for relation indexes in this view. Read more
Source§

fn relation_index(&self, relation: BcsrHyperedgeId<W::RelationIndex>) -> usize

Returns the dense index for relation in this view. Read more
Source§

impl<W: BcsrWords> DirectedHyperedgeIncidences for BcsrHypergraph<'_, W>

Source§

type SourceIncidences<'view> = BcsrParticipantSlice<<W as BcsrWords>::IncidenceIndex> where Self: 'view

Iterator over source-side participant incidence IDs.
Source§

type TargetIncidences<'view> = BcsrParticipantSlice<<W as BcsrWords>::IncidenceIndex> where Self: 'view

Iterator over target-side participant incidence IDs.
Source§

fn source_incidences( &self, hyperedge: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::SourceIncidences<'_>

Returns source-side participant incidence IDs for hyperedge.
Source§

fn target_incidences( &self, hyperedge: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::TargetIncidences<'_>

Returns target-side participant incidence IDs for hyperedge.
Source§

impl<W: BcsrWords> DirectedHyperedgeParticipants for BcsrHypergraph<'_, W>

Source§

type SourceParticipants<'view> = BcsrIdSlice<'view, <W as BcsrWords>::VertexWord, LocalId<VertexAxis, <<W as BcsrWords>::VertexWord as LayoutWord>::Index>> where Self: 'view

Iterator over source-side participants in one directed hyperedge.
Source§

type TargetParticipants<'view> = BcsrIdSlice<'view, <W as BcsrWords>::VertexWord, LocalId<VertexAxis, <<W as BcsrWords>::VertexWord as LayoutWord>::Index>> where Self: 'view

Iterator over target-side participants in one directed hyperedge.
Source§

fn source_participants( &self, hyperedge: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::SourceParticipants<'_>

Returns source-side participants for hyperedge.
Source§

fn target_participants( &self, hyperedge: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::TargetParticipants<'_>

Returns target-side participants for hyperedge.
Source§

impl<W: BcsrWords> DirectedVertexHyperedges for BcsrHypergraph<'_, W>

Source§

type OutgoingHyperedges<'view> = BcsrIdSlice<'view, <W as BcsrWords>::RelationWord, LocalId<HyperedgeAxis, <<W as BcsrWords>::RelationWord as LayoutWord>::Index>> where Self: 'view

Iterator over hyperedges where the vertex is source-side.
Source§

type IncomingHyperedges<'view> = BcsrIdSlice<'view, <W as BcsrWords>::RelationWord, LocalId<HyperedgeAxis, <<W as BcsrWords>::RelationWord as LayoutWord>::Index>> where Self: 'view

Iterator over hyperedges where the vertex is target-side.
Source§

fn outgoing_hyperedges( &self, vertex: BcsrVertexId<W::VertexIndex>, ) -> Self::OutgoingHyperedges<'_>

Returns hyperedges where vertex participates on the source side.
Source§

fn incoming_hyperedges( &self, vertex: BcsrVertexId<W::VertexIndex>, ) -> Self::IncomingHyperedges<'_>

Returns hyperedges where vertex participates on the target side.
Source§

impl<W: BcsrWords> ElementIncidenceCount for BcsrHypergraph<'_, W>

Source§

fn element_incidence_count( &self, element: BcsrVertexId<W::VertexIndex>, ) -> usize

Returns the number of incidences attached to element. Read more
Source§

impl<W: BcsrWords> ElementIncidences for BcsrHypergraph<'_, W>

Source§

type Incidences<'view> = BcsrElementIncidences<'view, <W as BcsrWords>::OffsetWord, <W as BcsrWords>::VertexWord, <W as BcsrWords>::RelationWord> where Self: 'view

Iterator over incidence IDs for one element. Read more
Source§

fn element_incidences( &self, element: BcsrVertexId<W::VertexIndex>, ) -> Self::Incidences<'_>

Returns incidences attached to element. Read more
Source§

impl<W: BcsrWords> ElementPredecessors for BcsrHypergraph<'_, W>

Source§

type Predecessors<'view> = BcsrNeighborVertices<'view, <W as BcsrWords>::RelationWord, <W as BcsrWords>::OffsetWord, <W as BcsrWords>::VertexWord> where Self: 'view

Iterator over predecessor element IDs reaching one element. Read more
Source§

fn element_predecessors( &self, vertex: BcsrVertexId<W::VertexIndex>, ) -> Self::Predecessors<'_>

Returns elements that reach element through outgoing connections. Read more
Source§

impl<W: BcsrWords> ElementSuccessors for BcsrHypergraph<'_, W>

Source§

type Successors<'view> = BcsrNeighborVertices<'view, <W as BcsrWords>::RelationWord, <W as BcsrWords>::OffsetWord, <W as BcsrWords>::VertexWord> where Self: 'view

Iterator over successor element IDs reached from one element. Read more
Source§

fn element_successors( &self, vertex: BcsrVertexId<W::VertexIndex>, ) -> Self::Successors<'_>

Returns elements reachable through outgoing connections from element. Read more
Source§

impl<W: BcsrWords> HyperedgeParticipants for BcsrHypergraph<'_, W>

Source§

type Participants<'view> = Chain<BcsrIdSlice<'view, <W as BcsrWords>::VertexWord, LocalId<VertexAxis, <<W as BcsrWords>::VertexWord as LayoutWord>::Index>>, BcsrIdSlice<'view, <W as BcsrWords>::VertexWord, LocalId<VertexAxis, <<W as BcsrWords>::VertexWord as LayoutWord>::Index>>> where Self: 'view

Iterator over vertices participating in one hyperedge.
Source§

fn hyperedge_participants( &self, hyperedge: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::Participants<'_>

Returns vertices participating in hyperedge.
Source§

impl<W: BcsrWords> IncidenceBase for BcsrHypergraph<'_, W>

Source§

type IncidenceId = LocalId<IncidenceAxis, <W as BcsrWords>::IncidenceIndex>

Identity of one element’s participation in one relation. Read more
Source§

type Role = BcsrRole

Implementation-defined participation role. Read more
Source§

impl<W: BcsrWords> IncidenceCounts for BcsrHypergraph<'_, W>

Source§

fn incidence_count(&self) -> usize

Returns the number of incidences visible in this topology view. Read more
Source§

impl<W: BcsrWords> IncidenceElement for BcsrHypergraph<'_, W>

Source§

fn incidence_element( &self, incidence: BcsrParticipantId<W::IncidenceIndex>, ) -> BcsrVertexId<W::VertexIndex>

Returns the element participating through incidence. Read more
Source§

impl<W: BcsrWords> IncidenceRelation for BcsrHypergraph<'_, W>

Source§

fn incidence_relation( &self, incidence: BcsrParticipantId<W::IncidenceIndex>, ) -> BcsrHyperedgeId<W::RelationIndex>

Returns the relation containing incidence. Read more
Source§

impl<W: BcsrWords> IncidenceRole for BcsrHypergraph<'_, W>

Source§

fn incidence_role( &self, incidence: BcsrParticipantId<W::IncidenceIndex>, ) -> BcsrRole

Returns the role for incidence. Read more
Source§

impl<W: BcsrWords> IncidentHyperedges for BcsrHypergraph<'_, W>

Source§

type IncidentHyperedges<'view> = Chain<BcsrIdSlice<'view, <W as BcsrWords>::RelationWord, LocalId<HyperedgeAxis, <<W as BcsrWords>::RelationWord as LayoutWord>::Index>>, BcsrIdSlice<'view, <W as BcsrWords>::RelationWord, LocalId<HyperedgeAxis, <<W as BcsrWords>::RelationWord as LayoutWord>::Index>>> where Self: 'view

Iterator over hyperedges incident to one vertex.
Source§

fn incident_hyperedges( &self, vertex: BcsrVertexId<W::VertexIndex>, ) -> Self::IncidentHyperedges<'_>

Returns hyperedges incident to vertex.
Source§

impl<W: BcsrWords> RelationIncidenceCount for BcsrHypergraph<'_, W>

Source§

fn relation_incidence_count( &self, relation: BcsrHyperedgeId<W::RelationIndex>, ) -> usize

Returns the number of incidences attached to relation. Read more
Source§

impl<W: BcsrWords> RelationIncidences for BcsrHypergraph<'_, W>

Source§

type Incidences<'view> = Chain<BcsrParticipantSlice<<W as BcsrWords>::IncidenceIndex>, BcsrParticipantSlice<<W as BcsrWords>::IncidenceIndex>> where Self: 'view

Iterator over incidence IDs for one relation. Read more
Source§

fn relation_incidences( &self, relation: BcsrHyperedgeId<W::RelationIndex>, ) -> Self::Incidences<'_>

Returns incidences attached to relation. Read more
Source§

impl<W: BcsrWords> TopologyBase for BcsrHypergraph<'_, W>

Source§

type ElementId = LocalId<VertexAxis, <W as BcsrWords>::VertexIndex>

Identity of a topology element. Read more
Source§

type RelationId = LocalId<HyperedgeAxis, <W as BcsrWords>::RelationIndex>

Identity of a topology relation. Read more
Source§

impl<W: BcsrWords> TopologyCounts for BcsrHypergraph<'_, W>

Source§

fn element_count(&self) -> usize

Returns the number of elements visible in this topology view. Read more
Source§

fn relation_count(&self) -> usize

Returns the number of relations visible in this topology view. Read more

Auto Trait Implementations§

§

impl<'view, W> Freeze for BcsrHypergraph<'view, W>

§

impl<'view, W> RefUnwindSafe for BcsrHypergraph<'view, W>

§

impl<'view, W> Send for BcsrHypergraph<'view, W>

§

impl<'view, W> Sync for BcsrHypergraph<'view, W>

§

impl<'view, W> Unpin for BcsrHypergraph<'view, W>

§

impl<'view, W> UnsafeUnpin for BcsrHypergraph<'view, W>

§

impl<'view, W> UnwindSafe for BcsrHypergraph<'view, W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ContainsHyperedge for T

Source§

fn contains_hyperedge(&self, hyperedge: Self::RelationId) -> bool

Returns whether hyperedge is valid and visible in this hypergraph view.
Source§

impl<T> ContainsParticipant for T

Source§

fn contains_participant(&self, participant: Self::IncidenceId) -> bool

Returns whether participant is valid and visible in this hypergraph view.
Source§

impl<T> ContainsVertex for T
where T: ContainsElement,

Source§

fn contains_vertex(&self, vertex: Self::ElementId) -> bool

Returns whether vertex is valid and visible in this hypergraph view.
Source§

impl<T> DenseHyperedgeIndex for T

Source§

fn hyperedge_bound(&self) -> usize

Returns the exclusive upper bound for hyperedge indexes in this view.
Source§

fn hyperedge_index(&self, hyperedge: Self::RelationId) -> usize

Returns the dense index for hyperedge in this view.
Source§

impl<T> DenseParticipantIndex for T

Source§

fn participant_bound(&self) -> usize

Returns the exclusive upper bound for participant indexes in this view.
Source§

fn participant_index(&self, participant: Self::IncidenceId) -> usize

Returns the dense index for participant in this view.
Source§

impl<T> DenseVertexIndex for T

Source§

fn vertex_bound(&self) -> usize

Returns the exclusive upper bound for vertex indexes in this view.
Source§

fn vertex_index(&self, vertex: Self::ElementId) -> usize

Returns the dense index for vertex in this view.
Source§

impl<T> DirectedHypergraph for T

Source§

impl<T> DirectedVertexPredecessors for T

Source§

type VertexPredecessors<'view> = <T as ElementPredecessors>::Predecessors<'view> where T: 'view

Iterator over predecessor vertices reaching one target-side vertex.
Source§

fn predecessor_vertices( &self, vertex: <T as TopologyBase>::ElementId, ) -> <T as DirectedVertexPredecessors>::VertexPredecessors<'_>

Returns source-side vertices that can reach vertex.
Source§

impl<T> DirectedVertexSuccessors for T

Source§

type VertexSuccessors<'view> = <T as ElementSuccessors>::Successors<'view> where T: 'view

Iterator over successor vertices reachable from one source-side vertex.
Source§

fn successor_vertices( &self, vertex: <T as TopologyBase>::ElementId, ) -> <T as DirectedVertexSuccessors>::VertexSuccessors<'_>

Returns target-side vertices reachable from vertex.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HyperedgeIncidences for T

Source§

type ParticipantIds<'view> = <T as RelationIncidences>::Incidences<'view> where T: 'view

Iterator over participant IDs attached to one hyperedge.
Source§

fn hyperedge_incidences( &self, hyperedge: <T as TopologyBase>::RelationId, ) -> <T as HyperedgeIncidences>::ParticipantIds<'_>

Returns participant IDs attached to hyperedge.
Source§

impl<T> HyperedgeParticipantCount for T

Source§

fn hyperedge_participant_count(&self, hyperedge: Self::RelationId) -> usize

Returns the number of participants attached to hyperedge.
Source§

impl<T> Hypergraph for T

Source§

impl<T> HypergraphBase for T
where T: TopologyBase,

Source§

impl<T> HypergraphCounts for T
where T: TopologyCounts,

Source§

fn vertex_count(&self) -> usize

Returns the number of vertices visible in this hypergraph view.
Source§

fn hyperedge_count(&self) -> usize

Returns the number of hyperedges visible in this hypergraph view.
Source§

impl<T> IncidenceView for T

Source§

impl<T> IncidentHyperedgeCount for T

Source§

fn incident_hyperedge_count(&self, vertex: Self::ElementId) -> usize

Returns the number of hyperedges incident to vertex.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ParticipantBase for T
where T: IncidenceBase,

Source§

impl<T> ParticipantCounts for T
where T: IncidenceCounts,

Source§

fn participant_count(&self) -> usize

Returns the total number of participant records visible in this view.
Source§

impl<T> ParticipantHyperedge for T

Source§

fn participant_hyperedge( &self, participant: Self::IncidenceId, ) -> Self::RelationId

Returns the hyperedge carrying participant.
Source§

impl<T> ParticipantRoleOf for T
where T: IncidenceRole,

Source§

fn participant_role_of(&self, participant: Self::IncidenceId) -> Self::Role

Returns the role recorded for participant.
Source§

impl<T> ParticipantVertex for T

Source§

fn participant_vertex(&self, participant: Self::IncidenceId) -> Self::ElementId

Returns the vertex referenced by participant.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> VertexIncidences for T

Source§

type ParticipantIds<'view> = <T as ElementIncidences>::Incidences<'view> where T: 'view

Iterator over participant IDs attached to one vertex.
Source§

fn vertex_incidences( &self, vertex: <T as TopologyBase>::ElementId, ) -> <T as VertexIncidences>::ParticipantIds<'_>

Returns participant IDs attached to vertex.