[BioC] ftM2graphNEL unexpected error

Seth Falcon sfalcon at fhcrc.org
Wed Feb 7 00:28:43 CET 2007


Hi Dan,

"Dan Bebber" <danbebber at forestecology.co.uk> writes:
> I have a set of 429 links (matrix ft with 'from' and 'to' nodes), a set of
> 281 nodes n, and a set of 429 link weights w.
> I wish to create graphs using subsets of the links. Sometimes this works,
> sometimes not (see below). Essentially, if too few links are included then
> the graphNEL object is not created.
> If anyone would like the data, I can email them directly.
>
> Any help greatly appreciated.

You are asking ftM2graphNEL to create undirected graphs.  In the graph
package, undirected graphs store reciprocal edges.  So in the internal
data format, if there is an edge from A to B, there will also be an
edge from B to A.

Now the documentation states:

     The same edge must not occur twice in the 'from/to' matrix. If
     'edgemode' is 'undirected', the edge '(u,v)' and '(v,u)' must
     only be specified once.

And it seems that this is broken.  As you've demonstrated, if you
don't specify the reciprocal edges, an error is raised.  I'll look
into fixing ftM2graphNEL.

In the meantime, I wonder if the following will get you going:

## create a directed version first
g <- ftM2graphNEL(ft[1:50, ], V=n, W=w[1:50], edgemode="directed")

## transform that to undirected
g <- ugraph(g)

You will want to verify that the edge weights are properly transfered.

+ seth



More information about the Bioconductor mailing list