[−][src]Struct hibitgraph::BitGraph
A BitGraph
is an undirected graph data structure
Its capacity is limited to mem::size_of::<usize>.pow(4)
Implementations
impl BitGraph
[src]
pub fn with_capacity(capacity: u32) -> BitGraph
[src]
Creates a new BitGraph preallocated with up to capacity
vertices
It is not possible later add vertices >= capacity
pub fn complete(capacity: u32) -> BitGraph
[src]
Creates a new BitGraph with capacity
vertices, with all vertices connected to each other.
It is not possible later add vertices >= capacity
pub fn add_edge(&mut self, u: u32, v: u32)
[src]
Adds a new undirected edge from u
to v
If the edge already exists, the graph is not updated
It is not possible to add edges with endpoints >= capacity
pub fn add_edge_unchecked(&mut self, u: u32, v: u32)
[src]
Same as add_edge
except that no boundary checks are performed.
Can corrupt the underlying data
pub fn remove_edge(&mut self, u: u32, v: u32)
[src]
Removes the edge from u
to v
after performing boundary checks.
If the edge is not present the graph is not updated
pub fn remove_edge_unchecked(&mut self, u: u32, v: u32)
[src]
Same as remove_edge
except that no boundary checks are performed
Can corrupt the underlying data
pub fn contract_edge(&mut self, target: u32, source: u32)
[src]
Contracts the edge (target, source) by adding all neighbors
of source to target
and removing source
pub fn contract_edge_unchecked(&mut self, target: u32, source: u32)
[src]
Same as contract_edge
without any boundary checks
This is very unsafe, and can corrupt the entire graph if the function is called
with invalid arguments
pub fn neighbors(&self, v: u32) -> BitIter<&BitSet>
[src]
Returns an iterator over the neighborhood of vertex v
pub fn order(&self) -> u32
[src]
Number of vertices in the graph
pub fn degree(&self, v: u32) -> u32
[src]
Number of neighbors of v
pub fn dfs(&self, v: u32) -> DfsIterator
[src]
Returns a DfsIterator
starting at vertex v
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BitGraph
impl Send for BitGraph
impl Sync for BitGraph
impl Unpin for BitGraph
impl UnwindSafe for BitGraph
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,