|
1 |
| -from _typeshed import Incomplete |
2 | 1 | from collections.abc import Iterator
|
3 | 2 | from functools import cached_property
|
| 3 | +from typing import Any |
4 | 4 | from typing_extensions import Self
|
5 | 5 |
|
6 | 6 | from networkx.classes.coreviews import AdjacencyView
|
7 | 7 | from networkx.classes.graph import Graph, _Node
|
8 |
| -from networkx.classes.reportviews import InDegreeView, InMultiDegreeView, OutDegreeView, OutEdgeView, OutMultiDegreeView |
| 8 | +from networkx.classes.reportviews import ( |
| 9 | + DiDegreeView, |
| 10 | + InDegreeView, |
| 11 | + InEdgeView, |
| 12 | + InMultiDegreeView, |
| 13 | + OutDegreeView, |
| 14 | + OutEdgeView, |
| 15 | + OutMultiDegreeView, |
| 16 | +) |
9 | 17 |
|
10 | 18 | __all__ = ["DiGraph"]
|
11 | 19 |
|
12 | 20 | class DiGraph(Graph[_Node]):
|
13 | 21 | @cached_property
|
14 |
| - def succ(self) -> AdjacencyView[_Node, _Node, dict[str, Incomplete]]: ... |
| 22 | + def succ(self) -> AdjacencyView[_Node, _Node, dict[str, Any]]: ... |
15 | 23 | @cached_property
|
16 |
| - def pred(self) -> AdjacencyView[_Node, _Node, dict[str, Incomplete]]: ... |
| 24 | + def pred(self) -> AdjacencyView[_Node, _Node, dict[str, Any]]: ... |
17 | 25 | def has_successor(self, u: _Node, v: _Node) -> bool: ...
|
18 | 26 | def has_predecessor(self, u: _Node, v: _Node) -> bool: ...
|
19 | 27 | def successors(self, n: _Node) -> Iterator[_Node]: ...
|
| 28 | + |
20 | 29 | neighbors = successors
|
| 30 | + |
21 | 31 | def predecessors(self, n: _Node) -> Iterator[_Node]: ...
|
22 | 32 | @cached_property
|
23 | 33 | def out_edges(self) -> OutEdgeView[_Node]: ...
|
24 | 34 | @cached_property
|
25 |
| - def in_edges(self) -> OutEdgeView[_Node]: ... |
| 35 | + def in_edges(self) -> InEdgeView[_Node]: ... |
26 | 36 | @cached_property
|
27 |
| - def in_degree(self) -> InDegreeView[_Node] | InMultiDegreeView[_Node]: ... # Include subtypes' possible return types |
| 37 | + def in_degree(self) -> int | InDegreeView[_Node] | InMultiDegreeView[_Node]: ... |
28 | 38 | @cached_property
|
29 |
| - def out_degree(self) -> OutDegreeView[_Node] | OutMultiDegreeView[_Node]: ... # Include subtypes' possible return types |
30 |
| - def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override] # Has an additional `reciprocal` keyword argument |
| 39 | + def out_degree(self) -> int | OutDegreeView[_Node] | OutMultiDegreeView[_Node]: ... |
| 40 | + def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override] |
| 41 | + # reciprocal : If True, only edges that appear in both directions ... will be kept in the undirected graph. |
31 | 42 | def reverse(self, copy: bool = True) -> Self: ...
|
32 |
| - def copy(self, as_view: bool = False) -> DiGraph[_Node]: ... |
| 43 | + @cached_property |
| 44 | + def edges(self) -> OutEdgeView[_Node]: ... # type: ignore[override] # An OutEdgeView of the DiGraph as G.edges or G.edges(). |
| 45 | + @cached_property |
| 46 | + def degree(self) -> int | DiDegreeView[_Node]: ... # type: ignore[override] # Returns DiDegreeView or int |
0 commit comments