KeRNeLith / QuikGraph

Generic Graph Data Structures and Algorithms for .NET
https://kernelith.github.io/QuikGraph/
Microsoft Public License
465 stars 70 forks source link

[FEATURE] Expanded Documentation #18

Closed Ownezx closed 3 years ago

Ownezx commented 3 years ago

Is your feature request related to a problem? Please describe. As I am using this library in my game I have had a few issues starting with this library.

  1. It took me ages to find the wiki table of content as it was right next to the "documentation" link. That documentation shouldn't be the first thing user see since it's not great to start using the library.
  2. Took me a little while to understand the Edge class are oriented
  3. Took me a long while to understand how to filter edges in a search algorithm

Describe the solution you'd like I would like to contribute to the wiki in the following ways:

  1. Rename the table of content to "Getting started with Quick Graph", or find a way to make it stand out more (maybe a second link a bit higher in the home page).

  2. Add a tooltip on the create graph page in order to remind people that the Edge class is oriented.

  3. I want to contribute on the depth first search example to add an example of filtering just to help people start :

Filtered search : When going through all the tree is undesired, QuikGraph can use the outEdgesFilter function to avoid going in undesirable areas of the graph. The following example shows how to filter edges of a currently visited vertex.

AdjacencyGraph<TVertex, Edge<TVertex>> graph;

// Setup your graph the way you want

IEnumerable<Edge<TVertex>> Filter(IEnumerable<Edge<TVertex>> edges)
{
    // Your filtering algorithm here
}

// Creation of the algorithm
var bfs = new DepthFirstSearchAlgorithm<TVertex, Edge<TVertex>>(null, graph, new QuikGraph.Collections.Queue<TVertex>(), new Dictionary<TVertex, GraphColor>(), Filter);

Additional context By the way, nice job maintaining the library man. It's been a little hard to start using it but it works wonders.

KeRNeLith commented 3 years ago

Hello,

First of all, thank you for using QuikGraph and for your feedback!

  1. For the first point, you're right we can improve this by updating Home page with the link to the Table of contents at higher place be more visible and rename it obviously.

  2. I think we can add a reminder in the wiki page you suggested, maybe also adding a little page about QuikGraph built in edge classes, and checking if comment in code is also specifying this at least in a remark tag.

  3. For sure I will add this to the wiki page, if this can help others it always a good point.

All these remarks make me thinking that the wiki repository may not support having PR. If it was the case it would have been great to directly suggest you improvement ideas.

If you have any other suggestions/feedbacks to make, feel free to do them, and to share you experience, the blocking points in order to address them.

KeRNeLith commented 3 years ago

Didn't remember that there was already an Edges page. I just fixed the create graph page and added a link to the Edges one.

Updating the comment of edge classes to add the "(directed edge)" reminded me that to help you determining if an edge is oriented or not you can also use the debugger display/ToString. It has a simple arrow for oriented edges and a bidirectional one for undirected.

Ownezx commented 3 years ago

The Github wiki does not seem to support pull requests I believe (I am not a proficient GitHub user though). I'll keep a note of other things I would like to add to the wiki. If it ends up being significant, I might request to be a contributor just while I add the changes to the wiki.

On the edit on the Depth first example, an argument is missing on the code example :

// Create algorithm
var dfs = new DepthFirstSearchAlgorithm<TVertex, Edge<TVertex>>(
    null,
    graph,
    new QuikGraph.Collections.Queue<TVertex>(), // <== This line is missing
    new Dictionary<TVertex, GraphColor>(),
    Filter);    // <=
KeRNeLith commented 3 years ago

Yep, do not hesitate!

Hum, note for the DFS algorithm, you're maybe confusing with the BreadthFirstSearchAlgorithm (BFS), here in the example I used the DepthFirstSearchAlgorithm. The constructor difference between those algorithms is indeed the queue not needed in the first one.

Because the page is talking about DFS, I prefered using the DepthFirstSearchAlgorithm for the example rather than BreadthFirstSearchAlgorithm.

Ownezx commented 3 years ago

Ah yes, that is my mistake, I was using the bfs in my code.