Skip to content
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

Ruby Course: Adding additional information about the Graphs data structure #28931

Closed
3 tasks done
PivtoranisV opened this issue Oct 9, 2024 · 7 comments · Fixed by #28962
Closed
3 tasks done

Ruby Course: Adding additional information about the Graphs data structure #28931

PivtoranisV opened this issue Oct 9, 2024 · 7 comments · Fixed by #28962

Comments

@PivtoranisV
Copy link
Contributor

Checks

Describe your suggestion

It would be great to add more information about the graph data structure in the Knight’s Travails project context, so learners can relate graph data structure to the current problem. The current version of the lesson briefly introduces graphs but does not specify how this data structure relates to solving the knight’s movement problem.

My suggestion is to include the below part before the Assignment

In this problem, the chessboard can be represented as a graph:

  • Each square on the board is a node (or vertex).
  • A knight’s valid moves from any square represent the edges (or connections) between the vertices.

Thus, the problem of finding the shortest path for the knight’s movement becomes a graph traversal problem. The goal is to traverse the graph (the chessboard) to find the shortest route between two nodes (the start and end positions).

1. Vertices and Edges

  • The vertices in this graph are each of the possible positions on the chessboard, represented by a pair of coordinates like [x, y], where x and y are between 0 and 7.
  • The edges are the valid knight moves between vertices. For example, from [0,0], a knight can move to [2,1], [1,2], and so on. Each of these moves represents a connection between the vertex [0,0] and the other reachable vertices.

2. Graph Representation

While solving this problem, you don’t need to explicitly create a graph object with vertices and edges. Instead, you can think of the graph as being implicit:

  • The knight starts on a specific vertex.
  • The algorithm will explore all possible moves (edges) to other vertices (positions on the board).

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/lessons/ruby-knights-travails

(Optional) Discord Name

volodymyrpivtoranis

(Optional) Additional Comments

I think my suggestion will not make the project easier, but it will help to understand a graph data structure better. I'm not sure, maybe it is only for me, but that connection between the graph and the current project took a while.

As always, thank you for the great job you are doing with maintaining such an amazing project

@SumonGFC
Copy link
Contributor

SumonGFC commented Oct 14, 2024

hi just want to let you know this is related to #28487

So if the maintainers give the go-ahead to start working on a dedicated graph data structure project/lesson, then this addition to the KT project will become obsolete/deprecated when/if the new graph project/lesson is added to the curriculum.

For what my opinion is worth: even if there will be a new graph project, I think the suggestions here are great, and, since it will likely be some time before the new project is added (if at all), the additions proposed here would be beneficial to learners going through this project up to the addition of the new graph project.

Also @PivtoranisV , there is also a corresponding Knight Travails project in the Javascript course, so that should be updated accordingly as well if this addition gets approved

@PivtoranisV
Copy link
Contributor Author

Thank you @SumonGFC for pointing that, for some reason I missed that issue.
I think we can still keep KT project in TOP, as it is a good warm up before final Ruby project. But yes, it will be nice to have one more Graph dedicated project.

@wise-king-sullyman
Copy link
Member

Thanks for making this issue!

Yes I was about to mention that issue as well, I just gave the go ahead on it.

I agree that these changes would be good to have in the interim at least, so @PivtoranisV if you'd like you go ahead with this.

As @SumonGFC mentioned though your suggestions here may no longer be needed when the other graph project is added, so if you don't want to invest time into something that might no longer be needed in a short time I'd understand completely.

@PivtoranisV
Copy link
Contributor Author

Thank you @wise-king-sullyman ! I will make PR with changes, even if it will stay not for long ;)

@wise-king-sullyman
Copy link
Member

wise-king-sullyman commented Oct 17, 2024

@PivtoranisV thanks for the quick work!

One thought: it looks like you only changed the Ruby version, can you make the same change in the JS version of the lesson?

@PivtoranisV
Copy link
Contributor Author

@wise-king-sullyman done
#28968

Thank you

@wise-king-sullyman
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants