Arma Reforger Script API
Loading...
Searching...
No Matches
Graph Interface Reference

It is used to represent any kind of graph. More...

Inheritance diagram for Graph:

Public Member Functions

proto external bool HasNode (GraphNodeId nodeId)
 Check if the node exist in the graph.
 
proto external GraphNode GetNode (GraphNodeId nodeId)
 Returns the node if the node id is valid.
 
proto external GraphNodeId AddNode (GraphNode graphNode)
 Add a node. Returns INVALID_NODE_ID if the node is already inside the graph.
 
proto external bool RemoveNode (GraphNodeId nodeId)
 Returns true if the node has been removed IMPORTANT* Use carefully, because we need to go over the entire graph to remove the node from the adjacency lists.
 
proto external bool RemoveNodes (notnull array< GraphNodeId > nodeIds)
 Returns true if all nodes has been removed IMPORTANT* Use carefully, because we need to go over the entire graph to remove the node from the adjacency lists.
 
proto external bool AddEdge (GraphNodeId node1, GraphEdge edge)
 Insert an edge from node1 to node2.
 
proto external GraphEdge GetEdge (GraphNodeId node1, GraphNodeId node2)
 Get the edge from node1 to node2.
 
proto external int GetEdges (GraphNodeId node, out notnull array< ref GraphEdge > edges)
 Get the edges from node.
 
proto external bool RemoveEdge (GraphNodeId node1, GraphNodeId node2)
 Remove the edge from node1 to node2.
 
proto external bool HasEdge (GraphNodeId node1, GraphNodeId node2)
 Check if this edge exist in the graph.
 
proto external int GetAdjacentNodes (GraphNodeId node, out notnull array< GraphNodeId > adjacentNodes)
 Returns the number of node added to the array.
 
proto void BFS (GraphNodeId startNode, func callback)
 Go over the graph in a BFS way and calling the callback.
 
proto void DFS (GraphNodeId startNode, func callback)
 Go over the graph in a DFS way and calling the callback.
 
bool CanAddNode (GraphNode graphNode)
 
void OnNodeAdded (GraphNode graphNode)
 
void OnNodeRemoved (GraphNode graphNode)
 
bool CanAddEdge (GraphNode node1, GraphEdge edge)
 
void OnEdgeAdded (GraphNode node1, GraphEdge edge)
 
void OnEdgeRemoved (GraphNode node1, GraphEdge edge)
 

Detailed Description

It is used to represent any kind of graph.

Internally this graph is represented as an adjacency list.

Member Function Documentation

◆ AddEdge()

proto external bool Graph.AddEdge ( GraphNodeId node1,
GraphEdge edge )

Insert an edge from node1 to node2.

◆ AddNode()

proto external GraphNodeId Graph.AddNode ( GraphNode graphNode)

Add a node. Returns INVALID_NODE_ID if the node is already inside the graph.

◆ BFS()

proto void Graph.BFS ( GraphNodeId startNode,
func callback )

Go over the graph in a BFS way and calling the callback.

◆ CanAddEdge()

bool Graph.CanAddEdge ( GraphNode node1,
GraphEdge edge )

◆ CanAddNode()

bool Graph.CanAddNode ( GraphNode graphNode)

◆ DFS()

proto void Graph.DFS ( GraphNodeId startNode,
func callback )

Go over the graph in a DFS way and calling the callback.

◆ GetAdjacentNodes()

proto external int Graph.GetAdjacentNodes ( GraphNodeId node,
out notnull array< GraphNodeId > adjacentNodes )

Returns the number of node added to the array.

◆ GetEdge()

proto external GraphEdge Graph.GetEdge ( GraphNodeId node1,
GraphNodeId node2 )

Get the edge from node1 to node2.

◆ GetEdges()

proto external int Graph.GetEdges ( GraphNodeId node,
out notnull array< ref GraphEdge > edges )

Get the edges from node.

◆ GetNode()

proto external GraphNode Graph.GetNode ( GraphNodeId nodeId)

Returns the node if the node id is valid.

◆ HasEdge()

proto external bool Graph.HasEdge ( GraphNodeId node1,
GraphNodeId node2 )

Check if this edge exist in the graph.

◆ HasNode()

proto external bool Graph.HasNode ( GraphNodeId nodeId)

Check if the node exist in the graph.

◆ OnEdgeAdded()

void Graph.OnEdgeAdded ( GraphNode node1,
GraphEdge edge )

◆ OnEdgeRemoved()

void Graph.OnEdgeRemoved ( GraphNode node1,
GraphEdge edge )

◆ OnNodeAdded()

void Graph.OnNodeAdded ( GraphNode graphNode)

◆ OnNodeRemoved()

void Graph.OnNodeRemoved ( GraphNode graphNode)

◆ RemoveEdge()

proto external bool Graph.RemoveEdge ( GraphNodeId node1,
GraphNodeId node2 )

Remove the edge from node1 to node2.

◆ RemoveNode()

proto external bool Graph.RemoveNode ( GraphNodeId nodeId)

Returns true if the node has been removed IMPORTANT* Use carefully, because we need to go over the entire graph to remove the node from the adjacency lists.

◆ RemoveNodes()

proto external bool Graph.RemoveNodes ( notnull array< GraphNodeId > nodeIds)

Returns true if all nodes has been removed IMPORTANT* Use carefully, because we need to go over the entire graph to remove the node from the adjacency lists.

This is still faster than calling RemoveNode individually. Because we don't search in the adjacency lists of nodes that will be removed.


The documentation for this interface was generated from the following file: