Skip to content

Commit

Permalink
speed up as.seglist.igraph
Browse files Browse the repository at this point in the history
* picked up when working on #424 with Sri as was taking a big part of the time in stitch_neurons_mst
* closes #425
* it is *way* faster to operate on a base list object
  and then turn it into a seglist when done.
  • Loading branch information
jefferis committed Jan 30, 2020
1 parent 709bb52 commit a4ed90f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/seglist.R
Expand Up @@ -130,7 +130,7 @@ as.seglist.igraph<-function(x, origin=NULL, Verbose=FALSE, ...){
# _original_ vertex ids specified by "vid" attribute of input graph
curseg=vids[orders[1]]
if(length(ncount)==1) stop("Unexpected singleton point found!")
sl=seglist()
sl=list()
# we have more than 1 point in graph and some work to do!
fathers=as.integer(dfs$father)
for(i in seq.int(from=2,to=length(dfs$order))){
Expand All @@ -148,7 +148,9 @@ as.seglist.igraph<-function(x, origin=NULL, Verbose=FALSE, ...){
curseg=integer(0)
}
}
sl
# nb it is *way* faster to operate on a base list object
# and then turn it into a seglist when done.
as.seglist(sl)
}

#' Recalculate Neurons's SWCData using SegList and point information
Expand Down

0 comments on commit a4ed90f

Please sign in to comment.