igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] how to pick a node with a probability proportional to its degre


From: Simone Gabbriellini
Subject: [igraph] how to pick a node with a probability proportional to its degree
Date: Fri, 11 Apr 2014 15:28:45 +0200

Dear List,

I am trying to pick up a vertex with a probability proportional to its
degree. I know that I can do:

degs <- degree(g)
sample(unique(degs), 1, replace=TRUE, prob = unique(degs))

to pick a degree with a probability proportional to its value, but how
then to retrieve the corresponding vertex (or one of the ones with
that degree value)?

Best,
Simone

-- 
-----------------------------------------------------------------

Simone Gabbriellini, PhD

Post-doctoral Researcher
ANR founded research project "DIFFCERAM"
GEMASS, CNRS & Paris-Sorbonne.

mobile: +39 340 39 75 626
email: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]