Use this if you are using igraph from R
Given two adjacency matrices A
and B
of the same size, match
the two graphs with the help of m
seed vertex pairs which correspond
to the first m
rows (and columns) of the adjacency matrices.
match_vertices(A, B, m, start, iteration)
A |
a numeric matrix, the adjacency matrix of the first graph |
B |
a numeric matrix, the adjacency matrix of the second graph |
m |
The number of seeds. The first |
start |
a numeric matrix, the permutation matrix estimate is
initialized with |
iteration |
The number of iterations for the Frank-Wolfe algorithm |
The approximate graph matching problem is to find a bijection between the vertices of two graphs , such that the number of edge disagreements between the corresponding vertex pairs is minimized. For seeded graph matching, part of the bijection that consist of known correspondences (the seeds) is known and the problem task is to complete the bijection by estimating the permutation matrix that permutes the rows and columns of the adjacency matrix of the second graph.
It is assumed that for the two supplied adjacency matrices A
and
B
, both of size n*n, the first m rows(and
columns) of A
and B
correspond to the same vertices in both
graphs. That is, the n*n permutation matrix that defines
the bijection is I_{m} \bigoplus P for a (n-m)*(n-m) permutation matrix P and m times m
identity matrix I_{m}. The function match_vertices
estimates
the permutation matrix P via an optimization algorithm based on the
Frank-Wolfe algorithm.
See references for further details.
A numeric matrix which is the permutation matrix that determines the
bijection between the graphs of A
and B
Vince Lyzinski http://www.ams.jhu.edu/~lyzinski/
Vogelstein, J. T., Conroy, J. M., Podrazik, L. J., Kratzer, S. G., Harley, E. T., Fishkind, D. E.,Vogelstein, R. J., Priebe, C. E. (2011). Fast Approximate Quadratic Programming for Large (Brain) Graph Matching. Online: https://arxiv.org/abs/1112.5507
Fishkind, D. E., Adali, S., Priebe, C. E. (2012). Seeded Graph Matching Online: https://arxiv.org/abs/1209.0367
sample_correlated_gnp
,sample_correlated_gnp_pair
#require(Matrix) g1 <- erdos.renyi.game(10, .1) randperm <- c(1:3, 3+sample(7)) g2 <- sample_correlated_gnp(g1, corr=1, p=g1$p, perm=randperm) A <- as.matrix(get.adjacency(g1)) B <- as.matrix(get.adjacency(g2)) P <-match_vertices (A, B, m=3, start=diag(rep(1, nrow(A)-3)), 20) P