开发者

What Data Structure would you use for a Curriculum of a Department in a University?

开发者 https://www.devze.com 2023-03-10 04:19 出处:网络
For my homework, I\'m implementing a course registration system for a university and I implemented a simple class for Curriculum with list of semesters and other properties like name of the department

For my homework, I'm implementing a course registration system for a university and I implemented a simple class for Curriculum with list of semesters and other properties like name of the department, total credits etc.

But I'm wondering if I can inherit this class from a Graph Data Structure with Edges and vertices.

Anybody done similar things before?

My current design is something like this:

public class Curriculum
{
    public string NameOfDepartment { get; set; }
    public List<Semester> Semesters { get; set; }

    public bool IsProgramDesigned { get; set; }

    public Curriculum()
    {
        IsProgramDesigned = false;
    }

    /开发者_StackOverflow/ 
    public string AddSemester(Semester semester)
    {


As an enterprise architect I would absolutely not use a graph structure for this data. This data is a list and nothing more.

For a problem similar to this, the only reason I would ever consider using a graph structure would be to potentially create the relationship of course requirements and prerequisites.

This way you could then use the graph algorithm to determine if it is valid for a student to register for a class by making sure it is a valid addition to the tree. Same for removing classes, it could be validated to make sure you aren't dropping a class and staying enrolled in the lab for the class example.

Now if I was going to actually implement this. I would still have an overall list of classes that have a Key to the vertex in the graph representation. One thing to keep in mind is that graph algorithms are about the biggest heavy hitter you can throw at a database so minimize the amount of work done to pull the graph out is always key. Depending on the size and scope, I would also evaluate if I could store entire graphs in a serialized form or to use a document database for the same reason.

Which in this example would be the most likely route I would take. I would store the entire object of prerequisites co-requisites and so on right inline with my course object. Since the graph is a set it and done event there's no need to do an actual graph traversal and you're better off storing the pre-calculated graph.


Yes you can inherit this class from a Graph data structure. You can make it a subclass of anything you want (except for a sealed class). The question of whether or not it is a wise design is entirely dependant on what you want to do. I assume you know how, so comment if you need an example of how to implement inheritance.

IF you are wanting to write your own graphing algorithms, why not just model it yourself? It would probably be a fun exercise.

0

精彩评论

暂无评论...
验证码 换一张
取 消