Kemsekov / GraphSharp

GraphSharp is a tool to study and use knowledge of graph theory in C#!
MIT License
38 stars 5 forks source link

Refactor code and add features #5

Closed Kemsekov closed 2 years ago

Kemsekov commented 2 years ago

1:

Refactor FindTheShortestPath sample. It just looks ugly. Update readme and docs in general. Remove example from readme and move it to samples. Add separate readme to each sample.

2:

Redesign NodeGraphFactory Rename it to be just NodeFactory. Create chain-like mechanism to creating nodes

NodeFactory
.Create() //create new list of nodes
.Use(nodes) //or use existing nodes
.Count(2000) //create 2000 nodes
.Connect(20) //connect each to exact 20
.ConnectRange(1,10) //connect randomly to some range of nodes
.ConnectToClosest((node1,node2)=>...integer...);
.MakeDirected()
.MakeUndirected();
//Etc...

Where ConnectToClosest is a type of connection you used in a find path samples. It just works so cool you MUST add it to default connection methonds.

Also pass to this methods all Funcs you need in order to create different types of nodes and children.

Use pipeline pattern to implement this.

3:

You current graph implementation of ParallelGraph and just Graph are bad. You using some other thing like IPropagator in order to 'hide' implementation that differs from graph to graph. Move this implementation out of the class itself. Do something with it so it will follow bridge design pattern, so singe Graph class will be able to became single threaded and parallel depend on this type. Hinit - let users change IPropagator type to graph on their own, but let it by default be parallel, so it will make things a bit easier to maintain.

Also currently your IPropagators are doing almost the same thing in a very similar way. This breaks DRY principal. Do something about it.

4:

Add more tests for graph and other components of graph. Currently your tests are poor and do not cover all code behaviour properly.

5:

Implement second example - VisitAllNodes

6:

Currently for the sake of visualisation you using GraphDrawer which works fine but it is too much bound to imageSharp library. I mean you could in theory create some Avalonia.UI application that will use this class to draw graph on canvas dynamically.(which I hope you'll do, because WE NEED visualisation for GraphSharp). It's a shame that you so much lacks frontend skills.

Create graph visualisation in separate repository https://github.com/Kemsekov/GraphSharpGUI

  1. Update documentation to follow changes in api.
Kemsekov commented 2 years ago

2. Remade NodeGraphFactory - done. 1. Refactor FindTheShortestPath - done. 3. Removed ParallelGraph and moved IPropagator outside of Graph. Made it changable by PropagatorFactory 4. In process... 5. In process... 6. I am really doubt that I will do it, but I'll definitely try someday. Not in a scope currently.

7. In process.

Kemsekov commented 2 years ago

I am bit dumb that placed all of this in one issue. I will separate them and create a lot of issues.