code: def test_topsorted_layers_ignore_unknown_child_node(self):
      nodes = [
          Node("A", [], ["B"]),
          Node("B", ["A"], ["C"]),
          Node("C", ["B"], []),
      ]
      node_map = {node.name: node for node in nodes}
      # Exclude node C. Node B now has a child node 'C' that should be ignored.
      layers = topsort.topsorted_layers(
          [node_map["A"], node_map["B"]],
          get_node_id_fn=lambda n: n.name,
          get_parent_nodes=(
              lambda n: [node_map[name] for name in n.upstream_nodes]
          ),
          get_child_nodes=(
              lambda n: [node_map[name] for name in n.downstream_nodes]
          ),
      )
      self.assertEqual(
          [["A"], ["B"]],
          [[node.name for node in layer] for layer in layers],
      )
  
file_path: tfx/tfx/utils/topsort_test.py
imports: import attr
  import tensorflow
  from tfx.utils import topsort
label_desc: Use image node_id 5 for calling the TopsortTest obj's underlying member method code with example usage: obj.test_topsorted_layers_ignore_unknown_child_node() without return types