On Tue, Apr 7, 2020 at 6:24 PM Andrzej Ostruszka <a...@semihalf.com> wrote:

> >
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next) {
> >>> +             if (graph_node->node->flags & RTE_NODE_SOURCE_F) {
> >>> +                     if (graph_node->node->nb_edges == 0)
> >>> +                             SET_ERR_JMP(EINVAL, fail,
> >>> +                                         "%s node needs minimum one 
> >>> edge",
> >>> +                                         graph_node->node->name);
> >>> +                     if (graph_bfs(graph, graph_node))
> >>> +                             goto fail;
> >>> +             }
> >>> +     }
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next)
> >>> +             if (graph_node->visited == false)
> >>> +                     SET_ERR_JMP(EINVAL, fail, "Found isolated node %s",
> >>> +                                 graph_node->node->name);> +
> >>> +     return 0;
> >>
> >> You don't want to clear visited because it will not be used or cleared
> >> on next call?
> >
> > See above graph_mark_nodes_as_not_visited() function.
>
> Yes I noticed that and referred to it in the question.  My intention was
> to ask whether you are fine with graph having visited=true for the rest
> of its life, or should we clear them again at the end of this function.

Got it. For now, visted=true is OK for the rest of it its life.

Since it needs to go over all the nodes to clear it again. As an optimization,
I thought of exposing  graph_mark_nodes_as_not_visited() and
 graph_bfs() is exported in graph_private.h. Those primitives would be enough
to make other use cases when needed.


>
> With regards
> Andrzej Ostruszka

Reply via email to