Grasshopper

algorithmic modeling for Rhino

Hallo David and everyone 

I was wondering what would be the best way to access a Branch of a Datatree with a very high Path i.e. {6433,11943}. 

Not all leaves of the Datatree exist. So i.e. {0,1} wouldn't exist.

I need this in order to store information also in the Datatree structure and not only in the leaves. the problem is it now takes 1.2 minutes to what before took only 18 seconds. 

Thx Richard

Views: 301

Replies to This Discussion

What took 18 seconds before? I merely ask because 18 seconds is a very long time.

You can get a list of the existing paths using the Paths property, or you can get the GH_Path at index i, so you could iterate over all existing paths from 0 to BranchCount-1

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hallo David,

This was just a Callculation from 25 points of a street network to all other points (120.000) in the street network -> Spiderweb...

Hmm, do know how to get the path's, the question is what is the access time of a Branch in O(n) ..., does it matter if the path to the branch is {6433,11943} and there is no path {0 - 6432,*} or {0,1} or {1}...

thx

Richard

Paths and Branches are stored in a SortedDictionary, so lookup of paths is O(log n). It does not matter if paths are missing, dictionaries have no conception of a continuous set of keys.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thx that was helpfule in understanding

So just to get that right:

If I would use a list(of List(of Integer)) the access time would be O(1) + O (1) leaving me with O(1) instead of O(log n) -> which would be faster... 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service