Home › Forums › Bugs – Closed › NaN in small worldness
 This topic has 5 replies, 1 voice, and was last updated 1 year, 3 months ago by Mite Mijalkov.

AuthorPosts

March 13, 2019 at 7:48 pm #26066Allison ChenGuest
Hi,
I am using the braph to calculate the smallworldness. when the density<40, the small worldness is NaN. I guess when we get a disconnected node, the path length goes to infinity (this is intuitive I think). We may need to use the harmonic mean to avoid this. Could you please revise the source code to avoid this? Besides, when comparing the nodal measures for two groups, the pvalues for different measures are different, but the fdr are always the same. Why does this happen? Thanks!
Allison
March 26, 2019 at 8:14 am #26326Mite MijalkovKeymasterHi Allison,
Thank you for using Braph. I hope that you will find it useful during the course of your research.
Regarding the pvalues for between group comparison: The fdr column represents the highest pvalue that is significant after fdr correction. This value is calculated at a given density, among the multiple comparisons performed between all regions. That is why, when the region changes, the fdr value stays the same. However, since the multiple comparisons are different for each region, the associated uncorrected pvalue changes. We discussed this issue previously on this forum and you can find more detailed explanations at: http://braph.org/forums/topic/confidenceintervalsandpstatistic/ and http://braph.org/forums/topic/eeggraphanalysis/ .
Regarding the small worldness calculation, you are right. This situation happens when the network is unconnected. Practically, this results in NaN for the path length of the disconnected nodes which then affects the calculation of the mean. To help you with this, could you let me know what type of analysis you are running (weighted or binary undirected (or directed from the command line) so that I can send you a list of changes that need to be done in order to get the harmonic mean.
Hope these explanations help. If you need any additional help, please do not hesitate to ask.
Best,
Mite This reply was modified 1 year, 7 months ago by Mite Mijalkov.
July 8, 2019 at 11:05 am #30214Hojoon leeGuestHi.
We have a same issue regarding NaN in graph measure generation.
We are using bud analysis.
Can you share the required steps for harmonic mean implementation?
Thanks in advance.Best wishes
Hojoon LeeJuly 8, 2019 at 11:54 am #30218Kyoo Ho ChoGuestHello
I am doing a MRI (Structural covariance) cohort analysis.
for 2 groups.(Normal and patient)
During graph measure generation, other
normal control has full Global and nodal features (graphs)
But paitient group has NO “char.path.length (NOT wihtin subgroups)” and “small worldness”
Each above two parameter with (within subgroups) is present. But I never did ‘subgroup’ analysis
(I attach the screenshot)
P.S calculation duration at each density takes about 6 hours. Is there any way to speed it up?Thank you very much
ChoJuly 16, 2019 at 3:17 pm #30814Mite MijalkovKeymasterDear Hojoon Lee,
Thanks for using Braph and I hope that it proves to be a valuable tool in your research.
If you would like to implement harmonic mean implementation of the path length calculation, you would need to change the file GraphBU.m. Locate the method “measure” in the GraphBU.m file. Line 459 just calculates the mean of the path length of each node (in the original code). In order to implement the harmonic mean, just substitute line 459, with the following:
tmp = g.pl();
res = mean(tmp.^(1)).^(1);which is the expression for the harmonic mean.
Hope this works. If there is anything more I can help you with, please let me know.
Best,
MiteJuly 16, 2019 at 3:29 pm #30816Mite MijalkovKeymasterHi Cho,
Thank you for using Braph.
The issue with small worldness (and characteristic path length) is that they cannot be calculated (especially for small densities) due to the disconnections of some nodes in the graph. This is due to their current implementation, in which first the nodal path lengths for each node are calculated and then they are averaged out in order to calculate the characteristic path length. Therefore, if any disconnected nodes exist in the graph, the nodal path length will return NaN and the characteristic path length cannot be calculated.
As an alternative, you might want to calculate them only within connected subgraphs, where there are no disconnected nodes. If you calculate the small worldness from the command line, you can specify a second argument (“wsg”) as a function input, which ,if set to true, will calculate the small worldness within the connected component of the network. You can find the codes for this on line 1427 in the file Graph.m (for calculating the small worldness) and on line 460 in GraphBU.m (within the method “measure”) for the differences of calculating the path length only within the connected components. Currently, the default value of this argument is set to false. If you would like to change this so that the small worldness is always calculated within the connected components you can do so by changing line 1439 of Graph.m file.
Another alternative method is to implement the harmonic mean as I explained above.
I realize that the calculation of the smallworldness takes a lot of time. This is due to the fact that in order to calculate the smallworldness the network needs to be randomized many times, and currently, the randomization algorithm implemented in Braph is very slow. We hope that we can implement faster alternative methods in Braph soon.
Hope this helps you. Please do not hesitate to ask if you would need any more help.
Best,
Mite 
AuthorPosts
 The forum ‘Bugs – Closed’ is closed to new topics and replies.