Skip to content
Prev 303461 / 398503 Next

per-vertex statistics of edge weights

On Wed, Aug 15, 2012 at 2:04 PM, Sam Steingold <sds at gnu.org> wrote:
For me this gives

Error in mean(E(g)[inc(v)]$weight) :
  error in evaluating the argument 'x' in selecting a method for
function 'mean': Error in match(x, table, nomatch = 0L) : object 'g'
not found

which is no wonder, since 'g' is not defined.
I am not sure what TRT is, but I would do this as

sapply(V(graph), function(v) mean(E(graph)$weight[incident(graph, v)]))

Your solution is somewhat messy, because vertices$vertex is actually a
factor, etc.

Gabor

[...]