l*********s 发帖数: 5409 | 1 Say, to implement a directed map of G(vertex,arcs) with adjacency lists.
Naturally, one would like to deleted all the edges associated with a given
node when trying to delete it.
Without explicit call of destructor, how to do this in Java? | g*****g 发帖数: 34805 | 2 Map.remove doesn't do it for you?
【在 l*********s 的大作中提到】 : Say, to implement a directed map of G(vertex,arcs) with adjacency lists. : Naturally, one would like to deleted all the edges associated with a given : node when trying to delete it. : Without explicit call of destructor, how to do this in Java?
| l*********s 发帖数: 5409 | 3 We are asked to implement the map and associated algorithm as exercises,
thus java's prepackaged data structures cannot be used. So your suggestion
is to manually dereference all the edges from a vertex from the Map class,
right?
【在 g*****g 的大作中提到】 : Map.remove doesn't do it for you?
| g*****g 发帖数: 34805 | 4 No, the edges are a list for value, the vertex is the key, remove the key
and
it's all done. If you have to implement map, then implement one.
【在 l*********s 的大作中提到】 : We are asked to implement the map and associated algorithm as exercises, : thus java's prepackaged data structures cannot be used. So your suggestion : is to manually dereference all the edges from a vertex from the Map class, : right?
| l*********s 发帖数: 5409 | 5 明白了,谢谢好虫!
【在 g*****g 的大作中提到】 : No, the edges are a list for value, the vertex is the key, remove the key : and : it's all done. If you have to implement map, then implement one.
|
|