networkx: All return types from python-type-stubs (#14256)

This commit is contained in:
Avasam
2025-07-08 19:05:27 +02:00
committed by GitHub
parent 0ad1d96f2c
commit 07a59e924f
116 changed files with 407 additions and 243 deletions
@@ -1,12 +1,14 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["clique_removal", "max_clique", "large_clique_size", "maximum_independent_set"]
@_dispatchable
def maximum_independent_set(G: Graph[_Node]): ...
def maximum_independent_set(G: Graph[_Node]) -> set[Incomplete]: ...
@_dispatchable
def max_clique(G: Graph[_Node]): ...
def max_clique(G: Graph[_Node]) -> set[Incomplete]: ...
@_dispatchable
def clique_removal(G: Graph[_Node]): ...
@_dispatchable
@@ -5,4 +5,4 @@ from numpy.random import RandomState
__all__ = ["average_clustering"]
@_dispatchable
def average_clustering(G: Graph[_Node], trials: int = 1000, seed: int | RandomState | None = None): ...
def average_clustering(G: Graph[_Node], trials: int = 1000, seed: int | RandomState | None = None) -> float: ...
@@ -11,4 +11,6 @@ def local_node_connectivity(G: Graph[_Node], source: _Node, target: _Node, cutof
@_dispatchable
def node_connectivity(G: Graph[_Node], s: _Node | None = None, t: _Node | None = None): ...
@_dispatchable
def all_pairs_node_connectivity(G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, cutoff: int | None = None): ...
def all_pairs_node_connectivity(
G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, cutoff: int | None = None
) -> dict[Incomplete, dict[Incomplete, Incomplete]]: ...
@@ -1,9 +1,11 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]
@_dispatchable
def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None): ...
def min_weighted_dominating_set(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ...
@_dispatchable
def min_edge_dominating_set(G: Graph[_Node]): ...
def min_edge_dominating_set(G: Graph[_Node]) -> set[Incomplete]: ...
@@ -1,7 +1,10 @@
from _typeshed import Incomplete
from collections import defaultdict
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["k_components"]
@_dispatchable
def k_components(G: Graph[_Node], min_density: float = 0.95): ...
def k_components(G: Graph[_Node], min_density: float = 0.95) -> defaultdict[Incomplete, list[Incomplete]]: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["min_maximal_matching"]
@_dispatchable
def min_maximal_matching(G: Graph[_Node]): ...
def min_maximal_matching(G: Graph[_Node]) -> set[Incomplete]: ...
@@ -21,7 +21,7 @@ _SupportsLenAndGetItemT = TypeVar("_SupportsLenAndGetItemT", bound=SupportsLenAn
def swap_two_nodes(soln: _SupportsLenAndGetItemT, seed) -> _SupportsLenAndGetItemT: ...
def move_one_node(soln: _SupportsLenAndGetItemT, seed) -> _SupportsLenAndGetItemT: ...
@_dispatchable
def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None): ...
def christofides(G: Graph[_Node], weight: str | None = "weight", tree: Graph[_Node] | None = None) -> list[Incomplete]: ...
@_dispatchable
def traveling_salesman_problem(
G: Graph[_Node],
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["min_weighted_vertex_cover"]
@_dispatchable
def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None): ...
def min_weighted_vertex_cover(G: Graph[_Node], weight: str | None = None) -> set[Incomplete]: ...
@@ -9,4 +9,4 @@ __all__ = ["average_degree_connectivity"]
@_dispatchable
def average_degree_connectivity(
G: Graph[_Node], source="in+out", target="in+out", nodes: Iterable[Incomplete] | None = None, weight: str | None = None
): ...
) -> dict[Incomplete, int | float]: ...
@@ -14,12 +14,12 @@ __all__ = [
@_dispatchable
def degree_assortativity_coefficient(
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None
): ...
) -> float: ...
@_dispatchable
def degree_pearson_correlation_coefficient(
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes: Iterable[Incomplete] | None = None
): ...
) -> float: ...
@_dispatchable
def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ...
def attribute_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...
@_dispatchable
def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None): ...
def numeric_assortativity_coefficient(G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None) -> float: ...
@@ -9,7 +9,7 @@ __all__ = ["attribute_mixing_matrix", "attribute_mixing_dict", "degree_mixing_ma
@_dispatchable
def attribute_mixing_dict(
G: Graph[_Node], attribute: str, nodes: Iterable[Incomplete] | None = None, normalized: bool = False
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def attribute_mixing_matrix(
G: Graph[_Node],
@@ -21,7 +21,7 @@ def attribute_mixing_matrix(
@_dispatchable
def degree_mixing_dict(
G: Graph[_Node], x: str = "out", y: str = "in", weight: str | None = None, nodes=None, normalized: bool = False
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def degree_mixing_matrix(
G: Graph[_Node],
@@ -33,4 +33,4 @@ def degree_mixing_matrix(
mapping: SupportsGetItem[Incomplete, Incomplete] | None = None,
): ...
@_dispatchable
def mixing_dict(xy, normalized: bool = False): ...
def mixing_dict(xy, normalized: bool = False) -> dict[Incomplete, Incomplete]: ...
@@ -13,4 +13,4 @@ def average_neighbor_degree(
target: str | None = "out",
nodes: Iterable[Incomplete] | None = None,
weight: str | None = None,
): ...
) -> dict[Incomplete, Incomplete]: ...
@@ -6,7 +6,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["is_at_free", "find_asteroidal_triple"]
@_dispatchable
def find_asteroidal_triple(G: Graph[_Node]): ...
def find_asteroidal_triple(G: Graph[_Node]) -> list[Incomplete] | None: ...
@_dispatchable
def is_at_free(G: Graph[_Node]) -> bool: ...
@_dispatchable
@@ -7,14 +7,14 @@ from networkx.utils.backends import _dispatchable
__all__ = ["is_bipartite", "is_bipartite_node_set", "color", "sets", "density", "degrees"]
@_dispatchable
def color(G: Graph[_Node]): ...
def color(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def is_bipartite(G: Graph[_Node]) -> bool: ...
@_dispatchable
def is_bipartite_node_set(G: Graph[_Node], nodes: Iterable[Incomplete]) -> bool: ...
@_dispatchable
def sets(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None): ...
def sets(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None) -> tuple[set[Incomplete], set[Incomplete]]: ...
@_dispatchable
def density(B: Graph[_Node], nodes): ...
def density(B: Graph[_Node], nodes) -> float: ...
@_dispatchable
def degrees(B: Graph[_Node], nodes, weight: str | None = None): ...
def degrees(B: Graph[_Node], nodes, weight: str | None = None) -> tuple[Incomplete, Incomplete]: ...
@@ -1,11 +1,13 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["degree_centrality", "betweenness_centrality", "closeness_centrality"]
@_dispatchable
def degree_centrality(G: Graph[_Node], nodes): ...
def degree_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def betweenness_centrality(G: Graph[_Node], nodes): ...
def betweenness_centrality(G: Graph[_Node], nodes) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True): ...
def closeness_centrality(G: Graph[_Node], nodes, normalized: bool | None = True) -> dict[Incomplete, Incomplete]: ...
@@ -13,11 +13,13 @@ def cc_min(nu, nv) -> float: ...
modes: dict[str, Callable[[Incomplete, Incomplete], float]]
@_dispatchable
def latapy_clustering(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot"): ...
def latapy_clustering(
G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot"
) -> dict[Incomplete, Incomplete]: ...
clustering = latapy_clustering
@_dispatchable
def average_clustering(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot"): ...
def average_clustering(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, mode: str = "dot") -> float: ...
@_dispatchable
def robins_alexander_clustering(G: Graph[_Node]): ...
def robins_alexander_clustering(G: Graph[_Node]) -> float: ...
@@ -7,4 +7,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["min_edge_cover"]
@_dispatchable
def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None): ...
def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None) -> set[Incomplete]: ...
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from collections.abc import Generator
from networkx.classes.graph import Graph, _Node
@@ -9,7 +8,7 @@ __all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgeli
@_dispatchable
def write_edgelist(G, path, comments: str = "#", delimiter: str = " ", data: bool = True, encoding: str = "utf-8") -> None: ...
@_dispatchable
def generate_edgelist(G, delimiter: str = " ", data: bool = True) -> Generator[Incomplete, None, None]: ...
def generate_edgelist(G, delimiter: str = " ", data: bool = True) -> Generator[str]: ...
@_dispatchable
def parse_edgelist(
lines,
@@ -7,9 +7,9 @@ from networkx.utils.backends import _dispatchable
__all__ = ["maximum_matching", "hopcroft_karp_matching", "eppstein_matching", "to_vertex_cover", "minimum_weight_full_matching"]
@_dispatchable
def hopcroft_karp_matching(G: Graph[_Node], top_nodes: Iterable[_Node] | None = None): ...
def hopcroft_karp_matching(G: Graph[_Node], top_nodes: Iterable[_Node] | None = None) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def eppstein_matching(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None): ...
def eppstein_matching(G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def to_vertex_cover(
G: Graph[_Node], matching: SupportsGetItem[Incomplete, Incomplete], top_nodes: Iterable[Incomplete] | None = None
@@ -20,4 +20,4 @@ maximum_matching = hopcroft_karp_matching
@_dispatchable
def minimum_weight_full_matching(
G: Graph[_Node], top_nodes: Iterable[Incomplete] | None = None, weight: str | None = "weight"
): ...
) -> dict[Incomplete, Incomplete]: ...
@@ -14,6 +14,6 @@ def biadjacency_matrix(
dtype=None,
weight: str | None = "weight",
format="csr",
): ...
): ... # Return is a complex union of scipy classes depending on the format param
@_dispatchable
def from_biadjacency_matrix(A, create_using: Graph[_Node] | None = None, edge_attribute: str = "weight"): ...
@@ -7,4 +7,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["node_redundancy"]
@_dispatchable
def node_redundancy(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None): ...
def node_redundancy(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None) -> dict[Incomplete, float]: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["spectral_bipartivity"]
@_dispatchable
def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight"): ...
def spectral_bipartivity(G: Graph[_Node], nodes=None, weight: str = "weight") -> float | dict[Incomplete, Incomplete]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -18,12 +20,12 @@ def approximate_current_flow_betweenness_centrality(
epsilon: float = 0.5,
kmax: int = 10000,
seed: int | RandomState | None = None,
): ...
) -> dict[Incomplete, float]: ...
@_dispatchable
def current_flow_betweenness_centrality(
G: Graph[_Node], normalized: bool | None = True, weight: str | None = None, dtype: type = ..., solver: str = "full"
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def edge_current_flow_betweenness_centrality(
G: Graph[_Node], normalized: bool | None = True, weight: str | None = None, dtype: type = ..., solver: str = "full"
): ...
) -> dict[tuple[Incomplete, Incomplete], float]: ...
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
@@ -14,7 +15,7 @@ def current_flow_betweenness_centrality_subset(
weight: str | None = None,
dtype: type = ...,
solver: str = "lu",
): ...
) -> dict[Incomplete, float]: ...
@_dispatchable
def edge_current_flow_betweenness_centrality_subset(
G: Graph[_Node],
@@ -24,4 +25,4 @@ def edge_current_flow_betweenness_centrality_subset(
weight: str | None = None,
dtype: type = ...,
solver: str = "lu",
): ...
) -> dict[tuple[Incomplete, Incomplete], float]: ...
@@ -1,9 +1,13 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["current_flow_closeness_centrality", "information_centrality"]
@_dispatchable
def current_flow_closeness_centrality(G: Graph[_Node], weight: str | None = None, dtype: type = ..., solver: str = "lu"): ...
def current_flow_closeness_centrality(
G: Graph[_Node], weight: str | None = None, dtype: type = ..., solver: str = "lu"
) -> dict[Incomplete, float]: ...
information_centrality = current_flow_closeness_centrality
@@ -12,8 +12,8 @@ def eigenvector_centrality(
tol: float | None = 1e-06,
nstart: SupportsGetItem[Incomplete, Incomplete] | None = None,
weight: str | None = None,
): ...
) -> dict[Incomplete, float]: ...
@_dispatchable
def eigenvector_centrality_numpy(
G: Graph[_Node], weight: str | None = None, max_iter: int | None = 50, tol: float | None = 0
): ...
) -> dict[Incomplete, Incomplete]: ...
@@ -26,12 +26,12 @@ def prominent_group(
endpoints: bool | None = False,
normalized: bool | None = True,
greedy: bool | None = False,
): ...
) -> tuple[float, list[Incomplete]]: ...
@_dispatchable
def group_closeness_centrality(G: Graph[_Node], S: Iterable[Incomplete], weight: str | None = None): ...
def group_closeness_centrality(G: Graph[_Node], S: Iterable[Incomplete], weight: str | None = None) -> float: ...
@_dispatchable
def group_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ...
def group_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]) -> float: ...
@_dispatchable
def group_in_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ...
def group_in_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]) -> float: ...
@_dispatchable
def group_out_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]): ...
def group_out_degree_centrality(G: Graph[_Node], S: Iterable[Incomplete]) -> float: ...
@@ -9,4 +9,4 @@ __all__ = ["harmonic_centrality"]
@_dispatchable
def harmonic_centrality(
G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, distance=None, sources: Iterable[Incomplete] | None = None
): ...
) -> dict[Incomplete, int]: ...
@@ -15,7 +15,7 @@ def katz_centrality(
nstart: SupportsGetItem[Incomplete, Incomplete] | None = None,
normalized: bool | None = True,
weight: str | None = None,
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def katz_centrality_numpy(
G: Graph[_Node],
@@ -23,4 +23,4 @@ def katz_centrality_numpy(
beta: float | SupportsGetItem[Incomplete, Incomplete] | None = 1.0,
normalized: bool = True,
weight: str | None = None,
): ...
) -> dict[Incomplete, Incomplete]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,7 +8,7 @@ __all__ = ["load_centrality", "edge_load_centrality"]
@_dispatchable
def newman_betweenness_centrality(
G: Graph[_Node], v=None, cutoff: bool | None = None, normalized: bool | None = True, weight: str | None = None
): ...
) -> float | dict[Incomplete, float]: ...
load_centrality = newman_betweenness_centrality
@@ -11,4 +11,4 @@ def percolation_centrality(
attribute: str | None = "percolation",
states: SupportsGetItem[Incomplete, Incomplete] | None = None,
weight: str | None = None,
): ...
) -> dict[Incomplete, float]: ...
@@ -7,7 +7,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["global_reaching_centrality", "local_reaching_centrality"]
@_dispatchable
def global_reaching_centrality(G: DiGraph[_Node], weight: str | None = None, normalized: bool | None = True): ...
def global_reaching_centrality(G: DiGraph[_Node], weight: str | None = None, normalized: bool | None = True) -> float: ...
@_dispatchable
def local_reaching_centrality(
G: DiGraph[_Node],
@@ -15,4 +15,4 @@ def local_reaching_centrality(
paths: SupportsGetItem[Incomplete, Incomplete] | None = None,
weight: str | None = None,
normalized: bool | None = True,
): ...
) -> float: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["second_order_centrality"]
@_dispatchable
def second_order_centrality(G: Graph[_Node], weight: str | None = "weight"): ...
def second_order_centrality(G: Graph[_Node], weight: str | None = "weight") -> dict[Incomplete, float]: ...
@@ -1,13 +1,15 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["subgraph_centrality_exp", "subgraph_centrality", "communicability_betweenness_centrality", "estrada_index"]
@_dispatchable
def subgraph_centrality_exp(G: Graph[_Node]): ...
def subgraph_centrality_exp(G: Graph[_Node]) -> dict[Incomplete, float]: ...
@_dispatchable
def subgraph_centrality(G: Graph[_Node]): ...
def subgraph_centrality(G: Graph[_Node]) -> dict[Incomplete, float]: ...
@_dispatchable
def communicability_betweenness_centrality(G: Graph[_Node]): ...
def communicability_betweenness_centrality(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def estrada_index(G: Graph[_Node]): ...
def estrada_index(G: Graph[_Node]) -> float: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import _Node
from networkx.utils.backends import _dispatchable
@@ -5,8 +7,8 @@ from networkx.utils.backends import _dispatchable
__all__ = ["trophic_levels", "trophic_differences", "trophic_incoherence_parameter"]
@_dispatchable
def trophic_levels(G: DiGraph[_Node], weight="weight"): ...
def trophic_levels(G: DiGraph[_Node], weight="weight") -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def trophic_differences(G: DiGraph[_Node], weight="weight"): ...
def trophic_differences(G: DiGraph[_Node], weight="weight") -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def trophic_incoherence_parameter(G: DiGraph[_Node], weight="weight", cannibalism: bool = False): ...
def trophic_incoherence_parameter(G: DiGraph[_Node], weight="weight", cannibalism: bool = False) -> float: ...
@@ -1,7 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["voterank"]
@_dispatchable
def voterank(G: Graph[_Node], number_of_nodes: int | None = None): ...
def voterank(G: Graph[_Node], number_of_nodes: int | None = None) -> list[Incomplete]: ...
@@ -36,7 +36,7 @@ def node_clique_number(
def node_clique_number(G: Graph[_Node], nodes=None, cliques: Iterable[Incomplete] | None = None, separate_nodes=False) -> int: ...
def number_of_cliques(G, nodes=None, cliques=None) -> int | dict[Incomplete, Incomplete]: ...
@_dispatchable
def max_weight_clique(G, weight="weight") -> tuple[Incomplete, Incomplete]: ...
def max_weight_clique(G, weight="weight") -> tuple[list[Incomplete], int]: ...
class MaxWeightClique:
G: Graph[Incomplete]
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
@@ -6,16 +7,16 @@ from networkx.utils.backends import _dispatchable
__all__ = ["triangles", "average_clustering", "clustering", "transitivity", "square_clustering", "generalized_degree"]
@_dispatchable
def triangles(G: Graph[_Node], nodes=None): ...
def triangles(G: Graph[_Node], nodes=None) -> int | dict[Incomplete, int]: ...
@_dispatchable
def average_clustering(
G: Graph[_Node], nodes: Iterable[_Node] | None = None, weight: str | None = None, count_zeros: bool = True
): ...
) -> float: ...
@_dispatchable
def clustering(G: Graph[_Node], nodes=None, weight: str | None = None): ...
def clustering(G: Graph[_Node], nodes=None, weight: str | None = None) -> float | int | dict[Incomplete, float | int]: ...
@_dispatchable
def transitivity(G: Graph[_Node]): ...
def transitivity(G: Graph[_Node]) -> float: ...
@_dispatchable
def square_clustering(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ...
def square_clustering(G: Graph[_Node], nodes: Iterable[_Node] | None = None) -> float | int | dict[Incomplete, float | int]: ...
@_dispatchable
def generalized_degree(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ...
@@ -1,9 +1,11 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["communicability", "communicability_exp"]
@_dispatchable
def communicability(G: Graph[_Node]): ...
def communicability(G: Graph[_Node]) -> dict[dict[Incomplete, Incomplete], dict[Incomplete, float]]: ...
@_dispatchable
def communicability_exp(G: Graph[_Node]): ...
def communicability_exp(G: Graph[_Node]) -> dict[dict[Incomplete, Incomplete], dict[Incomplete, float]]: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -5,4 +8,4 @@ from numpy.random import RandomState
__all__ = ["asyn_fluidc"]
@_dispatchable
def asyn_fluidc(G: Graph[_Node], k: int, max_iter: int = 100, seed: int | RandomState | None = None): ...
def asyn_fluidc(G: Graph[_Node], k: int, max_iter: int = 100, seed: int | RandomState | None = None) -> Iterator[Incomplete]: ...
@@ -1,3 +1,4 @@
from _collections_abc import dict_values
from _typeshed import Incomplete
from collections.abc import Generator
@@ -14,4 +15,4 @@ def asyn_lpa_communities(
G: Graph[_Node], weight: str | None = None, seed: int | RandomState | None = None
) -> Generator[Incomplete, Incomplete, None]: ...
@_dispatchable
def label_propagation_communities(G: Graph[_Node]): ...
def label_propagation_communities(G: Graph[_Node]) -> dict_values[Incomplete, set[Incomplete]]: ...
@@ -15,7 +15,7 @@ def louvain_communities(
threshold: float | None = 1e-07,
max_level: int | None = None,
seed: int | RandomState | None = None,
): ...
) -> list[set[Incomplete]]: ...
@_dispatchable
def louvain_partitions(
G: Graph[_Node],
@@ -23,4 +23,4 @@ def louvain_partitions(
resolution: float | None = 1,
threshold: float | None = 1e-07,
seed: int | RandomState | None = None,
) -> Generator[Incomplete, None, None]: ...
) -> Generator[list[set[Incomplete]], None, None]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,6 +8,6 @@ __all__ = ["greedy_modularity_communities", "naive_greedy_modularity_communities
@_dispatchable
def greedy_modularity_communities(
G: Graph[_Node], weight: str | None = None, resolution: float | None = 1, cutoff: int | None = 1, best_n: int | None = None
): ...
) -> list[set[Incomplete]] | list[frozenset[Incomplete]]: ...
@_dispatchable
def naive_greedy_modularity_communities(G: Graph[_Node], resolution: float = 1, weight: str | None = None): ...
@@ -11,6 +11,6 @@ __all__ = ["number_attracting_components", "attracting_components", "is_attracti
@_dispatchable
def attracting_components(G) -> Generator[Incomplete, None, None]: ...
@_dispatchable
def number_attracting_components(G): ...
def number_attracting_components(G) -> int: ...
@_dispatchable
def is_attracting_component(G: DiGraph[_Node] | MultiDiGraph[_Node]) -> bool: ...
@@ -13,4 +13,4 @@ def number_connected_components(G: Graph[_Node]): ...
@_dispatchable
def is_connected(G: Graph[_Node]) -> bool: ...
@_dispatchable
def node_connected_component(G: Graph[_Node], n: _Node): ...
def node_connected_component(G: Graph[_Node], n: _Node) -> set[Incomplete]: ...
@@ -31,11 +31,11 @@ def node_connectivity(
G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None
): ...
@_dispatchable
def average_node_connectivity(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None): ...
def average_node_connectivity(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None) -> float: ...
@_dispatchable
def all_pairs_node_connectivity(
G: Graph[_Node], nbunch: Iterable[Incomplete] | None = None, flow_func: Callable[..., Incomplete] | None = None
): ...
) -> dict[Incomplete, dict[Incomplete, Incomplete]]: ...
@_dispatchable
def local_edge_connectivity(
G: Graph[_Node],
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing_extensions import Never
from networkx.algorithms.flow import edmonds_karp
from networkx.classes.digraph import DiGraph
@@ -17,7 +18,7 @@ def minimum_st_edge_cut(
flow_func: Callable[..., Incomplete] | None = None,
auxiliary: DiGraph[_Node] | None = None,
residual: DiGraph[_Node] | None = None,
): ...
) -> set[tuple[Incomplete, Incomplete]]: ...
@_dispatchable
def minimum_st_node_cut(
G: Graph[_Node],
@@ -26,12 +27,12 @@ def minimum_st_node_cut(
flow_func: Callable[..., Incomplete] | None = None,
auxiliary: DiGraph[_Node] | None = None,
residual: DiGraph[_Node] | None = None,
): ...
) -> dict[Never, Never] | set[Incomplete]: ...
@_dispatchable
def minimum_node_cut(
G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None
): ...
) -> dict[Never, Never] | set[Incomplete]: ...
@_dispatchable
def minimum_edge_cut(
G: Graph[_Node], s: _Node | None = None, t: _Node | None = None, flow_func: Callable[..., Incomplete] | None = None
): ...
) -> set[Incomplete]: ...
@@ -9,5 +9,5 @@ __all__ = ["k_components"]
default_flow_func = edmonds_karp
@_dispatchable
def k_components(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None): ...
def k_components(G: Graph[_Node], flow_func: Callable[..., Incomplete] | None = None) -> dict[Incomplete, Incomplete]: ...
def build_k_number_dict(kcomps) -> dict[Incomplete, Incomplete]: ...
+2 -2
View File
@@ -6,7 +6,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["core_number", "k_core", "k_shell", "k_crust", "k_corona", "k_truss", "onion_layers"]
@_dispatchable
def core_number(G: Graph[_Node]): ...
def core_number(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def k_core(G: Graph[_Node], k: int | None = None, core_number: SupportsGetItem[Incomplete, Incomplete] | None = None): ...
@_dispatchable
@@ -18,4 +18,4 @@ def k_corona(G: Graph[_Node], k: int, core_number: SupportsGetItem[Incomplete, I
@_dispatchable
def k_truss(G: Graph[_Node], k: int): ...
@_dispatchable
def onion_layers(G: Graph[_Node]): ...
def onion_layers(G: Graph[_Node]) -> dict[Incomplete, Incomplete]: ...
@@ -7,6 +7,6 @@ from networkx.utils.backends import _dispatchable
__all__ = ["min_edge_cover", "is_edge_cover"]
@_dispatchable
def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None): ...
def min_edge_cover(G: Graph[_Node], matching_algorithm: Callable[..., Incomplete] | None = None) -> set[Incomplete]: ...
@_dispatchable
def is_edge_cover(G: Graph[_Node], cover: Iterable[Iterable[Incomplete]]) -> bool: ...
+1 -1
View File
@@ -60,6 +60,6 @@ def dag_longest_path(
@_dispatchable
def dag_longest_path_length(G: DiGraph[_Node], weight: str | None = "weight", default_weight: int | None = 1) -> int: ...
@_dispatchable
def dag_to_branching(G: Graph[_Node]) -> Graph[_Node]: ...
def dag_to_branching(G: Graph[_Node]) -> DiGraph[_Node]: ...
@_dispatchable
def compute_v_structures(G) -> Generator[tuple[Incomplete, Incomplete, Incomplete]]: ...
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing_extensions import TypeAlias
@@ -20,21 +21,27 @@ __all__ = [
]
@_dispatchable
def eccentricity(G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | _WeightFunction | None = None): ...
def eccentricity(
G: Graph[_Node], v: _Node | None = None, sp=None, weight: str | _WeightFunction | None = None
) -> Incomplete | dict[Incomplete, Incomplete]: ...
@_dispatchable
def diameter(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
@_dispatchable
def harmonic_diameter(G, sp=None, *, weight: str | _WeightFunction | None = None) -> float: ...
@_dispatchable
def periphery(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
def periphery(
G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None
) -> list[Incomplete]: ...
@_dispatchable
def radius(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
@_dispatchable
def center(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None): ...
def center(G: Graph[_Node], e=None, usebounds: bool = False, weight: str | _WeightFunction | None = None) -> list[Incomplete]: ...
@_dispatchable
def barycenter(G, weight: str | _WeightFunction | None = None, attr=None, sp=None): ...
def barycenter(G, weight: str | _WeightFunction | None = None, attr=None, sp=None) -> list[Incomplete]: ...
@_dispatchable
def resistance_distance(G: Graph[_Node], nodeA=None, nodeB=None, weight: str | None = None, invert_weight: bool = True): ...
def resistance_distance(
G: Graph[_Node], nodeA=None, nodeB=None, weight: str | None = None, invert_weight: bool = True
) -> float | dict[Incomplete, float]: ...
@_dispatchable
def effective_graph_resistance(G, weight: str | None = None, invert_weight: bool = True) -> float: ...
@_dispatchable
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Generator
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,7 +9,7 @@ __all__ = ["is_distance_regular", "is_strongly_regular", "intersection_array", "
@_dispatchable
def is_distance_regular(G: Graph[_Node]) -> bool: ...
@_dispatchable
def global_parameters(b, c): ...
def global_parameters(b, c) -> Generator[tuple[Incomplete, Incomplete, Incomplete]]: ...
@_dispatchable
def intersection_array(G: Graph[_Node]): ...
@_dispatchable
@@ -4,8 +4,8 @@ from networkx.utils.backends import _dispatchable
__all__ = ["efficiency", "local_efficiency", "global_efficiency"]
@_dispatchable
def efficiency(G, u: _Node, v: _Node): ...
def efficiency(G, u: _Node, v: _Node) -> float: ...
@_dispatchable
def global_efficiency(G): ...
def global_efficiency(G) -> float: ...
@_dispatchable
def local_efficiency(G): ...
def local_efficiency(G) -> float: ...
@@ -8,8 +8,12 @@ __all__ = ["min_cost_flow_cost", "min_cost_flow", "cost_of_flow", "max_flow_min_
@_dispatchable
def min_cost_flow_cost(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ...
@_dispatchable
def min_cost_flow(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ...
def min_cost_flow(
G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"
) -> tuple[int | Incomplete, dict[Incomplete, dict[Incomplete, Incomplete]]]: ...
@_dispatchable
def cost_of_flow(G: Graph[_Node], flowDict: SupportsGetItem[Incomplete, Incomplete], weight: str = "weight"): ...
@_dispatchable
def max_flow_min_cost(G: Graph[_Node], s: str, t: str, capacity: str = "capacity", weight: str = "weight"): ...
def max_flow_min_cost(
G: Graph[_Node], s: str, t: str, capacity: str = "capacity", weight: str = "weight"
) -> tuple[int | Incomplete, dict[Incomplete, dict[Incomplete, Incomplete]]]: ...
@@ -43,4 +43,6 @@ class _DataEssentialsAndFunctions:
def find_leaving_edge(self, Wn, We): ...
@_dispatchable
def network_simplex(G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"): ...
def network_simplex(
G: Graph[_Node], demand: str = "demand", capacity: str = "capacity", weight: str = "weight"
) -> tuple[int | Incomplete, dict[Incomplete, dict[Incomplete, Incomplete]]]: ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -10,7 +12,7 @@ def weisfeiler_lehman_graph_hash(
node_attr: str | None = None,
iterations: int | None = 3,
digest_size: int | None = 16,
): ...
) -> str: ...
@_dispatchable
def weisfeiler_lehman_subgraph_hashes(
G: Graph[_Node],
@@ -19,4 +21,4 @@ def weisfeiler_lehman_subgraph_hashes(
iterations: int | None = 3,
digest_size: int | None = 16,
include_initial_labels: bool | None = False,
): ...
) -> dict[Incomplete, list[str]]: ...
@@ -3,4 +3,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["flow_hierarchy"]
@_dispatchable
def flow_hierarchy(G, weight: str | None = None): ...
def flow_hierarchy(G, weight: str | None = None) -> float: ...
@@ -8,4 +8,4 @@ def is_isolate(G: Graph[_Node], n: _Node) -> bool: ...
@_dispatchable
def isolates(G: Graph[_Node]): ...
@_dispatchable
def number_of_isolates(G: Graph[_Node]): ...
def number_of_isolates(G: Graph[_Node]) -> int: ...
@@ -14,6 +14,6 @@ class ISMAGS:
def largest_common_subgraph(self, symmetry: bool = True) -> Generator[Incomplete, Incomplete, None]: ...
def analyze_symmetry(self, graph, node_partitions, edge_colors): ...
def is_isomorphic(self, symmetry: bool = False) -> bool: ...
def subgraph_is_isomorphic(self, symmetry: bool = False): ...
def subgraph_is_isomorphic(self, symmetry: bool = False) -> bool: ...
def isomorphisms_iter(self, symmetry: bool = True) -> Generator[Incomplete, Incomplete, None]: ...
def subgraph_isomorphisms_iter(self, symmetry: bool = True): ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -6,6 +8,6 @@ __all__ = ["rooted_tree_isomorphism", "tree_isomorphism"]
@_dispatchable
def root_trees(t1, root1, t2, root2): ...
@_dispatchable
def rooted_tree_isomorphism(t1, root1, t2, root2): ...
def rooted_tree_isomorphism(t1, root1, t2, root2) -> list[tuple[Incomplete, Incomplete]]: ...
@_dispatchable
def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]): ...
def tree_isomorphism(t1: Graph[_Node], t2: Graph[_Node]) -> list[tuple[Incomplete, Incomplete]]: ...
@@ -16,7 +16,7 @@ def pagerank(
nstart: SupportsGetItem[Incomplete, Incomplete] | None = None,
weight: str | None = "weight",
dangling: SupportsGetItem[Incomplete, Incomplete] | None = None,
): ...
) -> dict[Incomplete, float]: ...
@_dispatchable
def google_matrix(
G: Graph[_Node],
@@ -14,7 +14,7 @@ __all__ = [
]
@_dispatchable
def maximal_matching(G: Graph[_Node]): ...
def maximal_matching(G: Graph[_Node]) -> set[Incomplete]: ...
def matching_dict_to_set(matching: Mapping[Incomplete, Incomplete]) -> set[Incomplete]: ...
@_dispatchable
def is_matching(G: Graph[_Node], matching: dict[Incomplete, Incomplete] | Iterable[Iterable[Incomplete]]) -> bool: ...
@@ -23,6 +23,8 @@ def is_maximal_matching(G: Graph[_Node], matching: dict[Incomplete, Incomplete]
@_dispatchable
def is_perfect_matching(G: Graph[_Node], matching: dict[Incomplete, Incomplete] | Iterable[Iterable[Incomplete]]) -> bool: ...
@_dispatchable
def min_weight_matching(G: Graph[_Node], weight: str | None = "weight"): ...
def min_weight_matching(G: Graph[_Node], weight: str | None = "weight") -> set[Incomplete]: ...
@_dispatchable
def max_weight_matching(G: Graph[_Node], maxcardinality: bool | None = False, weight: str | None = "weight"): ...
def max_weight_matching(
G: Graph[_Node], maxcardinality: bool | None = False, weight: str | None = "weight"
) -> set[Incomplete]: ...
+1 -1
View File
@@ -10,4 +10,4 @@ __all__ = ["maximal_independent_set"]
@_dispatchable
def maximal_independent_set(
G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, seed: int | RandomState | None = None
): ...
) -> list[Incomplete]: ...
@@ -6,7 +6,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["combinatorial_embedding_to_pos"]
@_dispatchable
def combinatorial_embedding_to_pos(embedding, fully_triangulate: bool = False): ...
def combinatorial_embedding_to_pos(embedding, fully_triangulate: bool = False) -> dict[Incomplete, Incomplete]: ...
def set_position(parent, tree, remaining_nodes, delta_x, y_coordinate, pos): ...
def get_canonical_ordering(embedding, outer_face: Sequence[Incomplete]) -> list[Incomplete]: ...
def triangulate_face(embedding, v1, v2): ...
@@ -54,7 +54,7 @@ class LRPlanarity:
embedding: Incomplete
def __init__(self, G) -> None: ...
def lr_planarity(self): ...
def lr_planarity(self) -> PlanarEmbedding[Incomplete] | None: ...
def lr_planarity_recursive(self): ...
def dfs_orientation(self, v): ...
def dfs_orientation_recursive(self, v) -> None: ...
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from networkx.classes.graph import Graph, _Node
@@ -6,6 +7,6 @@ from networkx.utils.backends import _dispatchable
__all__ = ["reciprocity", "overall_reciprocity"]
@_dispatchable
def reciprocity(G: Graph[_Node], nodes: Iterable[_Node] | None = None): ...
def reciprocity(G: Graph[_Node], nodes: Iterable[_Node] | None = None) -> float | dict[Incomplete, float | None]: ...
@_dispatchable
def overall_reciprocity(G: Graph[_Node]): ...
@@ -1,3 +1,5 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -5,4 +7,6 @@ from numpy.random import RandomState
__all__ = ["rich_club_coefficient"]
@_dispatchable
def rich_club_coefficient(G: Graph[_Node], normalized: bool = True, Q: float = 100, seed: int | RandomState | None = None): ...
def rich_club_coefficient(
G: Graph[_Node], normalized: bool = True, Q: float = 100, seed: int | RandomState | None = None
) -> dict[Incomplete, Incomplete]: ...
@@ -1,4 +1,5 @@
from _typeshed import Incomplete, SupportsGetItem
from collections import defaultdict
from collections.abc import Collection
from networkx.classes.graph import Graph, _Node
@@ -9,8 +10,10 @@ __all__ = ["floyd_warshall", "floyd_warshall_predecessor_and_distance", "reconst
@_dispatchable
def floyd_warshall_numpy(G: Graph[_Node], nodelist: Collection[_Node] | None = None, weight: str | None = "weight"): ...
@_dispatchable
def floyd_warshall_predecessor_and_distance(G: Graph[_Node], weight: str | None = "weight"): ...
def floyd_warshall_predecessor_and_distance(
G: Graph[_Node], weight: str | None = "weight"
) -> tuple[dict[Incomplete, dict[Incomplete, Incomplete]], dict[Incomplete, dict[Incomplete, float]]]: ...
@_dispatchable
def reconstruct_path(source: _Node, target: _Node, predecessors: SupportsGetItem[Incomplete, Incomplete]): ...
def reconstruct_path(source: _Node, target: _Node, predecessors: SupportsGetItem[Incomplete, Incomplete]) -> list[Incomplete]: ...
@_dispatchable
def floyd_warshall(G: Graph[_Node], weight: str | None = "weight"): ...
def floyd_warshall(G: Graph[_Node], weight: str | None = "weight") -> dict[Incomplete, defaultdict[Incomplete, float]]: ...
@@ -16,19 +16,25 @@ __all__ = [
]
@_dispatchable
def single_source_shortest_path_length(G: Graph[_Node], source: _Node, cutoff: int | None = None): ...
def single_source_shortest_path_length(G: Graph[_Node], source: _Node, cutoff: int | None = None) -> dict[Incomplete, int]: ...
@_dispatchable
def single_target_shortest_path_length(G: Graph[_Node], target: _Node, cutoff: int | None = None): ...
@_dispatchable
def all_pairs_shortest_path_length(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ...
@_dispatchable
def bidirectional_shortest_path(G: Graph[_Node], source: _Node, target: _Node): ...
def bidirectional_shortest_path(G: Graph[_Node], source: _Node, target: _Node) -> list[Incomplete]: ...
@_dispatchable
def single_source_shortest_path(G: Graph[_Node], source: _Node, cutoff: int | None = None): ...
def single_source_shortest_path(
G: Graph[_Node], source: _Node, cutoff: int | None = None
) -> dict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def single_target_shortest_path(G: Graph[_Node], target: _Node, cutoff: int | None = None): ...
def single_target_shortest_path(
G: Graph[_Node], target: _Node, cutoff: int | None = None
) -> dict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def all_pairs_shortest_path(G: Graph[_Node], cutoff: int | None = None) -> Generator[Incomplete, None, None]: ...
def all_pairs_shortest_path(
G: Graph[_Node], cutoff: int | None = None
) -> Generator[tuple[Incomplete, dict[Incomplete, list[Incomplete]]]]: ...
@_dispatchable
def predecessor(
G: Graph[_Node], source: _Node, target: _Node | None = None, cutoff: int | None = None, return_seen: bool | None = None
@@ -39,7 +39,7 @@ def dijkstra_path(
source: _Node,
target: _Node,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, list[Incomplete]] | list[Incomplete]: ...
@_dispatchable
def dijkstra_path_length(
G: Graph[_Node],
@@ -53,14 +53,14 @@ def single_source_dijkstra_path(
source: _Node,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, list[Incomplete]] | list[Incomplete]: ...
@_dispatchable
def single_source_dijkstra_path_length(
G: Graph[_Node],
source: _Node,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def single_source_dijkstra(
G: Graph[_Node],
@@ -68,21 +68,21 @@ def single_source_dijkstra(
target: _Node | None = None,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> tuple[Incomplete, Incomplete]: ...
@_dispatchable
def multi_source_dijkstra_path(
G: Graph[_Node],
sources,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, list[Incomplete]] | list[Incomplete]: ...
@_dispatchable
def multi_source_dijkstra_path_length(
G: Graph[_Node],
sources,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def multi_source_dijkstra(
G: Graph[_Node],
@@ -90,14 +90,14 @@ def multi_source_dijkstra(
target: _Node | None = None,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> tuple[Incomplete, Incomplete]: ...
@_dispatchable
def dijkstra_predecessor_and_distance(
G: Graph[_Node],
source: _Node,
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> tuple[dict[Incomplete, list[Incomplete]], dict[Incomplete, Incomplete]]: ...
@_dispatchable
def all_pairs_dijkstra(
G: Graph[_Node],
@@ -115,7 +115,7 @@ def all_pairs_dijkstra_path(
G: Graph[_Node],
cutoff: float | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
) -> Generator[Incomplete, None, None]: ...
) -> Generator[tuple[Incomplete, Incomplete], None, None]: ...
@_dispatchable
def bellman_ford_predecessor_and_distance(
G: Graph[_Node],
@@ -123,14 +123,14 @@ def bellman_ford_predecessor_and_distance(
target: _Node | None = None,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
heuristic: bool = False,
): ...
) -> tuple[Incomplete, Incomplete]: ...
@_dispatchable
def bellman_ford_path(
G: Graph[_Node],
source: _Node,
target: _Node,
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> list[Incomplete] | dict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def bellman_ford_path_length(
G: Graph[_Node],
@@ -141,11 +141,11 @@ def bellman_ford_path_length(
@_dispatchable
def single_source_bellman_ford_path(
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
): ...
) -> list[Incomplete] | dict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def single_source_bellman_ford_path_length(
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
): ...
) -> dict[Incomplete, int]: ...
@_dispatchable
def single_source_bellman_ford(
G: Graph[_Node],
@@ -160,11 +160,11 @@ def all_pairs_bellman_ford_path_length(
@_dispatchable
def all_pairs_bellman_ford_path(
G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
) -> Generator[Incomplete, None, None]: ...
) -> Generator[tuple[Incomplete, Incomplete], None, None]: ...
@_dispatchable
def goldberg_radzik(
G: Graph[_Node], source: _Node, weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
): ...
) -> tuple[dict[Incomplete, None], dict[Incomplete, int | float]]: ...
@_dispatchable
def negative_edge_cycle(
G: Graph[_Node],
@@ -183,4 +183,6 @@ def bidirectional_dijkstra(
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
@_dispatchable
def johnson(G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"): ...
def johnson(
G: Graph[_Node], weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight"
) -> dict[Any, dict[Any, list[Any]]]: ...
@@ -84,7 +84,7 @@ def simrank_similarity(
importance_factor: float = 0.9,
max_iterations: int = 1000,
tolerance: float = 0.0001,
): ...
) -> float | dict[Incomplete, Incomplete]: ...
@_dispatchable
def panther_similarity(
G: Graph[_Node],
@@ -95,7 +95,7 @@ def panther_similarity(
delta: float = 0.1,
eps=None,
weight: str | None = "weight",
): ...
) -> dict[bytes, bytes]: ...
@_dispatchable
def generate_random_paths(
G: Graph[_Node],
@@ -11,6 +11,6 @@ def lattice_reference(
G: Graph[_Node], niter: int = 5, D=None, connectivity: bool = True, seed: int | RandomState | None = None
): ...
@_dispatchable
def sigma(G: Graph[_Node], niter: int = 100, nrand: int = 10, seed: int | RandomState | None = None): ...
def sigma(G: Graph[_Node], niter: int = 100, nrand: int = 10, seed: int | RandomState | None = None) -> float: ...
@_dispatchable
def omega(G: Graph[_Node], niter: int = 5, nrand: int = 10, seed: int | RandomState | None = None): ...
def omega(G: Graph[_Node], niter: int = 5, nrand: int = 10, seed: int | RandomState | None = None) -> float: ...
@@ -4,4 +4,4 @@ from networkx.utils.backends import _dispatchable
__all__ = ["s_metric"]
@_dispatchable
def s_metric(G: Graph[_Node]): ...
def s_metric(G: Graph[_Node]) -> float: ...
@@ -11,8 +11,12 @@ def mutual_weight(G: Graph[_Node], u, v, weight=None) -> Incomplete | int: ...
@_dispatchable
def normalized_mutual_weight(G: Graph[_Node], u, v, norm=..., weight=None) -> float: ...
@_dispatchable
def effective_size(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None): ...
def effective_size(
G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def constraint(G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None): ...
def constraint(
G: Graph[_Node], nodes: Iterable[Incomplete] | None = None, weight: str | None = None
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def local_constraint(G: Graph[_Node], u: _Node, v: _Node, weight: str | None = None): ...
def local_constraint(G: Graph[_Node], u: _Node, v: _Node, weight: str | None = None) -> float: ...
+1 -1
View File
@@ -12,4 +12,4 @@ def double_edge_swap(G: Graph[_Node], nswap: int = 1, max_tries: int = 100, seed
@_dispatchable
def connected_double_edge_swap(
G: Graph[_Node], nswap: int = 1, _window_threshold: int = 3, seed: int | RandomState | None = None
): ...
) -> int: ...
@@ -1,3 +1,6 @@
from _typeshed import Incomplete
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
from numpy.random import RandomState
@@ -15,13 +18,13 @@ __all__ = [
@_dispatchable
def is_tournament(G: Graph[_Node]) -> bool: ...
@_dispatchable
def hamiltonian_path(G: Graph[_Node]): ...
def hamiltonian_path(G: Graph[_Node]) -> list[Incomplete]: ...
@_dispatchable
def random_tournament(n: int, seed: int | RandomState | None = None): ...
def random_tournament(n: int, seed: int | RandomState | None = None) -> DiGraph[Incomplete]: ...
@_dispatchable
def tournament_matrix(G: Graph[_Node]): ...
@_dispatchable
def score_sequence(G: Graph[_Node]): ...
def score_sequence(G: Graph[_Node]) -> list[Incomplete]: ...
@_dispatchable
def is_reachable(G: Graph[_Node], s: _Node, t: _Node) -> bool: ...
@_dispatchable
@@ -25,11 +25,11 @@ def dfs_tree(
@_dispatchable
def dfs_predecessors(
G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None
): ...
) -> dict[Incomplete, Incomplete]: ...
@_dispatchable
def dfs_successors(
G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None
): ...
) -> dict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def dfs_postorder_nodes(
G: Graph[_Node], source: _Node | None = None, depth_limit=None, *, sort_neighbors: Callable[..., Incomplete] | None = None
@@ -11,4 +11,4 @@ FORWARD: Final = "forward"
REVERSE: Final = "reverse"
@_dispatchable
def edge_bfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, Incomplete]: ...
def edge_bfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, None]: ...
@@ -11,4 +11,4 @@ FORWARD: Final = "forward"
REVERSE: Final = "reverse"
@_dispatchable
def edge_dfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, Incomplete]: ...
def edge_dfs(G: Graph[_Node], source=None, orientation=None) -> Generator[Incomplete, None, None]: ...
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from dataclasses import dataclass
from typing import Final
from typing_extensions import Self
from networkx.classes.digraph import DiGraph
from networkx.classes.graph import _Node
@@ -66,5 +66,5 @@ class ArborescenceIterator:
def __init__(self, G, weight: str = "weight", minimum: bool = True, init_partition=None) -> None: ...
partition_queue: Incomplete
def __iter__(self) -> Iterator[Incomplete]: ...
def __iter__(self) -> Self: ...
def __next__(self): ...
@@ -14,6 +14,6 @@ def to_nested_tuple(T: Graph[_Node], root: _Node, canonical_form: bool = False):
@_dispatchable
def from_nested_tuple(sequence: tuple[Incomplete, ...], sensible_relabeling: bool = False): ...
@_dispatchable
def to_prufer_sequence(T: Graph[_Node]): ...
def to_prufer_sequence(T: Graph[_Node]) -> list[Incomplete]: ...
@_dispatchable
def from_prufer_sequence(sequence: Iterable[Incomplete]): ...
@@ -1,6 +1,9 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph
from networkx.utils.backends import _dispatchable
__all__ = ["junction_tree"]
@_dispatchable
def junction_tree(G): ...
def junction_tree(G) -> Graph[Incomplete]: ...
@@ -1,8 +1,9 @@
from _typeshed import Incomplete
from collections.abc import Callable, Generator, Iterator
from collections.abc import Callable, Generator
from dataclasses import dataclass
from enum import Enum
from typing import Final, Literal
from typing_extensions import Self
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
@@ -81,7 +82,7 @@ class SpanningTreeIterator:
def __init__(self, G, weight: str = "weight", minimum: bool = True, ignore_nan: bool = False) -> None: ...
partition_queue: Incomplete
def __iter__(self) -> Iterator[Incomplete]: ...
def __iter__(self) -> Self: ...
def __next__(self): ...
@_dispatchable
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections import defaultdict
from collections.abc import Collection, Generator
from typing import Final
@@ -13,12 +14,12 @@ TRIAD_NAMES: Final[tuple[str, ...]]
TRICODE_TO_NAME: Final[dict[int, str]]
@_dispatchable
def triadic_census(G: DiGraph[_Node], nodelist: Collection[_Node] | None = None): ...
def triadic_census(G: DiGraph[_Node], nodelist: Collection[_Node] | None = None) -> dict[str, int]: ...
@_dispatchable
def is_triad(G: Graph[_Node]) -> bool: ...
@_dispatchable
def all_triads(G: DiGraph[_Node]) -> Generator[Incomplete, None, None]: ...
@_dispatchable
def triads_by_type(G: DiGraph[_Node]): ...
def triads_by_type(G: DiGraph[_Node]) -> defaultdict[Incomplete, list[Incomplete]]: ...
@_dispatchable
def triad_type(G: DiGraph[_Node]): ...
def triad_type(G: DiGraph[_Node]) -> str | None: ...
@@ -1,7 +1,11 @@
from _typeshed import Incomplete
from networkx.classes.graph import Graph, _Node
from networkx.utils.backends import _dispatchable
__all__ = ["closeness_vitality"]
@_dispatchable
def closeness_vitality(G: Graph[_Node], node=None, weight: str | None = None, wiener_index: float | None = None): ...
def closeness_vitality(
G: Graph[_Node], node=None, weight: str | None = None, wiener_index: float | None = None
) -> float | dict[Incomplete, Incomplete]: ...
@@ -12,4 +12,4 @@ def voronoi_cells(
G: Graph[_Node],
center_nodes: set[Incomplete],
weight: str | Callable[[Any, Any, SupportsGetItem[str, Any]], float | None] | None = "weight",
): ...
) -> dict[Incomplete, set[Incomplete]]: ...
@@ -4,7 +4,7 @@ from networkx.utils.backends import _dispatchable
__all__ = ["wiener_index", "schultz_index", "gutman_index"]
@_dispatchable
def wiener_index(G: Graph[_Node], weight: str | None = None): ...
def wiener_index(G: Graph[_Node], weight: str | None = None) -> float: ...
@_dispatchable
def schultz_index(G, weight=None) -> float: ...
@_dispatchable
+6 -5
View File
@@ -1,10 +1,11 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from functools import cached_property
from typing_extensions import Self
from networkx.classes.coreviews import AdjacencyView
from networkx.classes.graph import Graph, _Node
from networkx.classes.reportviews import DiDegreeView, OutEdgeView
from networkx.classes.reportviews import InDegreeView, InMultiDegreeView, OutDegreeView, OutEdgeView, OutMultiDegreeView
__all__ = ["DiGraph"]
@@ -23,9 +24,9 @@ class DiGraph(Graph[_Node]):
@cached_property
def in_edges(self) -> OutEdgeView[_Node]: ...
@cached_property
def in_degree(self) -> DiDegreeView[_Node]: ...
def in_degree(self) -> InDegreeView[_Node] | InMultiDegreeView[_Node]: ... # Include subtypes' possible return types
@cached_property
def out_degree(self) -> DiDegreeView[_Node]: ...
def to_undirected(self, reciprocal: bool = False, as_view: bool = False): ... # type: ignore[override] # Has an additional `reciprocal` keyword argument
def reverse(self, copy: bool = True) -> DiGraph[_Node]: ...
def out_degree(self) -> OutDegreeView[_Node] | OutMultiDegreeView[_Node]: ... # Include subtypes' possible return types
def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> Graph[_Node]: ... # type: ignore[override] # Has an additional `reciprocal` keyword argument
def reverse(self, copy: bool = True) -> Self: ...
def copy(self, as_view: bool = False) -> DiGraph[_Node]: ...
+1 -1
View File
@@ -59,7 +59,7 @@ def neighbors(G, n): ...
def number_of_nodes(G): ...
def number_of_edges(G): ...
def density(G): ...
def degree_histogram(G): ...
def degree_histogram(G) -> list[int]: ...
@overload
def is_directed(G: PlanarEmbedding[Hashable]) -> Literal[False]: ... # type: ignore[misc] # Incompatible return types
@overload
+2 -2
View File
@@ -7,7 +7,7 @@ from typing_extensions import Self, TypeAlias
import numpy
from networkx.classes.coreviews import AdjacencyView, AtlasView
from networkx.classes.digraph import DiGraph
from networkx.classes.reportviews import DiDegreeView, NodeView, OutEdgeView
from networkx.classes.reportviews import DegreeView, DiDegreeView, NodeView, OutEdgeView
_Node = TypeVar("_Node", bound=Hashable)
_NodeWithData: TypeAlias = tuple[_Node, dict[str, Any]]
@@ -82,7 +82,7 @@ class Graph(Collection[_Node]):
def get_edge_data(self, u: _Node, v: _Node, default=None) -> Mapping[str, Incomplete]: ...
def adjacency(self) -> Iterator[tuple[_Node, Mapping[_Node, Mapping[str, Incomplete]]]]: ...
@cached_property
def degree(self) -> DiDegreeView[_Node]: ...
def degree(self) -> DegreeView[_Node] | DiDegreeView[_Node]: ... # Include subtypes' possible return types
def clear(self) -> None: ...
def clear_edges(self) -> None: ...
def is_multigraph(self) -> bool: ...
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from functools import cached_property
from typing import ClassVar
from typing_extensions import TypeAlias
@@ -23,7 +24,7 @@ class MultiGraph(Graph[_Node]):
def has_edge(self, u: _Node, v: _Node, key=None) -> bool: ...
def get_edge_data( # type: ignore[override] # Has an additional `key` keyword argument
self, u, v, key=None, default=None
): ...
) -> Mapping[str, Incomplete]: ...
def copy(self, as_view: bool = False) -> MultiGraph[_Node]: ...
def to_directed(self, as_view: bool = False) -> MultiDiGraph[_Node]: ...
def to_undirected(self, as_view: bool = False) -> MultiGraph[_Node]: ...
+20 -10
View File
@@ -22,9 +22,15 @@ __all__ = [
"arf_layout",
]
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 random_layout(
G, center=None, dim: int = 2, seed: int | RandomState | None = None, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def circular_layout(
G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def shell_layout(
G, nlist=None, rotate=None, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def bipartite_layout(
G,
nodes=None,
@@ -33,7 +39,7 @@ def bipartite_layout(
center=None,
aspect_ratio: float = ...,
store_pos_as: str | None = None,
): ...
) -> dict[Incomplete, Incomplete]: ...
def spring_layout(
G,
k=None,
@@ -50,15 +56,19 @@ def spring_layout(
*,
method: str = "auto",
gravity: float = 1.0,
): ...
) -> dict[Incomplete, Incomplete]: ...
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, 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): ...
) -> dict[Incomplete, Incomplete]: ...
def spectral_layout(
G, weight: str = "weight", scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def planar_layout(
G, scale: float = 1, center=None, dim: int = 2, store_pos_as: str | None = None
) -> dict[Incomplete, Incomplete]: ...
def spiral_layout(
G,
scale: float = 1,
@@ -67,10 +77,10 @@ def spiral_layout(
resolution: float = 0.35,
equidistant: bool = False,
store_pos_as: str | None = None,
): ...
) -> dict[Incomplete, Incomplete]: ...
def multipartite_layout(
G, subset_key: str = "subset", align: str = "vertical", scale: float = 1, center=None, store_pos_as: str | None = None
): ...
) -> dict[Incomplete, Incomplete]: ...
def arf_layout(
G,
pos=None,
+5 -1
View File
@@ -1,10 +1,14 @@
from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
from ..classes.graph import Graph
__all__ = ["write_dot", "read_dot", "graphviz_layout", "pydot_layout", "to_pydot", "from_pydot"]
def write_dot(G, path) -> None: ...
@_dispatchable
def read_dot(path): ...
def read_dot(path) -> Graph[Incomplete]: ...
@_dispatchable
def from_pydot(P): ...
def to_pydot(N): ...
+5 -2
View File
@@ -1,8 +1,11 @@
import sys
from _typeshed import Incomplete
from typing import Final
from networkx.utils.backends import _dispatchable
from ..classes.graph import Graph
if sys.version_info >= (3, 11):
from importlib.resources.abc import Traversable
else:
@@ -14,6 +17,6 @@ NUM_GRAPHS: Final = 1253
ATLAS_FILE: Final[Traversable]
@_dispatchable
def graph_atlas(i): ...
def graph_atlas(i) -> Graph[Incomplete]: ...
@_dispatchable
def graph_atlas_g(): ...
def graph_atlas_g() -> list[Graph[Incomplete]]: ...
@@ -2,6 +2,11 @@ from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
from ..classes.digraph import DiGraph
from ..classes.graph import Graph
from ..classes.multidigraph import MultiDiGraph
from ..classes.multigraph import MultiGraph
__all__ = [
"configuration_model",
"directed_configuration_model",
@@ -13,19 +18,21 @@ __all__ = [
]
@_dispatchable
def configuration_model(deg_sequence, create_using=None, seed=None): ...
def configuration_model(deg_sequence, create_using=None, seed=None) -> MultiGraph[Incomplete]: ...
@_dispatchable
def directed_configuration_model(in_degree_sequence, out_degree_sequence, create_using=None, seed=None): ...
def directed_configuration_model(
in_degree_sequence, out_degree_sequence, create_using=None, seed=None
) -> MultiDiGraph[Incomplete]: ...
@_dispatchable
def expected_degree_graph(w, seed=None, selfloops: bool = True): ...
def expected_degree_graph(w, seed=None, selfloops: bool = True) -> Graph[Incomplete]: ...
@_dispatchable
def havel_hakimi_graph(deg_sequence, create_using=None): ...
@_dispatchable
def directed_havel_hakimi_graph(in_deg_sequence, out_deg_sequence, create_using=None): ...
def directed_havel_hakimi_graph(in_deg_sequence, out_deg_sequence, create_using=None) -> DiGraph[Incomplete]: ...
@_dispatchable
def degree_sequence_tree(deg_sequence, create_using=None): ...
@_dispatchable
def random_degree_sequence_graph(sequence, seed=None, tries: int = 10): ...
def random_degree_sequence_graph(sequence, seed=None, tries: int = 10) -> Graph[Incomplete]: ...
class DegreeSequenceRandomGraph:
rng: Incomplete
@@ -1,5 +1,9 @@
from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
from ..classes import MultiDiGraph
__all__ = ["gn_graph", "gnc_graph", "gnr_graph", "random_k_out_graph", "scale_free_graph"]
@_dispatchable
@@ -23,4 +27,4 @@ def scale_free_graph(
@_dispatchable
def random_uniform_k_out_graph(n: int, k: int, self_loops: bool = True, with_replacement: bool = True, seed=None): ...
@_dispatchable
def random_k_out_graph(n, k, alpha, self_loops: bool = True, seed=None): ...
def random_k_out_graph(n, k, alpha, self_loops: bool = True, seed=None) -> MultiDiGraph[Incomplete]: ...
@@ -1,8 +1,12 @@
from _typeshed import Incomplete
from networkx.utils.backends import _dispatchable
from ..classes.graph import Graph
__all__ = ["partial_duplication_graph", "duplication_divergence_graph"]
@_dispatchable
def partial_duplication_graph(N, n, p, q, seed=None): ...
@_dispatchable
def duplication_divergence_graph(n, p, seed=None): ...
def duplication_divergence_graph(n, p, seed=None) -> Graph[Incomplete]: ...
@@ -23,7 +23,9 @@ def soft_random_geometric_graph(n, radius, dim: int = 2, pos=None, p: float = 2,
@_dispatchable
def geographical_threshold_graph(n, theta, dim: int = 2, pos=None, weight=None, metric=None, p_dist=None, seed=None): ...
@_dispatchable
def waxman_graph(n, beta: float = 0.4, alpha: float = 0.1, L=None, domain=(0, 0, 1, 1), metric=None, seed=None): ...
def waxman_graph(
n, beta: float = 0.4, alpha: float = 0.1, L=None, domain=(0, 0, 1, 1), metric=None, seed=None
) -> Graph[Incomplete]: ...
# docstring marks p as int, but it still works with floats. So I think it's better for consistency
@_dispatchable
@@ -31,8 +31,8 @@ class AS_graph_generator:
def choose_node_pref_attach(self, node_list): ...
def add_customer(self, i, j) -> None: ...
def add_node(self, i, kind, reg2prob, avg_deg, t_edge_prob): ...
def add_m_peering_link(self, m, to_kind): ...
def add_cp_peering_link(self, cp, to_kind): ...
def add_m_peering_link(self, m, to_kind) -> bool: ...
def add_cp_peering_link(self, cp, to_kind) -> bool: ...
regions: Incomplete
def graph_regions(self, rn) -> None: ...
def add_peering_links(self, from_kind, to_kind) -> None: ...

Some files were not shown because too many files have changed in this diff Show More