I have read a lot about MVC design pattern, but some of the things are still unclear to me. I know that "Model" is for data and business logic, "View" is for presentation and "Controller" is for using "Models" and providing "Views" (i.e. C is the communication channel between M and V).
Now, I have the following problem I want to solve:
Problem: The web application takes as input, a list of Nodes from a user. Then, a Model is used to make a Graph (i.e. Data Structure Graph and not x-y graph) out of those nodes (using a database).
I then use Dijkstra's algorithm to find out the shortest path from a starting node to an ending node in that graph. Do I use the Dijkstra's algorithm in the Model or the Controller?
I think I should use the Model layer because the "shortest path" itself is data.
But sometimes, I think I should put it in the Controller because it uses the Models (Graph and List of nodes) to do something.
Can anyone give me the right answer? For now I am going to implement Dijkstra's algorithm in the model layer.