[Bioc-devel] efficient use of edgeData (graph)
Hi Nishant,
Thank you!
I misconstrued the arguments. Seeing that 'from' and 'to' were obligatory arguments, I assumed there was no way to attain the moral equivalent of
edgeData (graph, attr='some attribute')
Based on your reply, and a quick look at showMethods ('edgeData') I see that the 'from' and 'to' arguments default to 'missing', giving me exactly what I want, with a startling increase in speed on my 9000-edge graph.
Perfect.
- Paul
On Nov 10, 2010, at 11:20 AM, Nishant Gopalakrishnan wrote:
Hi Paul, Why not directly use the edgeData function with the attribute name you want instead of having to retrieve the edgeData for all the attributes and then subsetting. ie edgeData(graph, from , to , attr = edge.attribute.name) Nishant On 11/10/2010 07:01 AM, Paul Shannon wrote:
In the RCytoscape package I have a convenience function which returns the values of a specified edge attribute, for all edges in the graph. It is ponderously slow on a graph of 9000 edges.
I define it this way:
function (graph, edge.attribute.name) {
unlist (sapply (names (edgeData (graph)), function (n) edgeData (graph)[[n]][[edge.attribute.name]]))
}
Can anyone suggest ways to speed this up? I fear I am missing something obvious.
Thanks!
- Paul
_______________________________________________ Bioc-devel at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel