I created a graph (igraph) from interview data. I would like to compare the sub-graphs of each interview to have a relative distance from each one. I found that I could use Hamming's distance. There are a lot of packages that offer functions to calculate distance. But I can't figure out how to calculate the distance between each sub-graph.
As an exemple :
library(igraph)
g1 <- graph_from_literal(1-2-3-4-1, 2-5-4, 1-5)
V(g1)$interview <- 1
g2 <- graph_from_literal(6-7-9,8-4-2-10,1-10-9)
V(g2)$interview <- 2
big.g <- g1 + g2
set.seed(1234)
plot(big.g)
I would like to know how far g1
(from interview 1) is to g2
. A kind of similarity or dissimilarity index. The Hamming distances seems to be a way but I don't know how to deal with ...
I have find a solution from here