code: def get_navigation(files: Files, config: MkDocsConfig) -> Navigation:
      """Build site navigation from config and files."""
      documentation_pages = files.documentation_pages()
      nav_config = config["nav"] or nest_paths(
          f.src_uri
          for f in documentation_pages
          if f.inclusion.is_in_nav()
      )
      items = _data_to_navigation(nav_config, files, config)
      if not isinstance(items, list):
          items = [items]
  
      # Get only the pages from the navigation, ignoring any sections and links.
      pages = _get_by_type(items, Page)
  
      # Include next, previous and parent links.
      _add_previous_and_next_links(pages)
      _add_parent_links(items)
  
      missing_from_config = []
      for file in documentation_pages:
          if file.page is None:
              # Any documentation files not found in the nav should still have an associated page, so we
              # create them here. The Page object will automatically be assigned to `file.page` during
              # its creation (and this is the only way in which these page objects are accessible).
              Page(None, file, config)
              if file.inclusion.is_in_nav():
                  missing_from_config.append(file.src_path)
      if missing_from_config:
          log.log(
              config.validation.nav.omitted_files,
              "The following pages exist in the docs directory, but are not "
              'included in the "nav" configuration:\n  - '
              + "\n  - ".join(missing_from_config),
          )
  
      links = _get_by_type(items, Link)
      for link in links:
          scheme, netloc, path, query, fragment = urlsplit(link.url)
          if scheme or netloc:
              log.debug(
                  f"An external link to '{link.url}' is included in the 'nav' configuration."
              )
          elif (
              link.url.startswith("/")
              and config.validation.nav.absolute_links
              is not _AbsoluteLinksValidationValue.RELATIVE_TO_DOCS
          ):
              log.log(
                  config.validation.nav.absolute_links,
                  f"An absolute path to '{link.url}' is included in the 'nav' "
                  "configuration, which presumably points to an external resource.",
              )
          else:
              log.log(
                  config.validation.nav.not_found,
                  f"A reference to '{link.url}' is included in the 'nav' "
                  "configuration, which is not found in the documentation files.",
              )
      return Navigation(items, pages)
  
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING, Iterator, TypeVar
  from urllib.parse import urlsplit
  from mkdocs.exceptions import BuildError
  from mkdocs.structure import StructureItem
  from mkdocs.structure.pages import Page, _AbsoluteLinksValidationValue
  from mkdocs.utils import nest_paths
label_desc: Use image node_id 1 for calling a global function with example usage: get_navigation(files, config) and returns: Navigation