Struct SkelGraph

Source
pub struct SkelGraph { /* private fields */ }
Expand description

A skeletal finite graph with indexed source and target maps.

The data structure is the same as the standard Graph type in Catlab.jl.

Implementations§

Source§

impl SkelGraph

Source

pub fn add_vertex(&mut self) -> usize

Adds a new vertex to the graph and returns it.

Source

pub fn add_vertices(&mut self, n: usize) -> Range<usize>

Adds n new vertices to the graphs and returns them.

Source

pub fn add_edge(&mut self, src: usize, tgt: usize) -> usize

Adds a new edge to the graph and returns it.

Source

pub fn make_edge(&mut self) -> usize

Adds a new edge without initializing its source or target.

Trait Implementations§

Source§

impl Clone for SkelGraph

Source§

fn clone(&self) -> SkelGraph

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl ColumnarGraph for SkelGraph

Source§

type V = usize

Type of vertices in the graph.
Source§

type E = usize

Type of edges in the graph.
Source§

type Vertices = SkelFinSet

The set of vertices.
Source§

type Edges = SkelFinSet

The set of edges.
Source§

type Src = SkelIndexedColumn

The map assigning each edge its source vertex.
Source§

type Tgt = SkelIndexedColumn

The map assigning each edge its target vertex.
Source§

fn vertex_set(&self) -> &Self::Vertices

Gets the set of vertices.
Source§

fn edge_set(&self) -> &Self::Edges

Gets the set of edges.
Source§

fn src_map(&self) -> &Self::Src

Gets the mapping assigning a source vertex to each edge.
Source§

fn tgt_map(&self) -> &Self::Tgt

Gets the mapping assignment a target vertex to each edge.
Source§

fn get_src(&self, e: &Self::E) -> Option<&Self::V>

Gets the source of an edge, possibly undefined.
Source§

fn get_tgt(&self, e: &Self::E) -> Option<&Self::V>

Gets the target of an edge, possibly undefined.
Source§

impl Default for SkelGraph

Source§

fn default() -> SkelGraph

Returns the “default value” for a type. Read more
Source§

impl FiniteColumnarGraph for SkelGraph

Source§

fn iter_invalid(&self) -> impl Iterator<Item = InvalidGraphData<Self::E>>

Iterates over failures to be a valid graph.
Source§

impl MutColumnarGraph for SkelGraph

Source§

fn src_map_mut(&mut self) -> &mut Self::Src

Variant of src_map that returns a mutable reference.
Source§

fn tgt_map_mut(&mut self) -> &mut Self::Tgt

Variant of tgt_map that returns a mutable reference.
Source§

fn set_src(&mut self, e: Self::E, v: Self::V) -> Option<Self::V>

Sets the source of an edge.
Source§

fn set_tgt(&mut self, e: Self::E, v: Self::V) -> Option<Self::V>

Sets the target of an edge.
Source§

impl PartialEq for SkelGraph

Source§

fn eq(&self, other: &SkelGraph) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Validate for SkelGraph

Source§

type ValidationError = InvalidGraphData<usize>

The type of a validation error. Read more
Source§

fn validate(&self) -> Result<(), NonEmpty<Self::ValidationError>>

Validates the object.
Source§

impl Eq for SkelGraph

Source§

impl StructuralPartialEq for SkelGraph

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<G> FinGraph for G

Source§

fn vertices(&self) -> impl Iterator<Item = <G as Graph>::V>

Iterates over the vertices in the graph.
Source§

fn edges(&self) -> impl Iterator<Item = <G as Graph>::E>

Iterates over the edges in the graph.
Source§

fn in_edges(&self, v: &<G as Graph>::V) -> impl Iterator<Item = <G as Graph>::E>

Iterates over the edges incoming to a vertex. Read more
Source§

fn out_edges( &self, v: &<G as Graph>::V, ) -> impl Iterator<Item = <G as Graph>::E>

Iterates over the edges outgoing from a vertex. Read more
Source§

fn vertex_count(&self) -> usize

Number of vertices in the graph.
Source§

fn edge_count(&self) -> usize

Number of edges in the graph.
Source§

fn in_degree(&self, v: &Self::V) -> usize

Number of edges incoming to a vertex.
Source§

fn out_degree(&self, v: &Self::V) -> usize

Number of edges outgoing from a vertex.
Source§

fn degree(&self, v: &Self::V) -> usize

Number of edges incoming to or outgoing from a vertex. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<G> Graph for G
where G: ColumnarGraph,

Source§

type V = <G as ColumnarGraph>::V

Type of vertices in graph.
Source§

type E = <G as ColumnarGraph>::E

Type of edges in graph.
Source§

fn has_vertex(&self, v: &<G as Graph>::V) -> bool

Does the graph contain the value as a vertex?
Source§

fn has_edge(&self, e: &<G as Graph>::E) -> bool

Does the graph contain the value as an edge?
Source§

fn src(&self, e: &<G as Graph>::E) -> <G as Graph>::V

Gets the source of an edge, assumed to be contained in the graph.
Source§

fn tgt(&self, e: &<G as Graph>::E) -> <G as Graph>::V

Gets the target of an edge, assumed to be contained in the graph.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.