Trait pargraph::LabellingOperator

source ·
pub trait LabellingOperator<G>
where G: GraphBase,
{ type NodeWeight; type WorkItem: Borrow<G::NodeId>; // Required method fn op( &self, work_item: Self::WorkItem, local_view: LocalGraphView<&G, FullConflictDetection>, local_data: &mut Self::NodeWeight, worklist: impl WorklistPush<Self::WorkItem> ) -> Result<(), DataConflictErr<G::NodeId, G::EdgeId>>; }
Expand description

An graph operator which can only modify labels of nodes and edges but cannot change the topology of a graph.

Required Associated Types§

source

type NodeWeight

Data type used for label of the nodes.

source

type WorkItem: Borrow<G::NodeId>

Type used for representing a graph node.

In order to allow including associated data, the work item can be any type which allows to borrow a reference to the graph node ID. Because Borrow<T> is by default also implemented for T, this allows to use graph node IDs directly as a WorkItem.

Required Methods§

source

fn op( &self, work_item: Self::WorkItem, local_view: LocalGraphView<&G, FullConflictDetection>, local_data: &mut Self::NodeWeight, worklist: impl WorklistPush<Self::WorkItem> ) -> Result<(), DataConflictErr<G::NodeId, G::EdgeId>>

Do the graph operation on the given active node.

local_data provides exclusive mutable access to the node data of the active node. The operator can request read access to its neighborhood using local_view.try_node_weight(n). Nodes which should become active nodes later can be pushed to the worklist with the worklist.push() function. In order for data conflicts to be handled, the errors during locking of node or edge data must be propagated to the caller. Modifications to the local_data are not reverted upon a data conflict.

Object Safety§

This trait is not object safe.

Implementors§