networkx: improve the cycles module (#14459)

This commit is contained in:
Ali Hamdan
2025-07-26 16:27:01 +02:00
committed by GitHub
parent 1bd302042d
commit 2c10360fd1
+11 -16
View File
@@ -1,8 +1,8 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import Literal
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.classes.graph import Graph, _NBunch, _Node
from networkx.utils.backends import _dispatchable
__all__ = [
@@ -16,23 +16,18 @@ __all__ = [
]
@_dispatchable
def cycle_basis(G: Graph[_Node], root: _Node | None = None): ...
def cycle_basis(G: Graph[_Node], root: _Node | None = None) -> list[list[_Node]]: ...
@_dispatchable
def simple_cycles(G: Graph[_Node], length_bound: int | None = None) -> Generator[Incomplete, Incomplete, None]: ...
class _NeighborhoodCache(dict[Incomplete, Incomplete]):
G: Incomplete
def __init__(self, G) -> None: ...
def __missing__(self, v): ...
def simple_cycles(G: Graph[_Node], length_bound: int | None = None) -> Generator[list[_Node]]: ...
@_dispatchable
def chordless_cycles(G: DiGraph[_Node], length_bound: int | None = None) -> Generator[Incomplete, Incomplete, None]: ...
def chordless_cycles(G: DiGraph[_Node], length_bound: int | None = None) -> Generator[list[_Node]]: ...
@_dispatchable
def recursive_simple_cycles(G: DiGraph[_Node]): ...
def recursive_simple_cycles(G: DiGraph[_Node]) -> list[list[_Node]]: ...
@_dispatchable
def find_cycle(G: Graph[_Node], source=None, orientation=None): ...
def find_cycle(
G: Graph[_Node], source: _NBunch[_Node] = None, orientation: Literal["original", "reverse", "ignore"] | None = None
): ...
@_dispatchable
def minimum_cycle_basis(G: Graph[_Node], weight: str | None = None): ...
def minimum_cycle_basis(G: Graph[_Node], weight: str | None = None) -> list[list[_Node]]: ...
@_dispatchable
def girth(G) -> float | int: ...
def girth(G: Graph[_Node]) -> float | int: ... # accepts any graph type