Convert 2D grid into graph
Hey, as in the title, I have a simple
Vector2Int[,] grid
that I want to convert into a graph. How can I do this?6 Replies
starting from grid[0][0]
you can use one of this classes for example https://learn.microsoft.com/en-us/dotnet/api/system.windows.shapes?view=windowsdesktop-7.0
System.Windows.Shapes Namespace
Provides access to a library of shapes that can be used in Extensible Application Markup Language (XAML) or code.
can u give more information about what kind of data that grid contains?
i mean, sure its a 2d vector, but what does that represent? what should the resulting graph represent?
oh man i thought graph as in mathematical structure graph, i was like oh no
anyway tbh you could also think of drawing said graph
depends what representation you need
basically its just a map for the game. Each cell in this grid is a
Cell
class with int x,y
positions and Item item
in it.
I need a graph that will connect all the neighbours
want to use it for the Breadth First Search algorithmso i was right then
data structure would be sort of tied to the algorithm you want to use
it could be something using a quadtree or a linked list
you could even just use your matrix
it depends on the implementation