I am using networkx to build graphs for a project.For a specific plot I need max depth (or nesting depth) of each node (something like this).
For eg.
I have multiple nodes in my graph, say-
G -> d, foo, bar, tar, zar, car, char, jar, par, radar, far, ....
where d
is connected with others like this,
d -> {'foo': {'bar': {'tar': 2}, 'zar': {'car': {'char': 1}, 'jar': 'par'}}, 'radar': 'far'}
I want max depth (or connectivity) of nodes.
So, in this case -
d->foo->zar->car->char
(5 nodes in total)
Is there any way to calculate this using networkx (I have over 1M nodes, so the data is huge!)?
I checked their manual here.
Also checked different posts online but couldn't find the information.