Answer the question
In order to leave comments, you need to log in
How to build a graph from a matrix?
I have a matrix which is a game map. This matrix looks like this:
[
'.....',
'..WW.',
'.....'
]
Answer the question
In order to leave comments, you need to log in
Why build a graph? Each cell has only top-bottom-left-right neighbors.
And most importantly, what can be the weight of the ribs? If only cells adjacent along the side are connected, then all edges have the same weight.
https://ru.wikipedia.org/wiki/A* - look at this thing
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question