Arma Reforger Script API
|
It is used to represent any kind of graph. More...
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) |
It is used to represent any kind of graph.
Internally this graph is represented as an adjacency list.
proto external bool Graph.AddEdge | ( | GraphNodeId | node1, |
GraphEdge | edge ) |
Insert an edge from node1 to node2.
proto external GraphNodeId Graph.AddNode | ( | GraphNode | graphNode | ) |
Add a node. Returns INVALID_NODE_ID if the node is already inside the graph.
proto void Graph.BFS | ( | GraphNodeId | startNode, |
func | callback ) |
Go over the graph in a BFS way and calling the callback.
bool Graph.CanAddNode | ( | GraphNode | graphNode | ) |
proto void Graph.DFS | ( | GraphNodeId | startNode, |
func | callback ) |
Go over the graph in a DFS way and calling the callback.
proto external int Graph.GetAdjacentNodes | ( | GraphNodeId | node, |
out notnull array< GraphNodeId > | adjacentNodes ) |
Returns the number of node added to the array.
proto external GraphEdge Graph.GetEdge | ( | GraphNodeId | node1, |
GraphNodeId | node2 ) |
Get the edge from node1 to node2.
proto external int Graph.GetEdges | ( | GraphNodeId | node, |
out notnull array< ref GraphEdge > | edges ) |
Get the edges from node.
proto external GraphNode Graph.GetNode | ( | GraphNodeId | nodeId | ) |
Returns the node if the node id is valid.
proto external bool Graph.HasEdge | ( | GraphNodeId | node1, |
GraphNodeId | node2 ) |
Check if this edge exist in the graph.
proto external bool Graph.HasNode | ( | GraphNodeId | nodeId | ) |
Check if the node exist in the graph.
void Graph.OnNodeAdded | ( | GraphNode | graphNode | ) |
void Graph.OnNodeRemoved | ( | GraphNode | graphNode | ) |
proto external bool Graph.RemoveEdge | ( | GraphNodeId | node1, |
GraphNodeId | node2 ) |
Remove the edge from node1 to node2.
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.
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.