SimilarityMatrix

Struct SimilarityMatrix 

Source
pub struct SimilarityMatrix<'a, F, G, E, N>
where F: NodeColorMatching<N>, G: Graph<EDGE = E, NODE = N> + 'a, E: Edges, N: Clone,
{ /* private fields */ }

Implementations§

Source§

impl<'a, F, G, E, N> SimilarityMatrix<'a, F, G, E, N>
where F: NodeColorMatching<N>, G: Graph<EDGE = E, NODE = N>, E: Edges, N: Clone,

Source

pub fn new( graph_a: &'a G, graph_b: &'a G, node_color_matching: F, ) -> SimilarityMatrix<'a, F, G, E, N>

Source

pub fn next(&mut self)

Calculates the next iteration of the similarity matrix (x[k+1]).

Source

pub fn iterate(&mut self, stop_after_iter: usize, eps: f32)

Iteratively calculate the similarity matrix.

stop_after_iter: Stop after iteration (Calculate x(stop_after_iter)) eps: When to stop the iteration

Source

pub fn matrix(&self) -> &Array2<f32>

Source

pub fn num_iterations(&self) -> usize

Source

pub fn min_nodes(&self) -> usize

Source

pub fn max_nodes(&self) -> usize

Source

pub fn optimal_node_assignment(&self) -> Vec<Position>

Source

pub fn score_outgoing_edge_weights_sum_norm( &self, node_assignment: &[Position], norm: ScoreNorm, ) -> Closed01<f32>

Calculate a measure how good the edge weights match up.

We start by calculating the optimal node assignment between nodes of graph A and graph B, then compare all outgoing edges of similar-assigned nodes by again using an assignment between the edge-weight differences of all edge pairs.

Source

pub fn score_optimal_sum_norm( &self, node_assignment: Option<&[Position]>, norm: ScoreNorm, ) -> Closed01<f32>

Sums the optimal assignment of the node similarities and normalizes (divides) by the min/max degree of both graphs. ScoreNorm::MinDegree is used as default in the paper.

Source

pub fn score_average(&self) -> Closed01<f32>

Calculates the average over the whole node similarity matrix. This is faster, as no assignment has to be found. “Graphs with greater number of automorphisms would be considered to be more self-similar than graphs without automorphisms.”

Trait Implementations§

Source§

impl<'a, F, G, E, N> Debug for SimilarityMatrix<'a, F, G, E, N>
where F: NodeColorMatching<N> + Debug, G: Graph<EDGE = E, NODE = N> + 'a + Debug, E: Edges + Debug, N: Clone + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, F, G, E, N> Freeze for SimilarityMatrix<'a, F, G, E, N>
where F: Freeze,

§

impl<'a, F, G, E, N> RefUnwindSafe for SimilarityMatrix<'a, F, G, E, N>

§

impl<'a, F, G, E, N> Send for SimilarityMatrix<'a, F, G, E, N>
where F: Send, G: Sync,

§

impl<'a, F, G, E, N> Sync for SimilarityMatrix<'a, F, G, E, N>
where F: Sync, G: Sync,

§

impl<'a, F, G, E, N> Unpin for SimilarityMatrix<'a, F, G, E, N>
where F: Unpin,

§

impl<'a, F, G, E, N> UnwindSafe for SimilarityMatrix<'a, F, G, E, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.