Graph manipulation

What is the project’s “graph”?

The project’s Graph represents all nodes of your project.

// Create an instance
InstantTerraApi::Init();
InstantTerraApi::InstantTerra it = InstantTerraApi::CreateInstantTerra();

// Get the current graph
InstantTerraApi::Graph graph = it.GetProject().GetGraph();

Retrieving the number of nodes in the graph

// Returns the numbers of nodes in the graph
int numberOfNodes = graph.GetNodeCount();

See GetNodeCount() in the documentation.

Getting a node from the graph with its index

// Returns the first node of the graph (index: 0)
Node firstNode = graph.GetNode(0);

The GetNode(int index) method returns the node with the specified index, from the graph.