|
-
April 19th, 2010, 02:30 PM
#1
Graph design in Java
Hi, there!
I need to implement a general purpose graph and I've stuck with OOP design.
The graph is very general, just vertices and edges. Also I'll need to iterate through vertices and edges. Both must allow to store some info on them.
So what is the proper design of a class hierarchy in my case?
What is a better way to store information on vertices and edges: inheritance or a field?
Does it make any sense to use inner classes (hope this is a proper name) like this:
Code:
class Graph
{
public class Vertex { ... }
public class Edge { ... }
}
?
Thanks in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|