graph/graphNEL: edge properties from edge name
0
0
Entering edit mode
@gustavo-lacerda-3916
Last seen 9.6 years ago
hi, I would like to easily query the weight (or label) of an edge given its name. e.g. suppose I have a graph 'g' whose nodes are labeled A1, A2, ... I want to do something like: getEdge(g, "A1~A3")$weight Any suggestions? The best I can do at the moment is the code below, but I don't find it very elegant that I need to do [[1]], and I don't like to reinvent the wheel. Is there a standard function I can use? Gustavo parseTilde <- function(s) unlist(strsplit(s,"~")) getEdgeWeight <- function(g, edgeName){ nodePair <- parseTilde(edgeName) edgeData(g, from=nodePair[1], to=nodePair[2])[[1]]$weight }
graph graph • 667 views
ADD COMMENT

Login before adding your answer.

Traffic: 725 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