R/utils.R

Defines functions as.igraph.NetSimNetwork get_random_seed reset_random_seed

Documented in as.igraph.NetSimNetwork get_random_seed reset_random_seed

# TODO: Add comment
# 
# Author: cws
###############################################################################


reset_random_seed <- function(seed){
	if (seed < 0) stop("Seed must be a positive integer")
	.Call("reset_random_seed", seed, PACKAGE = "NetSim")
}

get_random_seed <- function(){
	.Call("get_random_seed", PACKAGE = "NetSim")
}

as.igraph.NetSimNetwork <- function(x, mode = c("directed", "undirected"), ...){
	if (!require(igraph))
		stop("Library igraph needs to be installed. Try 'install.packages(\"igraph\")'")
	iGraph <- igraph::graph.adjacency(as.matrix(x), mode = mode[1], diag = FALSE)
	return(iGraph)
}

Try the NetSim package in your browser

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

NetSim documentation built on May 29, 2017, 6:41 p.m.