code: def test_extract(
      self, setup, kg, root, max_depth, max_walks, with_reverse
  ):
      root = f"{URL}#{root}"
      walker = CommunityWalker(
          max_depth,
          max_walks,
          with_reverse=with_reverse,
          random_state=42,
      )
      walks = walker.extract(kg, [root])[0]
      if max_walks is not None:
          if with_reverse:
              assert len(walks) <= max_walks * max_walks
          else:
              assert len(walks) <= max_walks
      for walk in walks:
          for obj in walk[2::2]:
              if obj not in walker._entities:
                  assert obj.startswith("b'")
          if not with_reverse:
              assert walk[0] == root
              assert len(walk) <= (max_depth * 2) + 1
          else:
              assert len(walk) <= ((max_depth * 2) + 1) * 2
  
file_path: pyRDF2Vec/tests/walkers/test_community.py
imports: import itertools
  import pytest
  from pyrdf2vec.graphs import KG, Vertex
  from pyrdf2vec.walkers import CommunityWalker
label_desc: Use image node_id 4 for calling the TestCommunityWalker obj's underlying member method code with example usage: obj.test_extract(setup, kg, root, max_depth, max_walks, with_reverse) without return types