Proposal: delay graph generation for skeletons #132
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
classify_nodes
function is called atTreeNeuron
initialisation. In master, this function uses the igraph (or networkx) representation of the neuron. Generating the graph for a skeleton comes at a sizeable overhead but it will be cached for future use.This PR re-implements the
classify_nodes
function using pure pandas. It's overall as fast as the current graph-based function minus the overhead for the construction of the graph. In my hands this speeds up import of skeletons by 5-6X.Many workflows (e.g. making dotprops from skeletons) do not need the graph representation, so being able to skip it is advantageous. For workflows that do need the graph, we simply delay its generation but shouldn't loose performance.
Thoughts @clbarnes?