24.02.1
|
Go to the documentation of this file.
52 bool are_all_visited =
true;
53 for (
const auto &input_edge_id : node->
input_edges())
57 const Edge *input_edge = graph->
edge(input_edge_id);
62 are_all_visited =
false;
68 return are_all_visited;
74 std::vector<NodeID> bfs_order_vector;
77 std::vector<bool> visited(g.
nodes().size(),
false);
80 std::list<NodeID> queue;
87 visited[
input] =
true;
88 queue.push_back(
input);
97 visited[const_node] =
true;
98 queue.push_back(const_node);
103 while (!queue.empty())
107 bfs_order_vector.push_back(n);
124 return bfs_order_vector;
129 std::vector<NodeID> dfs_order_vector;
132 std::vector<bool> visited(g.
nodes().size(),
false);
135 std::stack<NodeID> stack;
142 visited[
input] =
true;
152 visited[const_node] =
true;
153 stack.push(const_node);
158 while (!stack.empty())
162 dfs_order_vector.push_back(n);
185 return dfs_order_vector;
const Edge * edge(EdgeID id) const
Get edge object given its id.
reverse_iterable< T > reverse_iterate(T &val)
Creates a reverse iterable for a given type.
const std::set< EdgeID > & output_edges() const
Returns output edge set.
bool all_inputs_are_visited(const INode *node, const std::vector< bool > &visited)
Checks if all the input dependencies of a node have been visited.
INode * consumer() const
Returns consumer node.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
std::vector< NodeID > dfs(Graph &g)
Depth first search traversal.
NodeID consumer_id() const
Returns sink node id.
NodeID producer_id() const
Returns producer node id.
const std::vector< EdgeID > & input_edges() const
Returns input edge set.
const INode * node(NodeID id) const
Get node object given its id.
Copyright (c) 2017-2024 Arm Limited.
const Graph * graph() const
Returns node's Graph.
INode * producer() const
Returns producer node.
std::vector< NodeID > bfs(Graph &g)
Breadth first search traversal.
const std::vector< NodeID > & nodes(NodeType type)
Returns graph input nodes.
constexpr NodeID EmptyNodeID
Constant EdgeID specifying an equivalent of null edge.