Skip to content

Commit 658dd55

Browse files
rhelmotAvasam
andauthored
Add networkx stubs (#10544)
Co-authored-by: Avasam <[email protected]> Co-authored-by: Audrey Dutcher <[email protected]>
1 parent b6740d0 commit 658dd55

File tree

276 files changed

+4237
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+4237
-0
lines changed

pyrightconfig.stricter.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"stubs/mysqlclient",
5050
"stubs/oauthlib",
5151
"stubs/openpyxl",
52+
"stubs/networkx",
5253
"stubs/passlib",
5354
"stubs/peewee",
5455
"stubs/pexpect",

stubs/networkx/METADATA.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version = "3.1"
2+
upstream_repository = "https://github.com/networkx/networkx"
3+
requires = ["numpy"]
4+
partial_stub = true
5+
6+
[tool.stubtest]
7+
ignore_missing_stub = true
8+
# stub_uploader won't allow pandas-stubs in the requires field https://github.com/typeshed-internal/stub_uploader/issues/90
9+
stubtest_requirements = ["pandas"]

stubs/networkx/networkx/__init__.pyi

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from networkx.algorithms import *
2+
from networkx.classes import *
3+
from networkx.classes import filters as filters
4+
from networkx.convert import *
5+
from networkx.convert_matrix import *
6+
from networkx.drawing import *
7+
from networkx.exception import *
8+
from networkx.generators import *
9+
from networkx.linalg import *
10+
from networkx.readwrite import *
11+
from networkx.relabel import *
12+
13+
from . import (
14+
algorithms as algorithms,
15+
classes as classes,
16+
convert as convert,
17+
convert_matrix as convert_matrix,
18+
drawing as drawing,
19+
generators as generators,
20+
linalg as linalg,
21+
readwrite as readwrite,
22+
relabel as relabel,
23+
utils as utils,
24+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
from networkx.algorithms import (
2+
approximation as approximation,
3+
assortativity as assortativity,
4+
bipartite as bipartite,
5+
centrality as centrality,
6+
chordal as chordal,
7+
clique as clique,
8+
cluster as cluster,
9+
coloring as coloring,
10+
community as community,
11+
components as components,
12+
connectivity as connectivity,
13+
flow as flow,
14+
isomorphism as isomorphism,
15+
link_analysis as link_analysis,
16+
lowest_common_ancestors as lowest_common_ancestors,
17+
node_classification as node_classification,
18+
operators as operators,
19+
shortest_paths as shortest_paths,
20+
tournament as tournament,
21+
traversal as traversal,
22+
tree as tree,
23+
)
24+
from networkx.algorithms.assortativity import *
25+
from networkx.algorithms.asteroidal import *
26+
from networkx.algorithms.bipartite import (
27+
complete_bipartite_graph as complete_bipartite_graph,
28+
is_bipartite as is_bipartite,
29+
projected_graph as projected_graph,
30+
)
31+
from networkx.algorithms.boundary import *
32+
from networkx.algorithms.bridges import *
33+
from networkx.algorithms.centrality import *
34+
from networkx.algorithms.chains import *
35+
from networkx.algorithms.chordal import *
36+
from networkx.algorithms.clique import *
37+
from networkx.algorithms.cluster import *
38+
from networkx.algorithms.coloring import *
39+
from networkx.algorithms.communicability_alg import *
40+
from networkx.algorithms.components import *
41+
from networkx.algorithms.connectivity import (
42+
all_node_cuts as all_node_cuts,
43+
all_pairs_node_connectivity as all_pairs_node_connectivity,
44+
average_node_connectivity as average_node_connectivity,
45+
edge_connectivity as edge_connectivity,
46+
edge_disjoint_paths as edge_disjoint_paths,
47+
is_k_edge_connected as is_k_edge_connected,
48+
k_components as k_components,
49+
k_edge_augmentation as k_edge_augmentation,
50+
k_edge_components as k_edge_components,
51+
k_edge_subgraphs as k_edge_subgraphs,
52+
minimum_edge_cut as minimum_edge_cut,
53+
minimum_node_cut as minimum_node_cut,
54+
node_connectivity as node_connectivity,
55+
node_disjoint_paths as node_disjoint_paths,
56+
stoer_wagner as stoer_wagner,
57+
)
58+
from networkx.algorithms.core import *
59+
from networkx.algorithms.covering import *
60+
from networkx.algorithms.cuts import *
61+
from networkx.algorithms.cycles import *
62+
from networkx.algorithms.d_separation import *
63+
from networkx.algorithms.dag import *
64+
from networkx.algorithms.distance_measures import *
65+
from networkx.algorithms.distance_regular import *
66+
from networkx.algorithms.dominance import *
67+
from networkx.algorithms.dominating import *
68+
from networkx.algorithms.efficiency_measures import *
69+
from networkx.algorithms.euler import *
70+
from networkx.algorithms.flow import (
71+
capacity_scaling as capacity_scaling,
72+
cost_of_flow as cost_of_flow,
73+
gomory_hu_tree as gomory_hu_tree,
74+
max_flow_min_cost as max_flow_min_cost,
75+
maximum_flow as maximum_flow,
76+
maximum_flow_value as maximum_flow_value,
77+
min_cost_flow as min_cost_flow,
78+
min_cost_flow_cost as min_cost_flow_cost,
79+
minimum_cut as minimum_cut,
80+
minimum_cut_value as minimum_cut_value,
81+
network_simplex as network_simplex,
82+
)
83+
from networkx.algorithms.graph_hashing import *
84+
from networkx.algorithms.graphical import *
85+
from networkx.algorithms.hierarchy import *
86+
from networkx.algorithms.hybrid import *
87+
from networkx.algorithms.isolate import *
88+
from networkx.algorithms.isomorphism import (
89+
could_be_isomorphic as could_be_isomorphic,
90+
fast_could_be_isomorphic as fast_could_be_isomorphic,
91+
faster_could_be_isomorphic as faster_could_be_isomorphic,
92+
is_isomorphic as is_isomorphic,
93+
)
94+
from networkx.algorithms.isomorphism.vf2pp import *
95+
from networkx.algorithms.link_analysis import *
96+
from networkx.algorithms.link_prediction import *
97+
from networkx.algorithms.lowest_common_ancestors import *
98+
from networkx.algorithms.matching import *
99+
from networkx.algorithms.minors import *
100+
from networkx.algorithms.mis import *
101+
from networkx.algorithms.moral import *
102+
from networkx.algorithms.non_randomness import *
103+
from networkx.algorithms.operators import *
104+
from networkx.algorithms.planar_drawing import *
105+
from networkx.algorithms.planarity import *
106+
from networkx.algorithms.polynomials import *
107+
from networkx.algorithms.reciprocity import *
108+
from networkx.algorithms.regular import *
109+
from networkx.algorithms.richclub import *
110+
from networkx.algorithms.shortest_paths import *
111+
from networkx.algorithms.similarity import *
112+
from networkx.algorithms.simple_paths import *
113+
from networkx.algorithms.smallworld import *
114+
from networkx.algorithms.smetric import *
115+
from networkx.algorithms.sparsifiers import *
116+
from networkx.algorithms.structuralholes import *
117+
from networkx.algorithms.summarization import *
118+
from networkx.algorithms.swap import *
119+
from networkx.algorithms.traversal import *
120+
from networkx.algorithms.tree.branchings import (
121+
ArborescenceIterator as ArborescenceIterator,
122+
maximum_branching as maximum_branching,
123+
maximum_spanning_arborescence as maximum_spanning_arborescence,
124+
minimum_branching as minimum_branching,
125+
minimum_spanning_arborescence as minimum_spanning_arborescence,
126+
)
127+
from networkx.algorithms.tree.coding import *
128+
from networkx.algorithms.tree.decomposition import *
129+
from networkx.algorithms.tree.mst import *
130+
from networkx.algorithms.tree.operations import *
131+
from networkx.algorithms.tree.recognition import *
132+
from networkx.algorithms.triads import *
133+
from networkx.algorithms.vitality import *
134+
from networkx.algorithms.voronoi import *
135+
from networkx.algorithms.wiener import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from networkx.algorithms.approximation.clique import *
2+
from networkx.algorithms.approximation.clustering_coefficient import *
3+
from networkx.algorithms.approximation.connectivity import *
4+
from networkx.algorithms.approximation.distance_measures import *
5+
from networkx.algorithms.approximation.dominating_set import *
6+
from networkx.algorithms.approximation.kcomponents import *
7+
from networkx.algorithms.approximation.matching import *
8+
from networkx.algorithms.approximation.maxcut import *
9+
from networkx.algorithms.approximation.ramsey import *
10+
from networkx.algorithms.approximation.steinertree import *
11+
from networkx.algorithms.approximation.traveling_salesman import *
12+
from networkx.algorithms.approximation.treewidth import *
13+
from networkx.algorithms.approximation.vertex_cover import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def maximum_independent_set(G): ...
2+
def max_clique(G): ...
3+
def clique_removal(G): ...
4+
def large_clique_size(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from _typeshed import Incomplete
2+
3+
def average_clustering(G, trials: int = 1000, seed: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from _typeshed import Incomplete
2+
3+
def local_node_connectivity(G, source, target, cutoff: Incomplete | None = None): ...
4+
def node_connectivity(G, s: Incomplete | None = None, t: Incomplete | None = None): ...
5+
def all_pairs_node_connectivity(G, nbunch: Incomplete | None = None, cutoff: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from _typeshed import Incomplete
2+
3+
def diameter(G, seed: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from _typeshed import Incomplete
2+
3+
def min_weighted_dominating_set(G, weight: Incomplete | None = None): ...
4+
def min_edge_dominating_set(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def k_components(G, min_density: float = 0.95): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def min_maximal_matching(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from _typeshed import Incomplete
2+
3+
def randomized_partitioning(G, seed: Incomplete | None = None, p: float = 0.5, weight: Incomplete | None = None): ...
4+
def one_exchange(G, initial_cut: Incomplete | None = None, seed: Incomplete | None = None, weight: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def ramsey_R2(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from _typeshed import Incomplete
2+
3+
def metric_closure(G, weight: str = "weight"): ...
4+
def steiner_tree(G, terminal_nodes, weight: str = "weight", method: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from _typeshed import Incomplete
2+
3+
def christofides(G, weight: str = "weight", tree: Incomplete | None = None): ...
4+
def traveling_salesman_problem(
5+
G, weight: str = "weight", nodes: Incomplete | None = None, cycle: bool = True, method: Incomplete | None = None
6+
): ...
7+
def asadpour_atsp(G, weight: str = "weight", seed: Incomplete | None = None, source: Incomplete | None = None): ...
8+
def greedy_tsp(G, weight: str = "weight", source: Incomplete | None = None): ...
9+
def simulated_annealing_tsp(
10+
G,
11+
init_cycle,
12+
weight: str = "weight",
13+
source: Incomplete | None = None,
14+
# docstring says int, but it can be a float and does become a float mid-equation if alpha is also a float
15+
temp: float = 100,
16+
move: str = "1-1",
17+
max_iterations: int = 10,
18+
N_inner: int = 100,
19+
alpha: float = 0.01,
20+
seed: Incomplete | None = None,
21+
): ...
22+
def threshold_accepting_tsp(
23+
G,
24+
init_cycle,
25+
weight: str = "weight",
26+
source: Incomplete | None = None,
27+
threshold: float = 1,
28+
move: str = "1-1",
29+
max_iterations: int = 10,
30+
N_inner: int = 100,
31+
alpha: float = 0.1,
32+
seed: Incomplete | None = None,
33+
): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from _typeshed import Incomplete
2+
3+
__all__ = ["treewidth_min_degree", "treewidth_min_fill_in"]
4+
5+
def treewidth_min_degree(G): ...
6+
def treewidth_min_fill_in(G): ...
7+
8+
class MinDegreeHeuristic:
9+
count: Incomplete
10+
def __init__(self, graph) -> None: ...
11+
def best_node(self, graph): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from _typeshed import Incomplete
2+
3+
def min_weighted_vertex_cover(G, weight: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from networkx.algorithms.assortativity.connectivity import *
2+
from networkx.algorithms.assortativity.correlation import *
3+
from networkx.algorithms.assortativity.mixing import *
4+
from networkx.algorithms.assortativity.neighbor_degree import *
5+
from networkx.algorithms.assortativity.pairs import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from _typeshed import Incomplete
2+
3+
def average_degree_connectivity(
4+
G, source: str = "in+out", target: str = "in+out", nodes: Incomplete | None = None, weight: Incomplete | None = None
5+
): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from _typeshed import Incomplete
2+
3+
def degree_assortativity_coefficient(
4+
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
5+
): ...
6+
def degree_pearson_correlation_coefficient(
7+
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
8+
): ...
9+
def attribute_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ...
10+
def numeric_assortativity_coefficient(G, attribute, nodes: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from _typeshed import Incomplete
2+
3+
def attribute_mixing_dict(G, attribute, nodes: Incomplete | None = None, normalized: bool = False): ...
4+
def attribute_mixing_matrix(
5+
G, attribute, nodes: Incomplete | None = None, mapping: Incomplete | None = None, normalized: bool = True
6+
): ...
7+
def degree_mixing_dict(
8+
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None, normalized: bool = False
9+
): ...
10+
def degree_mixing_matrix(
11+
G,
12+
x: str = "out",
13+
y: str = "in",
14+
weight: Incomplete | None = None,
15+
nodes: Incomplete | None = None,
16+
normalized: bool = True,
17+
mapping: Incomplete | None = None,
18+
): ...
19+
def mixing_dict(xy, normalized: bool = False): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from _typeshed import Incomplete
2+
3+
def average_neighbor_degree(
4+
G, source: str = "out", target: str = "out", nodes: Incomplete | None = None, weight: Incomplete | None = None
5+
): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Generator
3+
4+
def node_attribute_xy(G, attribute, nodes: Incomplete | None = None) -> Generator[Incomplete, None, None]: ...
5+
def node_degree_xy(
6+
G, x: str = "out", y: str = "in", weight: Incomplete | None = None, nodes: Incomplete | None = None
7+
) -> Generator[Incomplete, None, None]: ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def find_asteroidal_triple(G): ...
2+
def is_at_free(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from networkx.algorithms.bipartite.basic import *
2+
from networkx.algorithms.bipartite.centrality import *
3+
from networkx.algorithms.bipartite.cluster import *
4+
from networkx.algorithms.bipartite.covering import *
5+
from networkx.algorithms.bipartite.edgelist import *
6+
from networkx.algorithms.bipartite.generators import *
7+
from networkx.algorithms.bipartite.matching import *
8+
from networkx.algorithms.bipartite.matrix import *
9+
from networkx.algorithms.bipartite.projection import *
10+
from networkx.algorithms.bipartite.redundancy import *
11+
from networkx.algorithms.bipartite.spectral import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from _typeshed import Incomplete
2+
3+
def color(G): ...
4+
def is_bipartite(G): ...
5+
def is_bipartite_node_set(G, nodes): ...
6+
def sets(G, top_nodes: Incomplete | None = None): ...
7+
def density(B, nodes): ...
8+
def degrees(B, nodes, weight: Incomplete | None = None): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def degree_centrality(G, nodes): ...
2+
def betweenness_centrality(G, nodes): ...
3+
def closeness_centrality(G, nodes, normalized: bool = True): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from _typeshed import Incomplete
2+
3+
def latapy_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ...
4+
5+
clustering = latapy_clustering
6+
7+
def average_clustering(G, nodes: Incomplete | None = None, mode: str = "dot"): ...
8+
def robins_alexander_clustering(G): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from _typeshed import Incomplete
2+
3+
def min_edge_cover(G, matching_algorithm: Incomplete | None = None): ...

0 commit comments

Comments
 (0)