Is there some data structures in godot that is suitable to save a graph

Godot Version



im trying to make something like galaxy simulator and some ships will move from one node to another through an edge between them. Is there any data structures in godot can be suitable for saving these nodes and edges? i found one called Mesh but it seems it is used for saving graphics

A common way to represent a graph is with a dictionary, where each key is a node, and each value is a list of nodes that that node has an edge to. This makes it fast to look up which nodes you can get to from any given node.

1 Like