Type Alias sunscreen_zkp_backend::CompiledZkpProgram
source · pub type CompiledZkpProgram = CompilationResult<Operation>;
Expand description
A ZKP program that has been through frontend compilation, but not yet JIT’d.
Aliased Type§
struct CompiledZkpProgram(pub StableGraph<NodeInfo<Operation>, EdgeInfo, Directed, u32>);
Fields§
§0: StableGraph<NodeInfo<Operation>, EdgeInfo, Directed, u32>
Methods from Deref<Target = StableGraph<NodeInfo<O>, EdgeInfo, Directed, u32>>§
sourcepub fn capacity(&self) -> (usize, usize)
pub fn capacity(&self) -> (usize, usize)
Return the current node and edge capacity of the graph.
sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes (vertices) in the graph.
Computes in O(1) time.
sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Return the number of edges in the graph.
Computes in O(1) time.
sourcepub fn is_directed(&self) -> bool
pub fn is_directed(&self) -> bool
Whether the graph has directed edges or not.
pub fn contains_node(&self, a: NodeIndex<Ix>) -> bool
sourcepub fn node_weight(&self, a: NodeIndex<Ix>) -> Option<&N>
pub fn node_weight(&self, a: NodeIndex<Ix>) -> Option<&N>
Access the weight for node a
.
Also available with indexing syntax: &graph[a]
.
sourcepub fn node_weights(&self) -> impl Iterator<Item = &N>
pub fn node_weights(&self) -> impl Iterator<Item = &N>
Return an iterator yielding immutable access to all node weights.
The order in which weights are yielded matches the order of their node indices.
sourcepub fn node_indices(&self) -> NodeIndices<'_, N, Ix>
pub fn node_indices(&self) -> NodeIndices<'_, N, Ix>
Return an iterator over the node indices of the graph
sourcepub fn edge_weight(&self, e: EdgeIndex<Ix>) -> Option<&E>
pub fn edge_weight(&self, e: EdgeIndex<Ix>) -> Option<&E>
Access the weight for edge e
.
Also available with indexing syntax: &graph[e]
.
sourcepub fn edge_weights(&self) -> impl Iterator<Item = &E>
pub fn edge_weights(&self) -> impl Iterator<Item = &E>
Return an iterator yielding immutable access to all edge weights.
The order in which weights are yielded matches the order of their edge indices.
sourcepub fn edge_endpoints(
&self,
e: EdgeIndex<Ix>
) -> Option<(NodeIndex<Ix>, NodeIndex<Ix>)>
pub fn edge_endpoints( &self, e: EdgeIndex<Ix> ) -> Option<(NodeIndex<Ix>, NodeIndex<Ix>)>
Access the source and target nodes for e
.
sourcepub fn edge_indices(&self) -> EdgeIndices<'_, E, Ix>
pub fn edge_indices(&self) -> EdgeIndices<'_, E, Ix>
Return an iterator over the edge indices of the graph
sourcepub fn edges_connecting(
&self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> EdgesConnecting<'_, E, Ty, Ix>
pub fn edges_connecting( &self, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> EdgesConnecting<'_, E, Ty, Ix>
Return an iterator over all the edges connecting a
and b
.
Directed
: Outgoing edges froma
.Undirected
: All edges connected toa
.
Iterator element type is EdgeReference<E, Ix>
.
sourcepub fn contains_edge(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> bool
pub fn contains_edge(&self, a: NodeIndex<Ix>, b: NodeIndex<Ix>) -> bool
Lookup if there is an edge from a
to b
.
Computes in O(e’) time, where e’ is the number of edges
connected to a
(and b
, if the graph edges are undirected).
sourcepub fn find_edge(
&self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> Option<EdgeIndex<Ix>>
pub fn find_edge( &self, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> Option<EdgeIndex<Ix>>
Lookup an edge from a
to b
.
Computes in O(e’) time, where e’ is the number of edges
connected to a
(and b
, if the graph edges are undirected).
sourcepub fn find_edge_undirected(
&self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>
) -> Option<(EdgeIndex<Ix>, Direction)>
pub fn find_edge_undirected( &self, a: NodeIndex<Ix>, b: NodeIndex<Ix> ) -> Option<(EdgeIndex<Ix>, Direction)>
Lookup an edge between a
and b
, in either direction.
If the graph is undirected, then this is equivalent to .find_edge()
.
Return the edge index and its directionality, with Outgoing
meaning
from a
to b
and Incoming
the reverse,
or None
if the edge does not exist.
sourcepub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix>
pub fn neighbors(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix>
Return an iterator of all nodes with an edge starting from a
.
Directed
: Outgoing edges froma
.Undirected
: All edges connected toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is NodeIndex<Ix>
.
Use .neighbors(a).detach()
to get a neighbor walker that does
not borrow from the graph.
sourcepub fn neighbors_directed(
&self,
a: NodeIndex<Ix>,
dir: Direction
) -> Neighbors<'_, E, Ix>
pub fn neighbors_directed( &self, a: NodeIndex<Ix>, dir: Direction ) -> Neighbors<'_, E, Ix>
Return an iterator of all neighbors that have an edge between them and a
,
in the specified direction.
If the graph’s edges are undirected, this is equivalent to .neighbors(a).
Directed
,Outgoing
: All edges froma
.Directed
,Incoming
: All edges toa
.Undirected
: All edges connected toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is NodeIndex<Ix>
.
Use .neighbors_directed(a, dir).detach()
to get a neighbor walker that does
not borrow from the graph.
sourcepub fn neighbors_undirected(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix>
pub fn neighbors_undirected(&self, a: NodeIndex<Ix>) -> Neighbors<'_, E, Ix>
Return an iterator of all neighbors that have an edge between them and a
,
in either direction.
If the graph’s edges are undirected, this is equivalent to .neighbors(a).
Directed
andUndirected
: All edges connected toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is NodeIndex<Ix>
.
Use .neighbors_undirected(a).detach()
to get a neighbor walker that does
not borrow from the graph.
sourcepub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, E, Ty, Ix>
pub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, E, Ty, Ix>
Return an iterator of all edges of a
.
Directed
: Outgoing edges froma
.Undirected
: All edges connected toa
.
Produces an empty iterator if the node doesn’t exist.
Iterator element type is EdgeReference<E, Ix>
.
sourcepub fn edges_directed(
&self,
a: NodeIndex<Ix>,
dir: Direction
) -> Edges<'_, E, Ty, Ix>
pub fn edges_directed( &self, a: NodeIndex<Ix>, dir: Direction ) -> Edges<'_, E, Ty, Ix>
Return an iterator of all edges of a
, in the specified direction.
Directed
,Outgoing
: All edges froma
.Directed
,Incoming
: All edges toa
.Undirected
,Outgoing
: All edges connected toa
, witha
being the source of each edge.Undirected
,Incoming
: All edges connected toa
, witha
being the target of each edge.
Produces an empty iterator if the node a
doesn’t exist.
Iterator element type is EdgeReference<E, Ix>
.
sourcepub fn externals(&self, dir: Direction) -> Externals<'_, N, Ty, Ix>
pub fn externals(&self, dir: Direction) -> Externals<'_, N, Ty, Ix>
Return an iterator over either the nodes without edges to them
(Incoming
) or from them (Outgoing
).
An internal node has both incoming and outgoing edges.
The nodes in .externals(Incoming)
are the source nodes and
.externals(Outgoing)
are the sinks of the graph.
For a graph with undirected edges, both the sinks and the sources are just the nodes without edges.
The whole iteration computes in O(|V|) time.
sourcepub fn map<'a, F, G, N2, E2>(
&'a self,
node_map: F,
edge_map: G
) -> StableGraph<N2, E2, Ty, Ix>where
F: FnMut(NodeIndex<Ix>, &'a N) -> N2,
G: FnMut(EdgeIndex<Ix>, &'a E) -> E2,
pub fn map<'a, F, G, N2, E2>( &'a self, node_map: F, edge_map: G ) -> StableGraph<N2, E2, Ty, Ix>where F: FnMut(NodeIndex<Ix>, &'a N) -> N2, G: FnMut(EdgeIndex<Ix>, &'a E) -> E2,
Create a new StableGraph
by mapping node and
edge weights to new values.
The resulting graph has the same structure and the same
graph indices as self
.
sourcepub fn filter_map<'a, F, G, N2, E2>(
&'a self,
node_map: F,
edge_map: G
) -> StableGraph<N2, E2, Ty, Ix>where
F: FnMut(NodeIndex<Ix>, &'a N) -> Option<N2>,
G: FnMut(EdgeIndex<Ix>, &'a E) -> Option<E2>,
pub fn filter_map<'a, F, G, N2, E2>( &'a self, node_map: F, edge_map: G ) -> StableGraph<N2, E2, Ty, Ix>where F: FnMut(NodeIndex<Ix>, &'a N) -> Option<N2>, G: FnMut(EdgeIndex<Ix>, &'a E) -> Option<E2>,
Create a new StableGraph
by mapping nodes and edges.
A node or edge may be mapped to None
to exclude it from
the resulting graph.
Nodes are mapped first with the node_map
closure, then
edge_map
is called for the edges that have not had any endpoint
removed.
The resulting graph has the structure of a subgraph of the original graph. Nodes and edges that are not removed maintain their old node or edge indices.