hdist
returns the Hamming distance between the labeled graphs g1
and g2
in stack dat
for dichotomous data, or else the absolute (manhattan) distance. If normalize
is true, this distance is divided by its dichotomous theoretical maximum (conditional on |V(G)|).hdist(dat, dat2=NULL, g1=c(1:dim(dat)[1]), g2=c(1:dim(dat)[1]),
normalize=FALSE, diag=FALSE, mode="digraph")
dat
)g1
should be compared (by default, all graphs)diag
is FALSE
by default.mode
is set to "digraph" by default.structdist
, provides a natural generalization of the Hamming distance to the more general case of unlabeled graphs.Null hypothesis testing for Hamming distances is available via cugtest
, and qaptest
; graphs which minimize the Hamming distances to all members of a graph set can be found by centralgraph
. For an alternative means of comparing the similarity of graphs, consider gcor
.
Butts, C.T., and Carley, K.M. (2001). ``Multivariate Methods for Interstructural Analysis.'' CASOS working paper, Carnegie Mellon University.
Hamming, R.W. (1950). ``Error Detecting and Error Correcting Codes.'' Bell System Technical Journal, 29, 147-160.
sdmat
, structdist
#Get some random graphs
g<-rgraph(5,5,tprob=runif(5,0,1))
#Find the Hamming distances
hdist(g)
Run the code above in your browser using DataLab