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 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 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 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 + PartialEq> OpenHypergraph<O, A>
impl<O: Clone + PartialEq, A: Clone + PartialEq> 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<O, A>
pub fn to_open_hypergraph(self) -> OpenHypergraph<O, A>
Convert this lax OpenHypergraph
to a strict crate::prelude::OpenHypergraph
by
quotienting.
Trait Implementations§
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 more