returnable_set¶
-
safemdp.
returnable_set
(graph, reverse_graph, initial_nodes, out=None)¶ Compute the safe, returnable set of a graph
Parameters: graph: nx.DiGraph
Directed graph. Each edge must have associated action metadata, which specifies the action that this edge corresponds to. Each edge has an attribute [‘safe’], which is a boolean that indicates safety
reverse_graph: nx.DiGraph
The reversed directed graph, graph.reverse()
initial_nodes: list
List of the initial, safe nodes that are used as a starting point to compute the returnable set.
out: np.array
The array to write the results to. Is assumed to be False everywhere except at the initial nodes
Returns: returnable_set: np.array
Boolean array that indicates whether a node belongs to the returnable set.