mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-06-25 10:14:05 +08:00
Bump networkx to 3.5 (#14196)
This commit is contained in:
@@ -16,9 +16,6 @@ networkx\.(algorithms\.)?(centrality\.)?(current_flow_closeness\.)?information_c
|
||||
networkx\.(generators\.)?(random_graphs\.)?binomial_graph
|
||||
networkx\.(generators\.)?(random_graphs\.)?erdos_renyi_graph
|
||||
networkx\.(algorithms\.(minors\.(contraction\.)?)?)?identified_nodes
|
||||
networkx\.algorithms\.isomorphism\.isomorph\.faster_graph_could_be_isomorphic
|
||||
networkx\.algorithms\.isomorphism\.isomorph\.fast_graph_could_be_isomorphic
|
||||
networkx\.algorithms\.isomorphism\.isomorph\.graph_could_be_isomorphic
|
||||
networkx\.algorithms\.flow\.maxflow\.default_flow_func
|
||||
networkx\.algorithms\.[a-z_\.]+\.default_flow_func
|
||||
networkx\.(algorithms\.(centrality\.(load\.)?)?)?load_centrality
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version = "3.4.2"
|
||||
version = "3.5"
|
||||
upstream_repository = "https://github.com/networkx/networkx"
|
||||
# requires a version of numpy with a `py.typed` file
|
||||
requires = ["numpy>=1.20"]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from networkx.algorithms.approximation.clique import *
|
||||
from networkx.algorithms.approximation.clustering_coefficient import *
|
||||
from networkx.algorithms.approximation.connectivity import *
|
||||
from networkx.algorithms.approximation.density import *
|
||||
from networkx.algorithms.approximation.distance_measures import *
|
||||
from networkx.algorithms.approximation.dominating_set import *
|
||||
from networkx.algorithms.approximation.kcomponents import *
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from collections.abc import Callable, Hashable
|
||||
from typing import Literal
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
|
||||
_Algorithm: TypeAlias = Literal["greedy++", "fista"]
|
||||
|
||||
__all__ = ["densest_subgraph"]
|
||||
|
||||
ALGORITHMS: dict[_Algorithm, Callable[[Graph[Hashable], int], tuple[float, set[int]]]]
|
||||
|
||||
@_dispatchable
|
||||
def densest_subgraph(G: Graph[_Node], iterations: int = 1, *, method: _Algorithm = "fista") -> tuple[float, set[int]]: ...
|
||||
@@ -16,6 +16,6 @@ class MinDegreeHeuristic:
|
||||
def __init__(self, graph) -> None: ...
|
||||
def best_node(self, graph): ...
|
||||
|
||||
def min_fill_in_heuristic(graph) -> Incomplete | None: ...
|
||||
def min_fill_in_heuristic(graph_dict) -> Incomplete | None: ...
|
||||
@_dispatchable
|
||||
def treewidth_decomp(G: Graph[_Node], heuristic=...) -> tuple[int, Graph[_Node]]: ...
|
||||
|
||||
@@ -5,6 +5,7 @@ from networkx.algorithms.bipartite.covering import *
|
||||
from networkx.algorithms.bipartite.edgelist import *
|
||||
from networkx.algorithms.bipartite.extendability import *
|
||||
from networkx.algorithms.bipartite.generators import *
|
||||
from networkx.algorithms.bipartite.link_analysis import *
|
||||
from networkx.algorithms.bipartite.matching import *
|
||||
from networkx.algorithms.bipartite.matrix import *
|
||||
from networkx.algorithms.bipartite.projection import *
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
from collections.abc import Iterable
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
|
||||
__all__ = ["birank"]
|
||||
|
||||
@_dispatchable
|
||||
def birank(
|
||||
G: Graph[_Node],
|
||||
nodes: Iterable[_Node],
|
||||
*,
|
||||
alpha: float | None = None,
|
||||
beta: float | None = None,
|
||||
top_personalization: dict[str, int] | None = None,
|
||||
bottom_personalization: dict[str, int] | None = None,
|
||||
max_iter: int = 100,
|
||||
tol: float = 1.0e-6,
|
||||
weight: str | None = "weight",
|
||||
) -> dict[_Node, float]: ...
|
||||
@@ -5,6 +5,8 @@ from networkx.algorithms.community.divisive import *
|
||||
from networkx.algorithms.community.kclique import *
|
||||
from networkx.algorithms.community.kernighan_lin import *
|
||||
from networkx.algorithms.community.label_propagation import *
|
||||
from networkx.algorithms.community.leiden import *
|
||||
from networkx.algorithms.community.local import *
|
||||
from networkx.algorithms.community.louvain import *
|
||||
from networkx.algorithms.community.lukes import *
|
||||
from networkx.algorithms.community.modularity_max import *
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
from numpy.random import RandomState
|
||||
|
||||
__all__ = ["leiden_communities", "leiden_partitions"]
|
||||
|
||||
@_dispatchable
|
||||
def leiden_communities(
|
||||
G: Graph[_Node],
|
||||
weight: str | None = "weight",
|
||||
resolution: float = 1,
|
||||
max_level: int | None = None,
|
||||
seed: int | RandomState | None = None,
|
||||
): ...
|
||||
@_dispatchable
|
||||
def leiden_partitions(
|
||||
G: Graph[_Node], weight: str | None = "weight", resolution: float = 1, seed: int | RandomState | None = None
|
||||
): ...
|
||||
@@ -0,0 +1,15 @@
|
||||
from collections.abc import Callable, Hashable
|
||||
from typing import Literal
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
|
||||
__all__ = ["greedy_source_expansion"]
|
||||
|
||||
_Algorithm: TypeAlias = Literal["clauset"]
|
||||
|
||||
ALGORITHMS: dict[_Algorithm, Callable[[Graph[Hashable], Hashable, int | None], set[Hashable]]]
|
||||
|
||||
def greedy_source_expansion(
|
||||
G: Graph[_Node], *, source: _Node, cutoff: int | None = None, method: _Algorithm = "clauset"
|
||||
) -> set[_Node | None]: ...
|
||||
@@ -4,17 +4,13 @@ from networkx.classes.digraph import DiGraph
|
||||
from networkx.classes.graph import _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
|
||||
__all__ = ["is_d_separator", "is_minimal_d_separator", "find_minimal_d_separator", "d_separated", "minimal_d_separator"]
|
||||
__all__ = ["is_d_separator", "is_minimal_d_separator", "find_minimal_d_separator"]
|
||||
|
||||
@_dispatchable
|
||||
def is_d_separator(G: DiGraph[_Node], x: _Node | set[_Node], y: _Node | set[_Node], z: _Node | set[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def find_minimal_d_separator(G, x, y, *, included=None, restricted=None) -> set[Incomplete] | None: ...
|
||||
@_dispatchable
|
||||
def d_separated(G, x, y, z): ...
|
||||
@_dispatchable
|
||||
def minimal_d_separator(G, u, v): ...
|
||||
@_dispatchable
|
||||
def is_minimal_d_separator(
|
||||
G: DiGraph[_Node],
|
||||
x: _Node | set[_Node],
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
from collections.abc import Callable
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
|
||||
_WeightFunction: TypeAlias = Callable[..., int]
|
||||
|
||||
__all__ = [
|
||||
"eccentricity",
|
||||
"diameter",
|
||||
@@ -15,22 +20,22 @@ __all__ = [
|
||||
]
|
||||
|
||||
@_dispatchable
|
||||
def eccentricity(G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | None = None): ...
|
||||
def eccentricity(G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | _WeightFunction | None = None): ...
|
||||
@_dispatchable
|
||||
def diameter(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ...
|
||||
def diameter(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
|
||||
@_dispatchable
|
||||
def harmonic_diameter(G, sp=None) -> float: ...
|
||||
def harmonic_diameter(G, sp=None, *, weight: str | _WeightFunction | None = None) -> float: ...
|
||||
@_dispatchable
|
||||
def periphery(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ...
|
||||
def periphery(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
|
||||
@_dispatchable
|
||||
def radius(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ...
|
||||
def radius(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
|
||||
@_dispatchable
|
||||
def center(G: Graph[_Node], e=None, usebounds=False, weight: str | None = None): ...
|
||||
def center(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
|
||||
@_dispatchable
|
||||
def barycenter(G, weight: str | None = None, attr=None, sp=None): ...
|
||||
def barycenter(G, weight: str | _WeightFunction | None = None, attr=None, sp=None): ...
|
||||
@_dispatchable
|
||||
def resistance_distance(G: Graph[_Node], nodeA=None, nodeB=None, weight: str | None = None, invert_weight: bool = True): ...
|
||||
@_dispatchable
|
||||
def effective_graph_resistance(G, weight=None, invert_weight=True) -> float: ...
|
||||
def effective_graph_resistance(G, weight: str | None = None, invert_weight: bool = True) -> float: ...
|
||||
@_dispatchable
|
||||
def kemeny_constant(G, *, weight=None) -> float: ...
|
||||
def kemeny_constant(G, *, weight: str | None = None) -> float: ...
|
||||
|
||||
@@ -3,9 +3,13 @@ from collections.abc import Iterable
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
|
||||
__all__ = ["dominating_set", "is_dominating_set"]
|
||||
__all__ = ["dominating_set", "is_dominating_set", "connected_dominating_set", "is_connected_dominating_set"]
|
||||
|
||||
@_dispatchable
|
||||
def dominating_set(G: Graph[_Node], start_with: _Node | None = None): ...
|
||||
def dominating_set(G: Graph[_Node], start_with: _Node | None = None) -> set[_Node]: ...
|
||||
@_dispatchable
|
||||
def is_dominating_set(G: Graph[_Node], nbunch: Iterable[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def connected_dominating_set(G: Graph[_Node]) -> set[_Node]: ...
|
||||
@_dispatchable
|
||||
def is_connected_dominating_set(G: Graph[_Node], nbunch: Iterable[_Node]) -> bool: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing_extensions import deprecated
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
@@ -7,24 +8,27 @@ from networkx.utils.backends import _dispatchable
|
||||
__all__ = ["could_be_isomorphic", "fast_could_be_isomorphic", "faster_could_be_isomorphic", "is_isomorphic"]
|
||||
|
||||
@_dispatchable
|
||||
def could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ...
|
||||
|
||||
graph_could_be_isomorphic = could_be_isomorphic
|
||||
|
||||
def could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node], *, properties: str = "dtc") -> bool: ...
|
||||
@deprecated("`graph_could_be_isomorphic` is a deprecated alias for `could_be_isomorphic`. Use `could_be_isomorphic` instead.")
|
||||
def graph_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def fast_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ...
|
||||
|
||||
fast_graph_could_be_isomorphic = fast_could_be_isomorphic
|
||||
|
||||
def fast_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]) -> bool: ...
|
||||
@deprecated(
|
||||
"`fast_graph_could_be_isomorphic` is a deprecated alias for `fast_could_be_isomorphic`. "
|
||||
"Use `fast_could_be_isomorphic` instead."
|
||||
)
|
||||
def fast_graph_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def faster_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]): ...
|
||||
|
||||
faster_graph_could_be_isomorphic = faster_could_be_isomorphic
|
||||
|
||||
def faster_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]) -> bool: ...
|
||||
@deprecated(
|
||||
"`faster_graph_could_be_isomorphic` is a deprecated alias for `faster_could_be_isomorphic`. "
|
||||
"Use `faster_could_be_isomorphic` instead."
|
||||
)
|
||||
def faster_graph_could_be_isomorphic(G1: Graph[_Node], G2: Graph[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def is_isomorphic(
|
||||
G1: Graph[_Node],
|
||||
G2: Graph[_Node],
|
||||
node_match: Callable[..., Incomplete] | None = None,
|
||||
edge_match: Callable[..., Incomplete] | None = None,
|
||||
): ...
|
||||
) -> bool: ...
|
||||
|
||||
@@ -6,10 +6,6 @@ __all__ = ["rooted_tree_isomorphism", "tree_isomorphism"]
|
||||
@_dispatchable
|
||||
def root_trees(t1, root1, t2, root2): ...
|
||||
@_dispatchable
|
||||
def assign_levels(G: Graph[_Node], root): ...
|
||||
def group_by_levels(levels): ...
|
||||
def generate_isomorphism(v, w, M, ordered_children): ...
|
||||
@_dispatchable
|
||||
def rooted_tree_isomorphism(t1, root1, t2, root2): ...
|
||||
@_dispatchable
|
||||
def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]): ...
|
||||
|
||||
@@ -20,9 +20,18 @@ def quotient_graph(
|
||||
create_using: Graph[_Node] | None = None,
|
||||
): ...
|
||||
@_dispatchable
|
||||
def contracted_nodes(G: Graph[_Node], u, v, self_loops: bool = True, copy: bool = True): ...
|
||||
def contracted_nodes(
|
||||
G: Graph[_Node], u, v, self_loops: bool = True, copy: bool = True, *, store_contraction_as: str | None = "contraction"
|
||||
): ...
|
||||
|
||||
identified_nodes = contracted_nodes
|
||||
|
||||
@_dispatchable
|
||||
def contracted_edge(G: Graph[_Node], edge: tuple[Incomplete], self_loops: bool = True, copy: bool = True): ...
|
||||
def contracted_edge(
|
||||
G: Graph[_Node],
|
||||
edge: tuple[Incomplete],
|
||||
self_loops: bool = True,
|
||||
copy: bool = True,
|
||||
*,
|
||||
store_contraction_as: str | None = "contraction",
|
||||
): ...
|
||||
|
||||
@@ -81,3 +81,4 @@ class PlanarEmbedding(DiGraph[_Node]):
|
||||
def traverse_face(
|
||||
self, v: _Node, w: _Node, mark_half_edges: MutableSet[tuple[_Node, _Node]] | None = None
|
||||
) -> list[_Node]: ...
|
||||
def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override]
|
||||
|
||||
@@ -104,4 +104,6 @@ def generate_random_paths(
|
||||
index_map: SupportsGetItem[Incomplete, Incomplete] | None = None,
|
||||
weight: str | None = "weight",
|
||||
seed: int | RandomState | None = None,
|
||||
) -> Generator[Incomplete, None, None]: ...
|
||||
*,
|
||||
source: _Node | None = None,
|
||||
) -> Generator[list[Incomplete]]: ...
|
||||
|
||||
@@ -2,6 +2,7 @@ from collections.abc import Sequence
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
from numpy.random import RandomState
|
||||
|
||||
__all__ = ["is_threshold_graph", "find_threshold_graph"]
|
||||
|
||||
@@ -33,7 +34,7 @@ def betweenness_sequence(creation_sequence, normalized=True): ...
|
||||
def eigenvectors(creation_sequence): ...
|
||||
def spectral_projection(u, eigenpairs): ...
|
||||
def eigenvalues(creation_sequence): ...
|
||||
def random_threshold_sequence(n, p, seed=None): ...
|
||||
def right_d_threshold_sequence(n, m): ...
|
||||
def left_d_threshold_sequence(n, m): ...
|
||||
def swap_d(cs, p_split=1.0, p_combine=1.0, seed=None): ...
|
||||
def random_threshold_sequence(n, p, seed: int | RandomState | None = None): ...
|
||||
def right_d_threshold_sequence(n: int, m: int) -> list[str]: ...
|
||||
def left_d_threshold_sequence(n: int, m: int) -> list[str]: ...
|
||||
def swap_d(cs, p_split=1.0, p_combine=1.0, seed: int | RandomState | None = None): ...
|
||||
|
||||
@@ -2,7 +2,15 @@ from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
from numpy.random import RandomState
|
||||
|
||||
__all__ = ["hamiltonian_path", "is_reachable", "is_strongly_connected", "is_tournament", "random_tournament", "score_sequence"]
|
||||
__all__ = [
|
||||
"hamiltonian_path",
|
||||
"is_reachable",
|
||||
"is_strongly_connected",
|
||||
"is_tournament",
|
||||
"random_tournament",
|
||||
"score_sequence",
|
||||
"tournament_matrix",
|
||||
]
|
||||
|
||||
@_dispatchable
|
||||
def is_tournament(G: Graph[_Node]) -> bool: ...
|
||||
@@ -11,6 +19,8 @@ def hamiltonian_path(G: Graph[_Node]): ...
|
||||
@_dispatchable
|
||||
def random_tournament(n: int, seed: int | RandomState | None = None): ...
|
||||
@_dispatchable
|
||||
def tournament_matrix(G: Graph[_Node]): ...
|
||||
@_dispatchable
|
||||
def score_sequence(G: Graph[_Node]): ...
|
||||
@_dispatchable
|
||||
def is_reachable(G: Graph[_Node], s: _Node, t: _Node) -> bool: ...
|
||||
|
||||
@@ -5,9 +5,8 @@ from typing import Final
|
||||
from networkx.classes.digraph import DiGraph
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
from networkx.utils.backends import _dispatchable
|
||||
from numpy.random import RandomState
|
||||
|
||||
__all__ = ["triadic_census", "is_triad", "all_triplets", "all_triads", "triads_by_type", "triad_type", "random_triad"]
|
||||
__all__ = ["triadic_census", "is_triad", "all_triads", "triads_by_type", "triad_type"]
|
||||
|
||||
TRICODES: Final[tuple[int, ...]]
|
||||
TRIAD_NAMES: Final[tuple[str, ...]]
|
||||
@@ -18,12 +17,8 @@ def triadic_census(G: DiGraph[_Node], nodelist: Collection[_Node] | None = None)
|
||||
@_dispatchable
|
||||
def is_triad(G: Graph[_Node]) -> bool: ...
|
||||
@_dispatchable
|
||||
def all_triplets(G: DiGraph[_Node]): ...
|
||||
@_dispatchable
|
||||
def all_triads(G: DiGraph[_Node]) -> Generator[Incomplete, None, None]: ...
|
||||
@_dispatchable
|
||||
def triads_by_type(G: DiGraph[_Node]): ...
|
||||
@_dispatchable
|
||||
def triad_type(G: DiGraph[_Node]): ...
|
||||
@_dispatchable
|
||||
def random_triad(G: DiGraph[_Node], seed: int | RandomState | None = None): ...
|
||||
|
||||
@@ -81,30 +81,55 @@ def create_empty_copy(G, with_data: bool = True): ...
|
||||
|
||||
# incomplete: Can "Any scalar value" be enforced?
|
||||
@overload
|
||||
def set_node_attributes(G: Graph[Hashable], values: SupportsItems[_Node, Unused], name: str) -> None: ...
|
||||
def set_node_attributes(
|
||||
G: Graph[Hashable],
|
||||
values: SupportsItems[_Node, Unused],
|
||||
name: str,
|
||||
*,
|
||||
backend=None, # @_dispatchable adds these arguments, but we can't use this decorator with @overload
|
||||
**backend_kwargs,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def set_node_attributes(
|
||||
G: Graph[_Node],
|
||||
values: SupportsItems[_Node, SupportsKeysAndGetItem[Incomplete, Incomplete] | Iterable[tuple[Incomplete, Incomplete]]],
|
||||
name: None = None,
|
||||
*,
|
||||
backend=None,
|
||||
**backend_kwargs,
|
||||
) -> None: ...
|
||||
@_dispatchable
|
||||
def get_node_attributes(G: Graph[_Node], name: str, default=None) -> dict[_Node, Incomplete]: ...
|
||||
@_dispatchable
|
||||
def remove_node_attributes(G, *attr_names, nbunch=None) -> None: ...
|
||||
@overload
|
||||
def set_edge_attributes(G: Graph[_Node], values: SupportsItems[tuple[_Node, _Node], Incomplete], name: str) -> None: ...
|
||||
def set_edge_attributes(
|
||||
G: Graph[_Node],
|
||||
values: SupportsItems[tuple[_Node, _Node], Incomplete],
|
||||
name: str,
|
||||
*,
|
||||
backend=None, # @_dispatchable adds these arguments, but we can't use this decorator with @overload
|
||||
**backend_kwargs,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def set_edge_attributes(G: MultiGraph[_Node], values: dict[tuple[_Node, _Node, Incomplete], Incomplete], name: str) -> None: ...
|
||||
def set_edge_attributes(
|
||||
G: MultiGraph[_Node], values: dict[tuple[_Node, _Node, Incomplete], Incomplete], name: str, *, backend=None, **backend_kwargs
|
||||
) -> None: ...
|
||||
@overload
|
||||
def set_edge_attributes(G: Graph[Hashable], values, name: None = None) -> None: ...
|
||||
def set_edge_attributes(G: Graph[Hashable], values, name: None = None, *, backend=None, **backend_kwargs) -> None: ...
|
||||
@_dispatchable
|
||||
def get_edge_attributes(G: Graph[_Node], name: str, default=None) -> dict[tuple[_Node, _Node], Incomplete]: ...
|
||||
@_dispatchable
|
||||
def remove_edge_attributes(G, *attr_names, ebunch=None) -> None: ...
|
||||
def all_neighbors(graph: Graph[_Node], node: _Node) -> Iterator[_Node]: ...
|
||||
def non_neighbors(graph: Graph[_Node], node: _Node) -> Generator[_Node, None, None]: ...
|
||||
def non_edges(graph: Graph[_Node]) -> Generator[tuple[_Node, _Node], None, None]: ...
|
||||
def common_neighbors(G: Graph[_Node], u: _Node, v: _Node) -> Generator[_Node, None, None]: ...
|
||||
@_dispatchable
|
||||
def is_weighted(G: Graph[_Node], edge: tuple[_Node, _Node] | None = None, weight: str = "weight") -> bool: ...
|
||||
@_dispatchable
|
||||
def is_negatively_weighted(G: Graph[_Node], edge: tuple[_Node, _Node] | None = None, weight: str = "weight") -> bool: ...
|
||||
@_dispatchable
|
||||
def is_empty(G: Graph[Hashable]) -> bool: ...
|
||||
def nodes_with_selfloops(G: Graph[_Node]) -> Generator[_Node, None, None]: ...
|
||||
@overload
|
||||
@@ -135,6 +160,7 @@ def selfloop_edges(
|
||||
def selfloop_edges(
|
||||
G: Graph[_Node], data: str, keys: Literal[True], default: _U | None = None
|
||||
) -> Generator[tuple[_Node, _Node, int, _U], None, None]: ...
|
||||
@_dispatchable
|
||||
def number_of_selfloops(G: Graph[Hashable]) -> int: ...
|
||||
def is_path(G: Graph[_Node], path: Iterable[Incomplete]) -> bool: ...
|
||||
def path_weight(G, path, weight) -> int: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
import numpy
|
||||
from networkx.utils.backends import _dispatchable
|
||||
from numpy.random import RandomState
|
||||
|
||||
__all__ = [
|
||||
"bipartite_layout",
|
||||
@@ -21,10 +22,18 @@ __all__ = [
|
||||
"arf_layout",
|
||||
]
|
||||
|
||||
def random_layout(G, center=None, dim: int = 2, seed=None): ...
|
||||
def circular_layout(G, scale: float = 1, center=None, dim: int = 2): ...
|
||||
def shell_layout(G, nlist=None, rotate=None, scale: float = 1, center=None, dim: int = 2): ...
|
||||
def bipartite_layout(G, nodes, align: str = "vertical", scale: float = 1, center=None, aspect_ratio: float = ...): ...
|
||||
def random_layout(G, center=None, dim: int = 2, seed: int | RandomState | None = None, store_pos_as: str | None = None): ...
|
||||
def circular_layout(G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None): ...
|
||||
def shell_layout(G, nlist=None, rotate=None, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None): ...
|
||||
def bipartite_layout(
|
||||
G,
|
||||
nodes=None,
|
||||
align: str = "vertical",
|
||||
scale: float = 1,
|
||||
center=None,
|
||||
aspect_ratio: float = ...,
|
||||
store_pos_as: str | None = None,
|
||||
): ...
|
||||
def spring_layout(
|
||||
G,
|
||||
k=None,
|
||||
@@ -36,16 +45,32 @@ def spring_layout(
|
||||
scale: float = 1,
|
||||
center=None,
|
||||
dim: int = 2,
|
||||
seed=None,
|
||||
seed: int | RandomState | None = None,
|
||||
store_pos_as: str | None = None,
|
||||
*,
|
||||
method: str = "auto",
|
||||
gravity: float = 1.0,
|
||||
): ...
|
||||
|
||||
fruchterman_reingold_layout = spring_layout
|
||||
|
||||
def kamada_kawai_layout(G, dist=None, pos=None, weight: str = "weight", scale: float = 1, center=None, dim: int = 2): ...
|
||||
def spectral_layout(G, weight: str = "weight", scale: float = 1, center=None, dim: int = 2): ...
|
||||
def planar_layout(G, scale: float = 1, center=None, dim: int = 2): ...
|
||||
def spiral_layout(G, scale: float = 1, center=None, dim: int = 2, resolution: float = 0.35, equidistant: bool = False): ...
|
||||
def multipartite_layout(G, subset_key: str = "subset", align: str = "vertical", scale: float = 1, center=None): ...
|
||||
def kamada_kawai_layout(
|
||||
G, dist=None, pos=None, weight: str = "weight", scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
|
||||
): ...
|
||||
def spectral_layout(G, weight: str = "weight", scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None): ...
|
||||
def planar_layout(G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None): ...
|
||||
def spiral_layout(
|
||||
G,
|
||||
scale: float = 1,
|
||||
center=None,
|
||||
dim: int = 2,
|
||||
resolution: float = 0.35,
|
||||
equidistant: bool = False,
|
||||
store_pos_as: str | None = None,
|
||||
): ...
|
||||
def multipartite_layout(
|
||||
G, subset_key: str = "subset", align: str = "vertical", scale: float = 1, center=None, store_pos_as: str | None = None
|
||||
): ...
|
||||
def arf_layout(
|
||||
G,
|
||||
pos=None,
|
||||
@@ -55,8 +80,10 @@ def arf_layout(
|
||||
dt: float = 0.001,
|
||||
max_iter: int = 1000,
|
||||
*,
|
||||
seed: int | numpy.random.RandomState | None = None,
|
||||
seed: int | RandomState | None = None,
|
||||
store_pos_as: str | None = None,
|
||||
): ...
|
||||
@_dispatchable
|
||||
def forceatlas2_layout(
|
||||
G,
|
||||
pos=None,
|
||||
@@ -64,7 +91,7 @@ def forceatlas2_layout(
|
||||
max_iter=100,
|
||||
jitter_tolerance=1.0,
|
||||
scaling_ratio=2.0,
|
||||
gravity=1.0,
|
||||
gravity: float = 1.0,
|
||||
distributed_action=False,
|
||||
strong_gravity=False,
|
||||
node_mass=None,
|
||||
@@ -72,9 +99,12 @@ def forceatlas2_layout(
|
||||
weight=None,
|
||||
dissuade_hubs=False,
|
||||
linlog=False,
|
||||
seed=None,
|
||||
dim=2,
|
||||
seed: int | RandomState | None = None,
|
||||
dim: int = 2,
|
||||
store_pos_as: str | None = None,
|
||||
) -> dict[Incomplete, Incomplete]: ...
|
||||
def rescale_layout(pos, scale: float = 1): ...
|
||||
def rescale_layout_dict(pos, scale: float = 1): ...
|
||||
def bfs_layout(G, start, *, align="vertical", scale=1, center=None) -> dict[Incomplete, Incomplete]: ...
|
||||
def bfs_layout(
|
||||
G, start, *, align="vertical", scale=1, center=None, store_pos_as: str | None = None
|
||||
) -> dict[Incomplete, Incomplete]: ...
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Collection, Iterable, Sequence
|
||||
|
||||
from networkx.classes.graph import Graph, _Node
|
||||
|
||||
__all__ = [
|
||||
"display",
|
||||
"apply_matplotlib_colors",
|
||||
"draw",
|
||||
"draw_networkx",
|
||||
"draw_networkx_nodes",
|
||||
"draw_networkx_edges",
|
||||
"draw_networkx_labels",
|
||||
"draw_networkx_edge_labels",
|
||||
"draw_bipartite",
|
||||
"draw_circular",
|
||||
"draw_kamada_kawai",
|
||||
"draw_random",
|
||||
@@ -18,10 +23,39 @@ __all__ = [
|
||||
"draw_forceatlas2",
|
||||
]
|
||||
|
||||
def draw(G, pos=None, ax=None, **kwds) -> None: ...
|
||||
def draw_networkx(G, pos=None, arrows=None, with_labels: bool = True, **kwds) -> None: ...
|
||||
def apply_matplotlib_colors(
|
||||
G: Graph[_Node], src_attr: str, dest_attr: str, map, vmin: float | None = None, vmax: float | None = None, nodes: bool = True
|
||||
) -> None: ...
|
||||
def display(
|
||||
G: Graph[_Node],
|
||||
canvas=None,
|
||||
*,
|
||||
pos=...,
|
||||
node_visible: str | bool = ...,
|
||||
node_color: str = ...,
|
||||
node_size: str | float = ...,
|
||||
node_label: str | bool = ...,
|
||||
node_shape: str = ...,
|
||||
node_alpha: str = ...,
|
||||
node_border_width: str = ...,
|
||||
node_border_color: str = ...,
|
||||
edge_visible: str | bool = ...,
|
||||
edge_width: str | int = ...,
|
||||
edge_color=...,
|
||||
edge_label: str = ...,
|
||||
edge_style: str = ...,
|
||||
edge_alpha: str | float = ...,
|
||||
arrowstyle: str = ...,
|
||||
arrowsize: str | int = ...,
|
||||
edge_curvature: str = ...,
|
||||
edge_source_margin: str | int = ...,
|
||||
edge_target_margin: str | int = ...,
|
||||
hide_ticks: bool = True,
|
||||
): ...
|
||||
def draw(G: Graph[_Node], pos=None, ax=None, **kwds) -> None: ...
|
||||
def draw_networkx(G: Graph[_Node], pos=None, arrows=None, with_labels: bool = True, **kwds) -> None: ...
|
||||
def draw_networkx_nodes(
|
||||
G,
|
||||
G: Graph[_Node],
|
||||
pos,
|
||||
nodelist: Collection[Incomplete] | None = None,
|
||||
node_size: Incomplete | int = 300,
|
||||
@@ -39,7 +73,7 @@ def draw_networkx_nodes(
|
||||
hide_ticks: bool = True,
|
||||
): ...
|
||||
def draw_networkx_edges(
|
||||
G,
|
||||
G: Graph[_Node],
|
||||
pos,
|
||||
edgelist=None,
|
||||
width: float = 1.0,
|
||||
@@ -63,7 +97,7 @@ def draw_networkx_edges(
|
||||
hide_ticks: bool = True,
|
||||
): ...
|
||||
def draw_networkx_labels(
|
||||
G,
|
||||
G: Graph[_Node],
|
||||
pos,
|
||||
labels=None,
|
||||
font_size: int = 12,
|
||||
@@ -79,7 +113,7 @@ def draw_networkx_labels(
|
||||
hide_ticks: bool = True,
|
||||
): ...
|
||||
def draw_networkx_edge_labels(
|
||||
G,
|
||||
G: Graph[_Node],
|
||||
pos,
|
||||
edge_labels=None,
|
||||
label_pos: float = 0.5,
|
||||
@@ -99,14 +133,15 @@ def draw_networkx_edge_labels(
|
||||
connectionstyle: str = "arc3",
|
||||
hide_ticks: bool = True,
|
||||
): ...
|
||||
def draw_circular(G, **kwargs) -> None: ...
|
||||
def draw_kamada_kawai(G, **kwargs) -> None: ...
|
||||
def draw_random(G, **kwargs) -> None: ...
|
||||
def draw_spectral(G, **kwargs) -> None: ...
|
||||
def draw_spring(G, **kwargs) -> None: ...
|
||||
def draw_shell(G, nlist=None, **kwargs) -> None: ...
|
||||
def draw_planar(G, **kwargs) -> None: ...
|
||||
def draw_forceatlas2(G, **kwargs) -> None: ...
|
||||
def draw_bipartite(G: Graph[_Node], **kwargs): ...
|
||||
def draw_circular(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_kamada_kawai(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_random(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_spectral(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_spring(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_shell(G: Graph[_Node], nlist=None, **kwargs) -> None: ...
|
||||
def draw_planar(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def draw_forceatlas2(G: Graph[_Node], **kwargs) -> None: ...
|
||||
def apply_alpha(
|
||||
colors, alpha: float | Iterable[float], elem_list, cmap=None, vmin: float | None = None, vmax: float | None = None
|
||||
): ...
|
||||
|
||||
@@ -6,6 +6,6 @@ from networkx.utils.backends import _dispatchable
|
||||
__all__ = ["nonisomorphic_trees", "number_of_nonisomorphic_trees"]
|
||||
|
||||
@_dispatchable
|
||||
def nonisomorphic_trees(order, create: str = "graph") -> Generator[Incomplete, None, None]: ...
|
||||
def nonisomorphic_trees(order) -> Generator[list[Incomplete]]: ...
|
||||
@_dispatchable
|
||||
def number_of_nonisomorphic_trees(order): ...
|
||||
|
||||
@@ -6,7 +6,6 @@ from networkx.utils.backends import _dispatchable
|
||||
__all__ = [
|
||||
"laplacian_matrix",
|
||||
"normalized_laplacian_matrix",
|
||||
"total_spanning_tree_weight",
|
||||
"directed_laplacian_matrix",
|
||||
"directed_combinatorial_laplacian_matrix",
|
||||
]
|
||||
@@ -16,8 +15,6 @@ def laplacian_matrix(G, nodelist: Collection[Incomplete] | None = None, weight:
|
||||
@_dispatchable
|
||||
def normalized_laplacian_matrix(G, nodelist: Collection[Incomplete] | None = None, weight: str = "weight"): ...
|
||||
@_dispatchable
|
||||
def total_spanning_tree_weight(G, weight=None): ...
|
||||
@_dispatchable
|
||||
def directed_laplacian_matrix(
|
||||
G, nodelist: Collection[Incomplete] | None = None, weight: str = "weight", walk_type=None, alpha: float = 0.95
|
||||
): ...
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing import Any, Final, Generic, TypeVar, overload
|
||||
from typing_extensions import ParamSpec, Self
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
__all__ = ["_dispatchable"]
|
||||
FAILED_TO_CONVERT: Final[str]
|
||||
|
||||
class _dispatchable(Generic[_P, _R]):
|
||||
__defaults__: Incomplete
|
||||
@@ -41,6 +42,7 @@ class _dispatchable(Generic[_P, _R]):
|
||||
preserve_all_attrs: bool = False,
|
||||
mutates_input: bool = False,
|
||||
returns_graph: bool = False,
|
||||
implemented_by_nx: bool = True,
|
||||
) -> Self: ...
|
||||
@property
|
||||
def __doc__(self): ...
|
||||
@@ -60,5 +62,4 @@ class _dispatchable(Generic[_P, _R]):
|
||||
# def __call__(self, *args: _P.args, backend: None = None, **kwargs: _P.kwargs) -> _R: ...
|
||||
# @overload
|
||||
# def __call__(self, *args: _P.args, backend: str, **kwargs: _P.kwargs, **backend_kwargs: Any) -> _R: ...
|
||||
|
||||
def __reduce__(self): ...
|
||||
|
||||
Reference in New Issue
Block a user