The AdjacencyMatrix Conundrum

In Mendz.Graphs, you should find that the AdjacencyMatrix, WeightedAdjacencyMatrix and GenericAdjacencyMatrix classes are coded pretty much the same way. In fact, they are essentially coded exactly alike, with only the namespaces different. Why is this so, Mendz?

The simple answer is: because I like. Different software designers may argue against this style. It's really a preference. It can be designed differently for the sake of. In the end, I settled with how it is now in Mendz.Graphs. It's simple. It's visual. And it works.

In practice, users of Mendz.Graphs would be deliberate on which kind of matrices to use in their projects. I didn't provide a factory to create which of this or that. I leave that up to developers who may find the need for it.

On the surface, the AdjacencyMatrix, WeightedAdjacencyMatrix and GenericAdjacencyMatrix classes seem to have repeating codes in them. This is caused by one characteristic of OOP that can be both an advantage and a disadvantage at the same time: OOP can hide complexity. If you'll look at the corresponding AdjacencyMatrixBase that they derive from, you should find in code where the real differences are.

Comments