from typing import Any, Iterable, Iterator, List

from _typeshed import Self
from networkx.classes.reportviews import NodeView

__version__: str

class Graph:
    nodes: NodeView
    def subgraph(self: Self, nodes: Iterable) -> Self: ...
    def copy(self: Self) -> Self: ...
    def add_node(self, node: str, **kwargs) -> None: ...
    def add_edge(self, u: str, v: str, **kwargs) -> None: ...
    def add_edges_from(self, edges: Iterable) -> None: ...
    def remove_nodes_from(self, edges: Iterable) -> None: ...
    def remove_edges_from(self, edges: Iterable) -> None: ...
    def __iter__(self) -> Iterator[str]: ...
    def in_degree(self, node: str) -> int: ...
    def out_degree(self, node: str) -> int: ...

class DiGraph(Graph):
    def to_undirected(self) -> Graph: ...
    def successors(self, node: str) -> Iterable[str]: ...
    def predecessors(self, node: str) -> Iterable[str]: ...

# NOTE: The attr parameter of this function is quite more complicated than this
def set_node_attributes(g: DiGraph, attr: Any, name: str) -> None: ...
def topological_sort(g: DiGraph) -> Iterable[str]: ...
def selfloop_edges(g: DiGraph) -> Iterable[str]: ...
def weakly_connected_components(g: DiGraph) -> Iterable[List[str]]: ...
def strongly_connected_components(g: DiGraph) -> Iterable[List[str]]: ...
