Questions:
1. What do I want to do with the graph?
2. What is the ration of edges to nodes? (adj list or matrix?)
3. How do I need to access to nodes/edges?
4. What properties do nodes and edges need to store?
Objects that make sense, whose data and methods go together.
Interfaces are clean; private data (or data structures) are not exposed.
Easy and fast to do the operations you want to do.
Methods are short and easy to read and understand.
DFS is not short!
Solution: refactor! - restruture code without changing functionality
Each method should have one task!
还可以创建一个MazeEdge class
以及一个Coordinate class来存coordinate。
No comments:
Post a Comment