How to get Average and Maximum Edge Weight.

Computing metrics, community detection and data handling
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
thecoolboy
Posts:51
Joined:12 Oct 2011 23:01
Location:Arkansas,USA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
How to get Average and Maximum Edge Weight.

Post by thecoolboy » 20 Sep 2012 17:56

I need to get the average edge weight of the graph. Also, I need the maximum edge weight of the graph. I would be glad if anyone could help me with that.

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to get Average and Maximum Edge Weight.

Post by admin » 20 Sep 2012 18:50

Data Laboratory > Edge Table > click on the weight column to sort.

To get the average, you need to export this table as a spreadsheet, and use another tool to compute it.

thecoolboy
Posts:51
Joined:12 Oct 2011 23:01
Location:Arkansas,USA
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to get Average and Maximum Edge Weight.

Post by thecoolboy » 20 Sep 2012 23:12

This is nice answer. However, what I need to do is to get those in run time. In other words, I need to know how to get them in source code.

I have the variable hgraph and for example I can get the number of the edges in the graph by using hgraph.getEdgeCount(). But as you know, I am trying to get the average and maximum values of the edge weights programmatically and I don't know how to do it.

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: How to get Average and Maximum Edge Weight.

Post by admin » 21 Sep 2012 07:39

So you need to iterate over each edge with:

Code: Select all

for (Edge e : graph.getEdges()) {
  ... e.getWeight();
}

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable