Re: Creating Tree Structure from associative array

From: Date: Thu, 19 Oct 2006 17:08:29 +0000
Subject: Re: Creating Tree Structure from associative array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-243348@lists.php.net to get a copy of this message
# angelo@zlogic.co.za / 2006-10-19 16:08:58 +0200: > Hi all, > > I have an associative array, which contains parent and child > relationships. I've searched the web for creating a tree structure from > this and found a few good sites but doesnt help 100% perhaps someone can > point me in the correct direction? I've started to code it got to a > point where I cant go any further, the code is pseudo code and dont want > to reinvent the wheel. > > any suggestions would be really appreciated. I don't think there's any graph-manipulation library for PHP (there's a bit of addEdge(), addNode() stuff in Image_GraphViz[1] but it doesn't seem useful). Until someone wraps Agraph or Boost.Graph in a module: check out Iterator, Builder, and Composite in Design Patterns[2]. [1] http://pear.php.net/package/Image_GraphViz [2] http://www.amazon.com/dp/0201633612 -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

« previous php.general (#243348) next »