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>>§

source

pub fn capacity(&self) -> (usize, usize)

Return the current node and edge capacity of the graph.

source

pub fn node_count(&self) -> usize

Return the number of nodes (vertices) in the graph.

Computes in O(1) time.

source

pub fn edge_count(&self) -> usize

Return the number of edges in the graph.

Computes in O(1) time.

source

pub fn is_directed(&self) -> bool

Whether the graph has directed edges or not.

source

pub fn contains_node(&self, a: NodeIndex<Ix>) -> bool

source

pub fn node_weight(&self, a: NodeIndex<Ix>) -> Option<&N>

Access the weight for node a.

Also available with indexing syntax: &graph[a].

source

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.

source

pub fn node_indices(&self) -> NodeIndices<'_, N, Ix>

Return an iterator over the node indices of the graph

source

pub fn edge_weight(&self, e: EdgeIndex<Ix>) -> Option<&E>

Access the weight for edge e.

Also available with indexing syntax: &graph[e].

source

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.

source

pub fn edge_endpoints( &self, e: EdgeIndex<Ix> ) -> Option<(NodeIndex<Ix>, NodeIndex<Ix>)>

Access the source and target nodes for e.

source

pub fn edge_indices(&self) -> EdgeIndices<'_, E, Ix>

Return an iterator over the edge indices of the graph

source

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 from a.
  • Undirected: All edges connected to a.

Iterator element type is EdgeReference<E, Ix>.

source

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).

source

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).

source

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.

source

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 from a.
  • Undirected: All edges connected to a.

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.

source

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 from a.
  • Directed, Incoming: All edges to a.
  • Undirected: All edges connected to a.

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.

source

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 and Undirected: All edges connected to a.

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.

source

pub fn edges(&self, a: NodeIndex<Ix>) -> Edges<'_, E, Ty, Ix>

Return an iterator of all edges of a.

  • Directed: Outgoing edges from a.
  • Undirected: All edges connected to a.

Produces an empty iterator if the node doesn’t exist.
Iterator element type is EdgeReference<E, Ix>.

source

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 from a.
  • Directed, Incoming: All edges to a.
  • Undirected, Outgoing: All edges connected to a, with a being the source of each edge.
  • Undirected, Incoming: All edges connected to a, with a being the target of each edge.

Produces an empty iterator if the node a doesn’t exist.
Iterator element type is EdgeReference<E, Ix>.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<O> Deref for CompilationResult<O>where O: Operation,

§

type Target = StableGraph<NodeInfo<O>, EdgeInfo, Directed, u32>

The resulting type after dereferencing.
source§

fn deref(&self) -> &<CompilationResult<O> as Deref>::Target

Dereferences the value.