best_matches: Rank best matches

View source: R/best_matches.R

best_matchesR Documentation

Rank best matches

Description

Rank vertex-pairs in order of a goodness of matching metric

Usage

best_matches(A, B, match, measure, num = NULL, true_label = NULL)

Arguments

A

A matrix, an igraph object, or a list of either. See check_graph

B

A matrix, an igraph object, or a list of either. See check_graph

match

graphMatch, eg result of call to gm

measure

One of "row_cor", "row_diff", or "row_perm_stat" or a function (see details). Measure for computing goodness of matching.

num

A positive integer or NULL. Number of pairs of best matched vertices needed. NULL indicates all matches.

true_label

the true correspondence (if available).

Details

If measure is a function, it should take exactly two matrices or igraph objects as arguments and return a vector of length equal to the number of nonseed nodes in the first object. Smaller values will be taken to indicate better matches.

Value

best_matches returns a data frame with the indices of best matched vertices in G_1 named A_best, the indices of best matched vertices in G_2 named B_best and the values of measure for best matches, where smaller values indicate better matches for all measures. If the true correspondence is available, also returns the precision of top n best matches, for each n <= num.

row_cor takes 1 minus the row correlation value for the corresponding vertex. row_diff takes the row difference value for each corresponding vertex. row_perm_stat uses the row permutation statistics value.

Examples

cgnp_pair <- sample_correlated_gnp_pair(n = 50, corr =  0.5, p =  0.5)
g1 <- cgnp_pair$graph1
g2 <- cgnp_pair$graph2
seeds <- 1:50 <= 10
match <- gm(g1, g2, seeds, method = "indefinite")

# Application: select best matched seeds from non seeds as new seeds, and do the
# graph matching iteratively to get higher matching accuracy
best_matches(A = g1, B = g2, match = match, measure = "row_perm_stat", num = 5, true_label = 1:50)



dpmcsuss/iGraphMatch documentation built on May 22, 2024, 8:52 p.m.