How do you best traverse a forking polyline graph (a tree)?
As I understand, VEX does not support recursion, and in Python there's no easy way to get connectivity information!
EDIT:
I tried promoting the neighbors to an point attribute array via vex. But now it turns out that python (hou) can't read point attribute arrays?
Traversing Graph
2166 4 0- aeaeaeae
- Member
- 126 posts
- Joined: Aug. 2010
- Offline
- Enivob
- Member
- 2540 posts
- Joined: June 2008
- Offline
- edward
- Member
- 7730 posts
- Joined: July 2005
- Offline
As far as I recall, reading array attributes from python should just work using the usual methods to read attribute values.
Having said that, I would consider doing it all in VEX. You can put the Attribute Wrangle in Detail mode and then loop to your hearts content. Recursion is not necessary for graph traversals, there are plenty of ways to do things iteratively using array variables as stacks.
Having said that, I would consider doing it all in VEX. You can put the Attribute Wrangle in Detail mode and then loop to your hearts content. Recursion is not necessary for graph traversals, there are plenty of ways to do things iteratively using array variables as stacks.
- aeaeaeae
- Member
- 126 posts
- Joined: Aug. 2010
- Offline
thanks guys.
@Enivob: Connectivity in terms of SOP geometry. For example There's no direct way via python to find the connected neighbors of a point, although, as a work around you can store them an point attribute array via VEX first, and read that.
@edward: right, VEX and non-recursion algorithms are probably the best, I'll try out some of these [stackoverflow.com]
@Enivob: Connectivity in terms of SOP geometry. For example There's no direct way via python to find the connected neighbors of a point, although, as a work around you can store them an point attribute array via VEX first, and read that.
@edward: right, VEX and non-recursion algorithms are probably the best, I'll try out some of these [stackoverflow.com]
Edited by aeaeaeae - March 28, 2017 07:51:20
- edward
- Member
- 7730 posts
- Joined: July 2005
- Offline
smuseus
I'll try out some of these [stackoverflow.com]
Ack, from the best answer on that stack overflow link, do NOT do take_first()/prepend() (in any language). Just use the VEX pop()/push() functions, which do “remove last” and “append to end” respectively.
Edited by edward - March 29, 2017 00:35:19
-
- Quick Links