Description Usage Arguments Details Value Examples
is.GNARnet
returns either TRUE or FALSE according to a series of GNARnet checks. as.GNARnet
returns a GNARnet object from an input weights matrix, 'igraph' object, or a GNARnet without assigned class.
1 2 | is.GNARnet(x)
as.GNARnet(x)
|
x |
the network to be tested or object to be converted |
The is.GNARnet
function checks whether the network passes a series of tests:
Is it a list containing $edges and $dist
Are the $edges and $dist lists of the same length
Are each of the elements of $edges the same length as the corresponding $dist element
Do the edges only contain valid entries, 1,...,nnodes
Is it labelled as GNARnet
class
Are no duplicate edges present
The as.GNARnet
function converts igraph objects to GNARnet form, other possible inputs are adjacency matrices, and lists with $edges
and $dist
entries of the correct form.
is.GNARnet
returns TRUE
or FALSE
corresponding to passing the above tests.
as.GNARnet
returns a GNARnet
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #check that the example network meets the criteria above
is.GNARnet(fiveNet)
#convert to igraph and back again
as.GNARnet(GNARtoigraph(fiveNet))
#generate a new network with three nodes
#edges 1->2, 2->1, 2->3
#dist 1, 2, 1
#note 1->2 and 2->1 are of different lengths
threeEdge <- list(c(2), c(1,3), NULL)
threeDist <- list(c(1), c(2,1), NULL)
threeNet <- list(edges=threeEdge, dist=threeDist)
#check if this is a GNARnet
is.GNARnet(threeNet)
#use as.GNARnet to change the class
threeNet <- as.GNARnet(threeNet)
#check if this is a GNARnet now
is.GNARnet(threeNet)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.