-
-
Notifications
You must be signed in to change notification settings - Fork 27
Added Depth First Search in Every Language Article #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Depth First Search in Every Language Article #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! How would a program go about parsing the input? In the past, we used serialized adjacency matrices for graphs, and I was wondering if we could do something similar.
Yes, I thought about that and didn't really come to a nice solution except for the one I pushed... Do you mean like in the minimum spanning tree project [1] or the dijkstra project [2] for example? [1] https://github.com/TheRenegadeCoder/sample-programs-website/blob/master/projects/minimum-spanning-tree/index.md#requirements |
One problem I see in the adjacency matrix is that there is no clear way of adding data to the vertices. In order for a search program to be run on the graph/tree we need some vertex values to look for of course. So this would need to be added to the adjacency matrix in some form. |
One way to adress this problem would be to have an additional input to programs that is the list of vertex values in the same order as they appear in the matrix. |
…s and value to find
@jrg94 I updated the article with requirements including an adjacency matrix now, please have a look :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to think if there is a cleaner way to represent the input, but this is probably as good as it's going to get from a parsing perspective (e.g. I'm thinking of lower level languages that might have to do a lot of work to process the input). If you're happy with this, I'll go ahead and merge it!
Overall, I agree the adjacency matrix solution isn't great because it doesn't scale well. That said, the biggest issue is parsing, and I'm not sure there's a nice format beyond JSON or something like that. Also, we want to avoid the requirement of nodes and whatnot for trees. Since most languages support a list-like structure, this is usually the safest bet. |
I think I am happy with it so feel free to merge :) |
SOLUTION DESCRIPTION
This PR adds the article about depth first search in every language.
This PR resolves #327