I am doing a structural covariance analysis with 2 groups, using Destrieux Atlas, and the density is set as 5:5:50.
But in the results under some values of density, the values of Char. path length is NaN. So, How can I handle this?
I have seen the response for NaN in small worldness, but I can’t find the way to handle the same question for Char. path length.
Since you are doing binary analysis, there is a good possibility that you encounter this issue due to the fact that some nodes are disconnected from the network at those densities. Currently in Braph the characteristic path length is calculated as a mean over the nodal path lengths of all nodes. This averaging assumes a connected networks, and will return NaN for the networks that have disconnected nodes.
One way is to calculate characteristic path length within connected subgraphs (also available in Braph). Alternatively, you could employ a different averaging procedure that would take into account the disconnected nodes; taking a harmonic mean of the nodal measures is a possible option.
If you would like to change the code in Braph, for binary undirected graphs, the characteristic path length is calculated on the lines 463/464 in GraphBU.m file. You could use any definition of the path length on line 464 and the code would work accordingly. Otherwise, please let me know if you need help and I can help you with any modification of the code you might need.