code: def test_hlg_layer_topological():
      a = {"x": 1}
      b = {"y": (utils_test.inc, "x")}
      c = {"z": (utils_test.inc, "x")}
      d = {"r": (sum, ["y", "z"])}
      layers = {"a": a, "b": b, "c": c, "d": d}
      dependencies = {
          "a": set(),
          "b": {"a"},
          "c": {"a"},
          "d": {"b", "c"},
      }
      hg = HighLevelGraph(layers, dependencies)
  
      assert utils_test.hlg_layer_topological(hg, -1) is hg.layers["d"]
      assert utils_test.hlg_layer_topological(hg, 0) is hg.layers["a"]
      assert utils_test.hlg_layer_topological(hg, 1) in (
          hg.layers["b"],
          hg.layers["c"],
      )
  
file_path: dask/dask/tests/test_utils_test.py
imports: from __future__ import annotations
  import warnings
  import pytest
  from dask import utils_test
  from dask.highlevelgraph import HighLevelGraph
  from dask.utils_test import _check_warning
label_desc: Use image node_id 2 for calling a global function with example usage: test_hlg_layer_topological() without return types