pub trait ContextNetworkExt: ContextBase + ContextRandomExt {
// Required method
fn get_matching_edges<T: EdgeType + 'static>(
&self,
person: PersonId,
filter: impl Fn(&Context, &Edge<T::Value>) -> bool + 'static,
) -> Vec<Edge<T::Value>>;
// Provided methods
fn add_edge<T: EdgeType + 'static>(
&mut self,
person: PersonId,
neighbor: PersonId,
weight: f32,
inner: T::Value,
) -> Result<(), IxaError> { ... }
fn add_edge_bidi<T: EdgeType + 'static>(
&mut self,
person1: PersonId,
person2: PersonId,
weight: f32,
inner: T::Value,
) -> Result<(), IxaError> { ... }
fn remove_edge<T: EdgeType + 'static>(
&mut self,
person: PersonId,
neighbor: PersonId,
) -> Result<(), IxaError> { ... }
fn get_edge<T: EdgeType + 'static>(
&self,
person: PersonId,
neighbor: PersonId,
) -> Option<&Edge<T::Value>> { ... }
fn get_edges<T: EdgeType + 'static>(
&self,
person: PersonId,
) -> Vec<Edge<T::Value>> { ... }
fn find_people_by_degree<T: EdgeType + 'static>(
&self,
degree: usize,
) -> Vec<PersonId> { ... }
fn select_random_edge<T: EdgeType + 'static, R: RngId + 'static>(
&self,
rng_id: R,
person_id: PersonId,
) -> Result<Edge<T::Value>, IxaError>
where R::RngType: Rng { ... }
}Required Methods§
Sourcefn get_matching_edges<T: EdgeType + 'static>(
&self,
person: PersonId,
filter: impl Fn(&Context, &Edge<T::Value>) -> bool + 'static,
) -> Vec<Edge<T::Value>>
fn get_matching_edges<T: EdgeType + 'static>( &self, person: PersonId, filter: impl Fn(&Context, &Edge<T::Value>) -> bool + 'static, ) -> Vec<Edge<T::Value>>
Get all edges of type T from person that match the predicate
provided in filter. Note that because filter has access to
both the edge, which contains the neighbor and Context, it is
possible to filter on properties of the neighbor. The function
match_person might be helpful here.
Provided Methods§
Sourcefn add_edge<T: EdgeType + 'static>(
&mut self,
person: PersonId,
neighbor: PersonId,
weight: f32,
inner: T::Value,
) -> Result<(), IxaError>
fn add_edge<T: EdgeType + 'static>( &mut self, person: PersonId, neighbor: PersonId, weight: f32, inner: T::Value, ) -> Result<(), IxaError>
Sourcefn add_edge_bidi<T: EdgeType + 'static>(
&mut self,
person1: PersonId,
person2: PersonId,
weight: f32,
inner: T::Value,
) -> Result<(), IxaError>
fn add_edge_bidi<T: EdgeType + 'static>( &mut self, person1: PersonId, person2: PersonId, weight: f32, inner: T::Value, ) -> Result<(), IxaError>
Add a pair of edges of type T between person1 and
neighbor2 with a given weight, one edge in each
direction. inner is a value of whatever type is associated
with T. This is syntactic sugar for calling add_edge
twice.
§Errors
Returns IxaError if:
personandneighborare the same or an edge already exists between them.weightis invalid
Sourcefn remove_edge<T: EdgeType + 'static>(
&mut self,
person: PersonId,
neighbor: PersonId,
) -> Result<(), IxaError>
fn remove_edge<T: EdgeType + 'static>( &mut self, person: PersonId, neighbor: PersonId, ) -> Result<(), IxaError>
Sourcefn get_edge<T: EdgeType + 'static>(
&self,
person: PersonId,
neighbor: PersonId,
) -> Option<&Edge<T::Value>>
fn get_edge<T: EdgeType + 'static>( &self, person: PersonId, neighbor: PersonId, ) -> Option<&Edge<T::Value>>
Get an edge of type T between person and neighbor
if one exists.
Sourcefn get_edges<T: EdgeType + 'static>(
&self,
person: PersonId,
) -> Vec<Edge<T::Value>>
fn get_edges<T: EdgeType + 'static>( &self, person: PersonId, ) -> Vec<Edge<T::Value>>
Get all edges of type T from person.
Sourcefn find_people_by_degree<T: EdgeType + 'static>(
&self,
degree: usize,
) -> Vec<PersonId>
fn find_people_by_degree<T: EdgeType + 'static>( &self, degree: usize, ) -> Vec<PersonId>
Find all people who have an edge of type T and degree degree.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.