R/permEdgesM2M.R

Defines functions permEdgesM2M

Documented in permEdgesM2M

#function to permute the edges of a graph
#takes an adjacency matrix called mat

permEdgesM2M<-function(mat){

	numE<-sum(mat)/2
	uniqE<-which(lower.tri(mat)==TRUE)
	newE<-sample(uniqE,numE,replace=FALSE)
	newmat<-matrix(0,dim(mat)[1],dim(mat)[2])
	newmat[newE]<-1
	newmat<-newmat+t(newmat)
	return(newmat)
}

Try the GraphAT package in your browser

Any scripts or data that you put into this service are public.

GraphAT documentation built on Nov. 8, 2020, 5:01 p.m.