pub struct OpenHypergraph<O, A> {
pub sources: Vec<NodeId>,
pub targets: Vec<NodeId>,
pub hypergraph: Hypergraph<O, A>,
}
Expand description
A lax OpenHypergraph is a cospan of lax hypergraphs: a hypergraph equipped with two finite maps representing the interfaces.
Fields§
§sources: Vec<NodeId>
§targets: Vec<NodeId>
§hypergraph: Hypergraph<O, A>
Implementations§
Source§impl<O, A> OpenHypergraph<O, A>
impl<O, A> OpenHypergraph<O, A>
Sourcepub fn tensor_assign(&mut self, rhs: OpenHypergraph<O, A>)
pub fn tensor_assign(&mut self, rhs: OpenHypergraph<O, A>)
Compute the tensor product f.tensor(g)
by mutating the data of f
Source§impl<O, A> OpenHypergraph<O, A>
impl<O, A> OpenHypergraph<O, A>
Sourcepub fn empty() -> Self
pub fn empty() -> Self
The empty OpenHypergraph with no nodes and no edges.
In categorical terms, this is the identity map at the unit object.
pub fn from_strict(f: OpenHypergraph<VecKind, O, A>) -> Self
pub fn new_edge(&mut self, x: A, interface: Hyperedge) -> EdgeId
Sourcepub fn new_operation(
&mut self,
x: A,
source_type: Vec<O>,
target_type: Vec<O>,
) -> (EdgeId, Interface)
pub fn new_operation( &mut self, x: A, source_type: Vec<O>, target_type: Vec<O>, ) -> (EdgeId, Interface)
Create a new “operation” in the hypergraph.
Concretely, f.new_operation(x, s, t)
mutates f
by adding:
- a new hyperedge labeled
x
len(s)
new nodes, with thei
th node labeleds[i]
len(t)
new nodes, with thei
th node labeledt[i]
Returns the new hyperedge ID and the NodeId
s of the source/target nodes.
This is a convenience wrapper for Hypergraph::new_operation
Sourcepub fn singleton(x: A, source_type: Vec<O>, target_type: Vec<O>) -> Self
pub fn singleton(x: A, source_type: Vec<O>, target_type: Vec<O>) -> Self
An OpenHypergraph
consisting of a single operation.
Sourcepub fn unify(&mut self, v: NodeId, w: NodeId)
pub fn unify(&mut self, v: NodeId, w: NodeId)
Compute an open hypergraph by calling to_hypergraph
on the internal Hypergraph
.
pub fn add_edge_source(&mut self, edge_id: EdgeId, w: O) -> NodeId
pub fn add_edge_target(&mut self, edge_id: EdgeId, w: O) -> NodeId
Source§impl<O: Clone + PartialEq, A: Clone> OpenHypergraph<O, A>
impl<O: Clone + PartialEq, A: Clone> OpenHypergraph<O, A>
Sourcepub fn quotient(&mut self)
pub fn quotient(&mut self)
Apply the quotient map to identify nodes in the internal Hypergraph
.
This deletes the internal quotient map, resulting in a strict OpenHypergraph
.
Sourcepub fn to_open_hypergraph(self) -> OpenHypergraph<VecKind, O, A>
pub fn to_open_hypergraph(self) -> OpenHypergraph<VecKind, O, A>
Convert this lax OpenHypergraph
to a strict crate::strict::OpenHypergraph
by
quotienting.
Trait Implementations§
Source§impl<O: Clone + PartialEq, A: Clone> BitOr<&OpenHypergraph<O, A>> for &OpenHypergraph<O, A>
impl<O: Clone + PartialEq, A: Clone> BitOr<&OpenHypergraph<O, A>> for &OpenHypergraph<O, A>
Source§type Output = OpenHypergraph<O, A>
type Output = OpenHypergraph<O, A>
|
operator.Source§impl<O: Clone, A: Clone> Clone for OpenHypergraph<O, A>
impl<O: Clone, A: Clone> Clone for OpenHypergraph<O, A>
Source§fn clone(&self) -> OpenHypergraph<O, A>
fn clone(&self) -> OpenHypergraph<O, A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<O: Clone + PartialEq, A: Clone> Shr<&OpenHypergraph<O, A>> for &OpenHypergraph<O, A>
impl<O: Clone + PartialEq, A: Clone> Shr<&OpenHypergraph<O, A>> for &OpenHypergraph<O, A>
Source§impl<O: Clone + PartialEq, A: Clone + PartialEq> Spider<VecKind> for OpenHypergraph<O, A>
impl<O: Clone + PartialEq, A: Clone + PartialEq> Spider<VecKind> for OpenHypergraph<O, A>
Source§fn dagger(&self) -> Self
fn dagger(&self) -> Self
Arrow
with type f : A → B
,
construct its dagger f† : B → A
by using Hypergraph structure to bend sources to targets and vice-versa.Source§fn spider(
s: FiniteFunction<VecKind>,
t: FiniteFunction<VecKind>,
w: Self::Object,
) -> Option<Self>
fn spider( s: FiniteFunction<VecKind>, t: FiniteFunction<VecKind>, w: Self::Object, ) -> Option<Self>
w
, and source s
and target t
interface maps.Source§fn half_spider(s: FiniteFunction<K>, w: Self::Object) -> Option<Self>
fn half_spider(s: FiniteFunction<K>, w: Self::Object) -> Option<Self>
t
leg is identity.