- From: Yoann Pigné <yoann.pigne AT gmail.com>
- To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, Cherie Pun <cherie.cy.pun AT gmail.com>
- Subject: Re: Small world analysis
- Date: Sat, 11 Jun 2016 02:15:09 +0200
Hi,
Yes, you can compute the average path length using a Breadth-First Search
Iterator on each node, and get the path length from that node to all the
others.
Something like that:
double pathLength=0;
for (Node node : graph ) {
BreadthFirstIterator<Node> k = new BreadthFirstIterator<>(node,
false);
while (k.hasNext()) {
k.next();
}
for (Node n : g) {
if (n != node) {
int depth = k.getDepthOf(n);
if (depth >0) {
pathLength += depth;
}
}
}
pathLength /= (graph.getNodeCount() - (graph.getNodeCount()-1));
Yoann
>
On Jun 10, 2016, at 6:56 PM, Cherie Pun
>
<cherie.cy.pun AT gmail.com>
>
wrote:
>
>
Hi,
>
>
I am trying to find out whether my network in neo4j is a small world
>
network or not, but unfortunately I cannot find how I can measure cluster
>
coefficient and mean average path in neo4j. I googled and found that
>
graphstream has a function for averageClusteringCoefficient which is great!
>
But i couldnt find if graphstream can calculate mean path length or not.
>
Could someone please kindly advise? Or if you know there are other ways for
>
me to do it, please also advise. Thank you very much!
>
>
Kind regards,
>
Cherie
Archives gérées par MHonArc 2.6.16.