Node Extraction for flow::graph

Summary

Deprecated extensions to the flow graph classes to support traversal and extraction of graph nodes:

  • extraction of an individual node from a flow graph.
  • retrieval of the number of predecessors and successors of a node.
  • retrieval of a copy of all predecessors and successors of a node.
These extensions were available for preview till Intel® Threading Building Blocks 2019 but have not had much customer usage. To keep using the corresponding API, define the TBB_DEPRECATED_FLOW_NODE_EXTRACTION macro to a non-zero value. Be aware that the feature may be completely removed in a future version of TBB.

Header

#define TBB_DEPRECATED_FLOW_NODE_EXTRACTION 1
#include "tbb/flow_graph.h"
         

Additional syntax for graph nodes

The flow graph node classes additionally define the following typedefs and methods:

namespace tbb {
namespace flow {
  class graph_node {
  public:
    typedef implementation-defined predecessor_type;         // all but source_node
    typedef implementation-defined predecessor_list_type;  // all but source_node
    typedef implementation-defined successor_type;
    typedef implementation-defined successor_list_type;

    size_t predecessor_count();  // all but source_node
    size_t successor_count();
    void   copy_predecessors(predecessor_list_type &pv);  // all but source_node
    void   copy_successors(successor_list_type &sv);
    void extract( );
  };
}
}
             

CAUTION

The methods added to the graph_node class are not thread-safe. The graph should not be active when they are used.

The following table provides additional information on the obsolete members and typedefs of tbb::flow::graph_node and derived classes.
Member Description
predecessor_type

Defines the type of the elements of predecessor_list_type. This type is not defined for source_node.

predecessor_list_type

Defines the type returned by copy_predecessors(). This class will have size(), begin(), end() and iterator types defined. This type is not defined for source_node.

successor_type

Defines the type of the element of successor_list_type.

successor_list_type

Defines the type returned by copy_successors(). This class will have size(), begin(), end() and iterator types defined.

size_t predecessor_count();

Returns the number of graph nodes which have been attached as predecessors to the current node with make_edge() and not removed with remove_edge() or by calling extract() or reset(rf_clear_edges). This method is not defined for source_node.

size_t successor_count();

Returns the number of graph nodes which have been attached as successors to the current node with make_edge() and not removed with remove_edge() or by calling extract() or reset(rf_clear_edges) .

void copy_predecessors(predecessor_list_type &pv);

Returns a data structure containing pointers to all the predecessors of the node. This method is not defined for source_node.

void copy_successors(successor_list_type &sv);

Returns a data structure containing pointers to all the successors of the node.

void extract( )

Removes all edges to the node.

For more complete information about compiler optimizations, see our Optimization Notice.