Le 07/07/2014 10:51, Tobias Boege a écrit : > > We keep these generalisations and advanced topics in mind but for now, one > point I can and want readily apply is: in your opinion, it would be better > to address vertices by Strings, in a human-readable form, not just integers, > right? I'm still torn. > > I will make the Graph act like a Collection, i.e. once you have associated a > value to an ID, that ID is not changed by other operations on the Graph. You > had a point there; everything else hardly bearable for the programmer. > However, I want to use Integers as IDs because they are easier to store and > sort and abstract enough for the job. > > If you want to associate more human-readable names with your vertices, I > think you can easily achieve it by having a Collection asscoaite your names > with the numerical IDs. In fact that's what I'd do in the Graph internals if > I was to offer String IDs. > > Regards, > Tobi >
Internally, you have to use an hash table anyway, haven't you? You just don't want to necessarily use string keys, as they are heavier than integer keys? Anyway, you must use a Collection-like interface to access the graph nodes (to be consistent with the other Gambas containers). You can use integer keys with no problems, as later you can switch to string keys and keep the backward-compatibility. You can have both too : I mean having a Gambas hash table to reference nodes by names, and a special hash table using integer keys. A void hash table does not take a lot of memory. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
