Streets and Intersections Data Structure
I am writing a program that is supposed to emulate a city, and one of the
problems I am running into is how to store a large amount of
interconnected data. For instance, each Street has a direction enumeration
(NORTH_ONE_WAY, EAST_WEST, etc.) and other attributes. The most important
attribute is that each street has a list of intersections (a map of the
street that it intersects with along with the block number at which it
intersects). From this data structure, I should be able to parse it and
create a visualization (that comes later and is not part of this
question).
The question is: what is the best type of data structure to use for this?
Obviously a relational database would be a good choice, but if I am
writing in C++ (not a constraint for this question, but C++ implementation
would be a plus), should I be using that? What other data structures may
work for this?
No comments:
Post a Comment