a non-recursive way to determine the branch order

The basics of how to develop, test, and use models.
Post Reply
stelescu

a non-recursive way to determine the branch order

Post by stelescu »

I suggest a non-recursive way to determine the brach order of a dendrite tree. This function will check if the parent section is a branch point or not. Finally the function return the order of the actual section. The code of this function is:

Code: Select all


func branchpoint() {local branch localobj sr 

branch=0 


sr = new SectionRef() 


while (sr.has_parent){ 
if (sr.nchild==2) { 
branch=branch+1 
} 
access sr.parent 
sr = new SectionRef() 
} 

return branch 
} 


Example: To determine the branch order of section [130] you can access the function in this way:

Code: Select all

access dend[130] 
print branchpoint()
ted
Site Admin
Posts: 6395
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

1. The func will return a nonsense value, not branch order.
2. Although it is true that the func does not recursively call itself, all you have done is to
push recursion inside the func--into the while statement.
3. The code is a example of "access abuse" (please read
Use only one "access" statement
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=608).
The way to avoid this is to use the
secname statement
syntax.
Post Reply