


"""simple docstring"""

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


UpperCAmelCase__  							={
    "configuration_clip": [
        "CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "CLIPConfig",
        "CLIPOnnxConfig",
        "CLIPTextConfig",
        "CLIPVisionConfig",
    ],
    "processing_clip": ["CLIPProcessor"],
    "tokenization_clip": ["CLIPTokenizer"],
}

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=["CLIPTokenizerFast"]

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=["CLIPFeatureExtractor"]
       UpperCAmelCase__  							=["CLIPImageProcessor"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=[
           "CLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
           "CLIPModel",
           "CLIPPreTrainedModel",
           "CLIPTextModel",
           "CLIPTextModelWithProjection",
           "CLIPVisionModel",
           "CLIPVisionModelWithProjection",
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=[
           "TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
           "TFCLIPModel",
           "TFCLIPPreTrainedModel",
           "TFCLIPTextModel",
           "TFCLIPVisionModel",
       ]

try:
       if not is_flax_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       UpperCAmelCase__  							=[
           "FlaxCLIPModel",
           "FlaxCLIPPreTrainedModel",
           "FlaxCLIPTextModel",
           "FlaxCLIPTextPreTrainedModel",
           "FlaxCLIPVisionModel",
           "FlaxCLIPVisionPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_clip import (
           CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
           CLIPConfig,
           CLIPOnnxConfig,
           CLIPTextConfig,
           CLIPVisionConfig,
       )
       from .processing_clip import CLIPProcessor
       from .tokenization_clip import CLIPTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_clip_fast import CLIPTokenizerFast

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .feature_extraction_clip import CLIPFeatureExtractor
              from .image_processing_clip import CLIPImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_clip import (
                  CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  CLIPModel,
                  CLIPPreTrainedModel,
                  CLIPTextModel,
                  CLIPTextModelWithProjection,
                  CLIPVisionModel,
                  CLIPVisionModelWithProjection,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_clip import (
                  TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFCLIPModel,
                  TFCLIPPreTrainedModel,
                  TFCLIPTextModel,
                  TFCLIPVisionModel,
              )

       try:
              if not is_flax_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_flax_clip import (
                  FlaxCLIPModel,
                  FlaxCLIPPreTrainedModel,
                  FlaxCLIPTextModel,
                  FlaxCLIPTextPreTrainedModel,
                  FlaxCLIPVisionModel,
                  FlaxCLIPVisionPreTrainedModel,
              )


else:
       import sys

       UpperCAmelCase__  							=_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




"""simple docstring"""

def lowerCAmelCase_      (				UpperCamelCase__	: Optional[Any]				,   UpperCamelCase__	: int				,   UpperCamelCase__	: Optional[Any]				,   UpperCamelCase__	: str ):






 """simple docstring"""







 __lowercase									=	[False] * len(UpperCamelCase__ )
 __lowercase									=	[]
 queue.append(UpperCamelCase__ )
 __lowercase									=	True

 while queue:
  __lowercase									=	queue.pop(0 )
  for ind in range(len(graph[u] ) ):
   if visited[ind] is False and graph[u][ind] > 0:
    queue.append(UpperCamelCase__ )
    __lowercase									=	True
    __lowercase									=	u

 return visited[t]


def lowerCAmelCase_      (				UpperCamelCase__	: str				,   UpperCamelCase__	: Any				,   UpperCamelCase__	: Optional[int] ):






 """simple docstring"""







 __lowercase									=	[-1] * (len(UpperCamelCase__ ))
 __lowercase									=	0
 while bfs(UpperCamelCase__				,   UpperCamelCase__				,   UpperCamelCase__				,   UpperCamelCase__ ):
  __lowercase									=	float("""Inf""" )
  __lowercase									=	sink

  while s != source:
   # Find the minimum value in select path
   __lowercase									=	min(UpperCamelCase__				,   graph[parent[s]][s] )
   __lowercase									=	parent[s]

  max_flow += path_flow
  __lowercase									=	sink

  while v != source:
   __lowercase									=	parent[v]
   graph[u][v] -= path_flow
   graph[v][u] += path_flow
   __lowercase									=	parent[v]
 return max_flow


UpperCAmelCase__  							=[
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

UpperCAmelCase__							,      UpperCAmelCase__  							=0, 5

print(ford_fulkerson(graph, source, sink))
