Re: CFTree usability?
Re: CFTree usability?
- Subject: Re: CFTree usability?
- From: Tim Ramsey <email@hidden>
- Date: Wed, 29 Oct 2003 22:11:53 -0600
On 29 Oct, 2003, at 9:29 AM, Tim Ramsey wrote:
I am interested in writing some code to implement graph theory
functions. To do so I need to attach info to edges as well as to
nodes. On the surface CFTree seems to offer some attractive
functions. Looking at the docs for CFTree, I see provisions for
attaching info to nodes, but none for edges. Am I missing
something? Is there some other way to get an equivalent
functionality via CFTree? Is there a better route than CFTree -
some NS class I haven't found? Am I better off to bite the bullet
and roll my own?
Dustin Voss replied:
You may have bigger problems with CFTree than the storage of edge
data, depending on the types of graphs you intend to work with.
CFTree can't be used with general graphs. It only allows one parent
with multiple children, and does not allow cycles.
If that is not a problem for you, you have not missed anything in
saying that CFTree doesn't seem to support information attached to
edges. However, I can think of a few ways to hack in support. You
could define the structure to look like this:
NODE --- LINK --- NODE
\-- LINK --- NODE
So that all data nodes' children are edge-information nodes, and the
children of those are again data nodes. That is, the graph has
interstitial edge-information nodes.
Another method would be to have data nodes only, but append edge
data to the nodes.
Appending edge data to the nodes wouldn't work for the structures I
have in mind. I had thought about the hack of alternating edge and
data nodes, but haven't concluded whether or not that will work for
my case. Anyway, I need to handle cycles sometimes, so I guess CFTree
is out.
I have also looked at the DragNDropOutlineView example, but those
methods have other limitations I can't live with. Unless someone has
a better idea, I will have to plan on rolling my own.
Thanks for the insights.
--
Tim
"They couldn't hit an elephant from this distance" (last words of
Gen. John Sedgwick, Spotsylvania 1864)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.