f**n 发帖数: 401 | 1 Suppose we have a one-directional graph. Define a path as a sequence of
vertices such that from each of its vertices there is an edge to the next
vertex in the sequence. So a path of three vertices would be recorded
somehow as v1->v2->v3.
Now I need to store a set of paths that are different from each other. For
example, path 1 is v1->v2->v3, path 2 is v2->v3->v4, path 3 is v2->v4, and
so on so forth. I need a container to store path 1, 2, and 3. The number of
paths can be much bigger than the t | X****r 发帖数: 3557 | 2 If you only need to add and locate *full* paths in your container,
you can simply use vectors of vertices as paths and a hashtable
to store them.
of
?
give
【在 f**n 的大作中提到】 : Suppose we have a one-directional graph. Define a path as a sequence of : vertices such that from each of its vertices there is an edge to the next : vertex in the sequence. So a path of three vertices would be recorded : somehow as v1->v2->v3. : Now I need to store a set of paths that are different from each other. For : example, path 1 is v1->v2->v3, path 2 is v2->v3->v4, path 3 is v2->v4, and : so on so forth. I need a container to store path 1, 2, and 3. The number of : paths can be much bigger than the t
| f**n 发帖数: 401 | 3 Thank you. It seems doable. But I just wonder if there is any fancier
solution...
【在 X****r 的大作中提到】 : If you only need to add and locate *full* paths in your container, : you can simply use vectors of vertices as paths and a hashtable : to store them. : : of : ? : give
| X****r 发帖数: 3557 | 4 The simplest design that fits your need is the best design.
"A designer knows he has achieved perfection not when there is nothing
left to add, but when there is nothing left to take away."
- Antoine de Saint-Exupry
(quote for Engineering in Civilization IV)
【在 f**n 的大作中提到】 : Thank you. It seems doable. But I just wonder if there is any fancier : solution...
| t****t 发帖数: 6806 | 5 While i agree that "The simplest design that fits your need is the best
design", but I doubt St. Exupry has any idea about engineering. He's a
writer (and pilot), so called 文科生, no?
【在 X****r 的大作中提到】 : The simplest design that fits your need is the best design. : "A designer knows he has achieved perfection not when there is nothing : left to add, but when there is nothing left to take away." : - Antoine de Saint-Exupry : (quote for Engineering in Civilization IV)
| X****r 发帖数: 3557 | 6 He was also a pilot, both commerial and in military. So he might not
have had much idea on designing machineries but he should have been
no stranger on evaluating some of them.
Anyway, it's just a civ4 quote :)
【在 t****t 的大作中提到】 : While i agree that "The simplest design that fits your need is the best : design", but I doubt St. Exupry has any idea about engineering. He's a : writer (and pilot), so called 文科生, no?
|
|