# Matching 2 undirected weighted graph in matlab

Consider 2 undirected weighted graph as shown in figure.Consider first graph as G1 and second graph as G2.Graph G1 consist of vertices V={F1,F2,F3,F4,F5} and Graph G2 consist of vertices V={N1,N2,N3,N4,N5}. According to logic of my project we have to match vertices of 2 graphs as shown below.

F1=N2
F2=N5
F3=N4
F4=N3
F5=N1


These matching values are calculated manually by seeing values of diagonal elements of 2 adjacency matrices given below.

Adjacency matrix for 2 graphs are shown below.

     F1     F2    F3    F4    F5
F1   3     4     3     1     4
F2   3     5     3     1     4
F3   4     3     3     1     4
F4   3     2     3     1     4
F5   3     4     3     1     5

N1    N2    N3    N4    N5
N1   4     3     2     1     4
N2   4     3     3     1     2
N3   4     3     2     1     2
N4   4     3     2     1     1
N5   4     3     2     1     5


How it can be done in matlab?

• Are you guaranteed to have unique values on the diagonal? – Aaron May 13 '14 at 17:00
• @Aaron Ya diagonal elements are always unique in my case. – prash2 May 14 '14 at 4:14