Reply To: NaN in Char. path length

Home Forums Software Bugs (Braph 1.0) NaN in Char. path length Reply To: NaN in Char. path length

Mite Mijalkov


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.

Best wishes,