gt {sna} | R Documentation |
Transpose an Input Graph
Description
gt
returns the graph transpose of its input. For an adjacency matrix, this is the same as using t
; however, this function is also applicable to sna edgelists (which cannot be transposed in the usual fashion). Code written using gt
instead of t
is thus guaranteed to be safe for either form of input.
Usage
gt(x, return.as.edgelist = FALSE)
Arguments
x |
one or more graphs. |
return.as.edgelist |
logical; should the result be returned in sna edgelist form? |
Details
The transpose of a (di)graph, G=(V,E)
, is the graph G=(V,E')
where E'=\{(j,i): (i,j) \in E\}
. This is simply the graph formed by reversing the sense of the edges.
Value
The transposed graph(s).
Author(s)
Carter T. Butts buttsc@uci.edu
See Also
Examples
#Create a graph....
g<-rgraph(5)
g
#Transpose it
gt(g)
gt(g)==t(g) #For adjacency matrices, same as t(g)
#Now, see both versions in edgelist form
as.edgelist.sna(g)
gt(g,return.as.edgelist=TRUE)
[Package sna version 2.7-2 Index]