Vertex Class field question

0 views
Skip to first unread message

Han Gao

unread,
May 7, 2011, 7:50:31 PM5/7/11
to cs2110-sp11
Hi in my Vertex class, I have a linkedList field for the
implementation of ajacency list. The problem with that is
in my ajacency matrix implementation, this field is completely
useless. I wonder if that's okay or the linkedLists should
be implemented in the AdjListGraph instead (maybe gets associated with
the vertex by a hashmap or so )? Thanks.

Robert Escriva

unread,
May 7, 2011, 9:05:19 PM5/7/11
to cornell-c...@googlegroups.com

You may want to rethink how you are sharing classes between the
implementations. The approach you describe is rather inelegant. Do you
need a vertex class for both impls? If so, does it need to be the same?
If not, why force yourself to use it?

-Robert

Reply all
Reply to author
Forward
0 new messages