Kevin,

i don't whether there is direct support for this, in the development version
of the 'igraph' package there is a function to convert a graphNEL
object to an 'igraph' graph, and then it can be converted to an adjacency
matrix. Here is that function:

igraph.from.graphNEL <- function(graphNEL) {

  require(graph)

  if (!is(graphNEL, "graphNEL")) {
    stop("Not a graphNEL graph")
  }

  al <- lapply(edgeL(graphNEL), "[[", "edges")
  al <- lapply(al, function(x) x-1)
  g <- graph.adjlist(al, directed= edgemode(graphNEL)=="directed")
  V(g)$name <- nodes(graphNEL)
  g
}

and then call 'get.adjacency' on the result. The function is not complete,
because it drops attributes, except for node names.

Gabor

On Thu, Apr 24, 2008 at 3:11 PM, Zembower, Kevin <kzembowe@jhuccp.org>
wrote:

> I'm interested in converting the graphNEL objects in the package SNAData
> into adjacency matrices, so that I can convert them into 'network'
> objects and use the R package 'sna' to analyze them. I'm working through
> the examples in Wasserman and Faust, Social Network Analysis, and these
> datasets will save me considerable typing.
>
> I think that this is possible because of references to the 'coerce'
> method on the graphNEL-class and graphAM-class help pages, but I haven't
> been successful. I've tried commands like:
> coerce(friendship, fs-mat)
> coerce(friendship, fsmat)
> as.matrix(friendship)
> as.graphAM(friendship)
> coerce(from="friendship", to="fsmat")
>
> Can anyone give me an example of converting a graphNEL object to a
> regular matrix, such as an adjacency matrix? I think with just one
> example, I could work things out.
>
> Thanks for your advice and suggestions.
>
> -Kevin
>
> Kevin Zembower
> Internet Services Group manager
> Center for Communication Programs
> Bloomberg School of Public Health
> Johns Hopkins University
> 111 Market Place, Suite 310
> Baltimore, Maryland  21202
> 410-659-6139
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

