ftM2graphNEL unexpected error
3
0
Entering edit mode
Dan Bebber ▴ 50
@dan-bebber-1711
Last seen 10.3 years ago
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. Dan Bebber using R 2.4.1 and graph 2.4.0 ---------------------------------------------------------------------- -------------------------- > ftM2graphNEL(ft[1:429,], V=n, W=w[1:429], edgemode="undirected") A graphNEL graph with undirected edges Number of Nodes = 281 Number of Edges = 429 > ftM2graphNEL(ft[1:420,], V=n, W=w[1:420], edgemode="undirected") A graphNEL graph with undirected edges Number of Nodes = 281 Number of Edges = 420 > ftM2graphNEL(ft[1:220,], V=n, W=w[1:220], edgemode="undirected") The graph is undirected and the following edges are not reciprocated: 58|62, 57|62
graph graph • 1.4k views
ADD COMMENT
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 10.3 years ago
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. I will take a look and see if I can help. Can you send me (privately) the data? That would be helpful. Best, + seth
ADD COMMENT
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 10.3 years ago
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
ADD COMMENT
0
Entering edit mode
@wolfgang-huber-3550
Last seen 3 months ago
EMBL European Molecular Biology Laborat…
Dear Dan, did you read the error message? It says "The graph is undirected and the following edges are not reciprocated: 58|62, 57|62", so I assume what is going on is that your subsetted from-to table does not contain the edges in both directions. So, either you need to drop the edgemode="undirected" argument, or you need to include all edges in both directions. Note the function "ugraph" that converts a directed graph into an undirected one (by loosing the directions) Best wishes Wolfgang ------------------------------------------------------------------ Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber > 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. > > Dan Bebber > > using R 2.4.1 and graph 2.4.0 > > -------------------------------------------------------------------- ---------------------------- > >> ftM2graphNEL(ft[1:429,], V=n, W=w[1:429], edgemode="undirected") > A graphNEL graph with undirected edges > Number of Nodes = 281 > Number of Edges = 429 > >> ftM2graphNEL(ft[1:420,], V=n, W=w[1:420], edgemode="undirected") > A graphNEL graph with undirected edges > Number of Nodes = 281 > Number of Edges = 420 > >> ftM2graphNEL(ft[1:220,], V=n, W=w[1:220], edgemode="undirected") > The graph is undirected and the following edges are not reciprocated: > 58|62, 57|62 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
Dear Dan, > did you read the error message? It says "The graph is undirected and the > following edges are not reciprocated: 58|62, 57|62", so I assume what > is going on is that your subsetted from-to table does not contain the > edges in both directions. So, either you need to drop the > edgemode="undirected" argument, or you need to include all edges in both > directions. I apologize, this was wrong: as Seth as well as the man page of the function ftM2graphNEL (that I wrote quite some time ago) correctly point out, the function expects the from-to table to contain each edge only once; even though then internally in graphNEL objects of edgemode, undirected edges are then stored twice. So it seems to be a nasty interaction between the old ftM2graphNEL code and the recently revised graphNEL constructors and validity checks. Did you send the matrix "ft" to Seth? If not yet, please also cc me, so we can work out what's wrong. Best wishes Wolfgang > Note the function "ugraph" that converts a directed graph into an > undirected one (by loosing the directions) > > Best wishes > Wolfgang > > ------------------------------------------------------------------ > Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber > > >> 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. >> >> Dan Bebber >> >> using R 2.4.1 and graph 2.4.0 >> >> ------------------------------------------------------------------- ----------------------------- >> >> >>> ftM2graphNEL(ft[1:429,], V=n, W=w[1:429], edgemode="undirected") >> A graphNEL graph with undirected edges >> Number of Nodes = 281 >> Number of Edges = 429 >> >>> ftM2graphNEL(ft[1:420,], V=n, W=w[1:420], edgemode="undirected") >> A graphNEL graph with undirected edges >> Number of Nodes = 281 >> Number of Edges = 420 >> >>> ftM2graphNEL(ft[1:220,], V=n, W=w[1:220], edgemode="undirected") >> The graph is undirected and the following edges are not reciprocated: >> 58|62, 57|62 >
ADD REPLY

Login before adding your answer.

Traffic: 726 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6