networkx: Add all_simple_path target typing in simple_paths.pyi (#14656)

Adds typing for the target argument of all_simple_paths and all_simple_edge_paths, which per the documentation take either a single node or an iterable of nodes.
This commit is contained in:
GiGaGon
2025-08-28 11:09:28 -07:00
committed by GitHub
parent c0fed911d6
commit d019a53a3b
@@ -1,5 +1,5 @@
from _typeshed import Incomplete, SupportsGetItem
from collections.abc import Callable, Collection, Generator
from collections.abc import Callable, Collection, Generator, Iterable
from typing import Any
from networkx.classes.graph import Graph, _Node
@@ -10,10 +10,12 @@ __all__ = ["all_simple_paths", "is_simple_path", "shortest_simple_paths", "all_s
@_dispatchable
def is_simple_path(G: Graph[_Node], nodes: Collection[Incomplete]) -> bool: ...
@_dispatchable
def all_simple_paths(G: Graph[_Node], source: _Node, target, cutoff: int | None = None) -> Generator[list[_Node], None, None]: ...
def all_simple_paths(
G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None
) -> Generator[list[_Node]]: ...
@_dispatchable
def all_simple_edge_paths(
G: Graph[_Node], source: _Node, target, cutoff: int | None = None
G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None
) -> Generator[list[_Node] | list[tuple[_Node, _Node]], None, list[_Node] | None]: ...
@_dispatchable
def shortest_simple_paths(