Add networkx stubs
This commit is contained in:
Родитель
116165aa23
Коммит
bbcd0180f2
|
@ -0,0 +1,2 @@
|
|||
These stubs were created with https://github.com/gramster/docs2stubs.
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
__version__: str = ...
|
||||
|
||||
# These are imported in order as listed
|
||||
|
||||
from .exception import (
|
||||
HasACycle,
|
||||
NodeNotFound,
|
||||
PowerIterationFailedConvergence,
|
||||
ExceededMaxIterations,
|
||||
AmbiguousSolution,
|
||||
NetworkXAlgorithmError,
|
||||
NetworkXException,
|
||||
NetworkXError,
|
||||
NetworkXNoCycle,
|
||||
NetworkXNoPath,
|
||||
NetworkXNotImplemented,
|
||||
NetworkXPointlessConcept,
|
||||
NetworkXUnbounded,
|
||||
NetworkXUnfeasible,
|
||||
)
|
||||
|
||||
from . import utils as utils
|
||||
|
||||
from . import classes as classes
|
||||
from .classes import filters as filters
|
||||
from .classes import *
|
||||
|
||||
from . import convert as convert
|
||||
from .convert import (
|
||||
to_networkx_graph,
|
||||
from_dict_of_dicts,
|
||||
to_dict_of_dicts,
|
||||
from_dict_of_lists,
|
||||
to_dict_of_lists,
|
||||
from_edgelist,
|
||||
to_edgelist,
|
||||
)
|
||||
|
||||
from . import convert_matrix as convert_matrix
|
||||
from .convert_matrix import (
|
||||
from_numpy_matrix,
|
||||
to_numpy_matrix,
|
||||
from_pandas_adjacency,
|
||||
to_pandas_adjacency,
|
||||
from_pandas_edgelist,
|
||||
to_pandas_edgelist,
|
||||
to_numpy_recarray,
|
||||
from_scipy_sparse_array,
|
||||
from_scipy_sparse_matrix,
|
||||
to_scipy_sparse_array,
|
||||
to_scipy_sparse_matrix,
|
||||
from_numpy_array,
|
||||
to_numpy_array,
|
||||
)
|
||||
|
||||
from . import relabel as relabel
|
||||
from .relabel import convert_node_labels_to_integers, relabel_nodes
|
||||
|
||||
from . import generators as generators
|
||||
from .generators import *
|
||||
|
||||
from . import readwrite as readwrite
|
||||
from .readwrite import *
|
||||
|
||||
# Need to test with SciPy, when available
|
||||
from . import algorithms as algorithms
|
||||
from .algorithms import *
|
||||
|
||||
from . import linalg as linalg
|
||||
from .linalg import *
|
||||
|
||||
from .testing.test import run as test
|
||||
|
||||
from . import drawing as drawing
|
||||
from .drawing import *
|
|
@ -0,0 +1,25 @@
|
|||
import decimal
|
||||
import io
|
||||
import numpy.typing
|
||||
import pandas as pd
|
||||
|
||||
Decimal = decimal.Decimal
|
||||
PythonScalar = str | int | float | bool
|
||||
|
||||
ArrayLike = numpy.typing.ArrayLike
|
||||
FileLike = io.IOBase
|
||||
PathLike = str
|
||||
|
||||
PandasScalar = pd.Period | pd.Timestamp | pd.Timedelta | pd.Interval
|
||||
Scalar = PythonScalar | PandasScalar
|
||||
|
||||
Color = tuple[float, float, float] | str
|
||||
|
||||
__all__ = [
|
||||
"ArrayLike",
|
||||
"Color",
|
||||
"Decimal",
|
||||
"FileLike",
|
||||
"PathLike",
|
||||
"Scalar",
|
||||
]
|
|
@ -0,0 +1,301 @@
|
|||
from .assortativity import *
|
||||
from .asteroidal import is_at_free, find_asteroidal_triple
|
||||
from .boundary import edge_boundary, node_boundary
|
||||
from .bridges import bridges, has_bridges, local_bridges
|
||||
from .chains import chain_decomposition as chain_decomposition
|
||||
from .centrality import *
|
||||
from .chordal import (
|
||||
is_chordal,
|
||||
find_induced_nodes,
|
||||
chordal_graph_cliques,
|
||||
chordal_graph_treewidth,
|
||||
NetworkXTreewidthBoundExceeded,
|
||||
complete_to_chordal_graph,
|
||||
)
|
||||
from .cluster import (
|
||||
triangles,
|
||||
average_clustering,
|
||||
clustering,
|
||||
transitivity,
|
||||
square_clustering,
|
||||
generalized_degree,
|
||||
)
|
||||
from .clique import (
|
||||
find_cliques,
|
||||
find_cliques_recursive,
|
||||
make_max_clique_graph,
|
||||
make_clique_bipartite,
|
||||
graph_clique_number,
|
||||
graph_number_of_cliques,
|
||||
node_clique_number,
|
||||
number_of_cliques,
|
||||
cliques_containing_node,
|
||||
enumerate_all_cliques,
|
||||
max_weight_clique,
|
||||
)
|
||||
from .communicability_alg import communicability, communicability_exp
|
||||
from .components import *
|
||||
from .coloring import *
|
||||
from .core import (
|
||||
core_number,
|
||||
find_cores,
|
||||
k_core,
|
||||
k_shell,
|
||||
k_crust,
|
||||
k_corona,
|
||||
k_truss,
|
||||
onion_layers,
|
||||
)
|
||||
from .covering import min_edge_cover, is_edge_cover
|
||||
from .cycles import (
|
||||
cycle_basis,
|
||||
simple_cycles,
|
||||
recursive_simple_cycles,
|
||||
find_cycle,
|
||||
minimum_cycle_basis,
|
||||
)
|
||||
from .cuts import (
|
||||
boundary_expansion,
|
||||
conductance,
|
||||
cut_size,
|
||||
edge_expansion,
|
||||
mixing_expansion,
|
||||
node_expansion,
|
||||
normalized_cut_size,
|
||||
volume,
|
||||
)
|
||||
from .d_separation import d_separated as d_separated
|
||||
from .dag import (
|
||||
descendants,
|
||||
ancestors,
|
||||
topological_sort,
|
||||
lexicographical_topological_sort,
|
||||
all_topological_sorts,
|
||||
topological_generations,
|
||||
is_directed_acyclic_graph,
|
||||
is_aperiodic,
|
||||
transitive_closure,
|
||||
transitive_closure_dag,
|
||||
transitive_reduction,
|
||||
antichains,
|
||||
dag_longest_path,
|
||||
dag_longest_path_length,
|
||||
dag_to_branching,
|
||||
)
|
||||
from .distance_measures import (
|
||||
extrema_bounding,
|
||||
eccentricity,
|
||||
diameter,
|
||||
radius,
|
||||
periphery,
|
||||
center,
|
||||
barycenter,
|
||||
resistance_distance,
|
||||
)
|
||||
from .distance_regular import (
|
||||
is_distance_regular,
|
||||
is_strongly_regular,
|
||||
intersection_array,
|
||||
global_parameters,
|
||||
)
|
||||
from .dominance import immediate_dominators, dominance_frontiers
|
||||
from .dominating import dominating_set, is_dominating_set
|
||||
from .efficiency_measures import efficiency, local_efficiency, global_efficiency
|
||||
from .euler import (
|
||||
is_eulerian,
|
||||
eulerian_circuit,
|
||||
eulerize,
|
||||
is_semieulerian,
|
||||
has_eulerian_path,
|
||||
eulerian_path,
|
||||
)
|
||||
from .graphical import (
|
||||
is_graphical,
|
||||
is_multigraphical,
|
||||
is_pseudographical,
|
||||
is_digraphical,
|
||||
is_valid_degree_sequence_erdos_gallai,
|
||||
is_valid_degree_sequence_havel_hakimi,
|
||||
)
|
||||
from .hierarchy import flow_hierarchy as flow_hierarchy
|
||||
from .hybrid import kl_connected_subgraph, is_kl_connected
|
||||
from .link_analysis import *
|
||||
from .link_prediction import (
|
||||
resource_allocation_index,
|
||||
jaccard_coefficient,
|
||||
adamic_adar_index,
|
||||
preferential_attachment,
|
||||
cn_soundarajan_hopcroft,
|
||||
ra_index_soundarajan_hopcroft,
|
||||
within_inter_cluster,
|
||||
common_neighbor_centrality,
|
||||
)
|
||||
from .lowest_common_ancestors import (
|
||||
all_pairs_lowest_common_ancestor,
|
||||
tree_all_pairs_lowest_common_ancestor,
|
||||
lowest_common_ancestor,
|
||||
)
|
||||
from .isolate import is_isolate, isolates, number_of_isolates
|
||||
from .matching import (
|
||||
is_matching,
|
||||
is_maximal_matching,
|
||||
is_perfect_matching,
|
||||
max_weight_matching,
|
||||
min_weight_matching,
|
||||
maximal_matching,
|
||||
)
|
||||
from .minors import *
|
||||
from .mis import maximal_independent_set as maximal_independent_set
|
||||
from .moral import moral_graph as moral_graph
|
||||
from .non_randomness import non_randomness as non_randomness
|
||||
from .operators import *
|
||||
from .planarity import check_planarity, is_planar, PlanarEmbedding
|
||||
from .planar_drawing import (
|
||||
combinatorial_embedding_to_pos as combinatorial_embedding_to_pos,
|
||||
)
|
||||
from .reciprocity import reciprocity, overall_reciprocity
|
||||
from .regular import is_regular, is_k_regular, k_factor
|
||||
from .richclub import rich_club_coefficient as rich_club_coefficient
|
||||
from .shortest_paths import *
|
||||
from .similarity import (
|
||||
graph_edit_distance,
|
||||
optimal_edit_paths,
|
||||
optimize_graph_edit_distance,
|
||||
optimize_edit_paths,
|
||||
simrank_similarity,
|
||||
simrank_similarity_numpy,
|
||||
panther_similarity,
|
||||
generate_random_paths,
|
||||
)
|
||||
from .graph_hashing import (
|
||||
weisfeiler_lehman_graph_hash,
|
||||
weisfeiler_lehman_subgraph_hashes,
|
||||
)
|
||||
from .simple_paths import (
|
||||
all_simple_paths,
|
||||
is_simple_path,
|
||||
shortest_simple_paths,
|
||||
all_simple_edge_paths,
|
||||
)
|
||||
from .smallworld import random_reference, lattice_reference, sigma, omega
|
||||
from .smetric import s_metric as s_metric
|
||||
from .structuralholes import constraint, local_constraint, effective_size
|
||||
from .sparsifiers import spanner as spanner
|
||||
from .summarization import dedensify, snap_aggregation
|
||||
from .swap import double_edge_swap, connected_double_edge_swap
|
||||
from .traversal import *
|
||||
from .triads import (
|
||||
triadic_census,
|
||||
is_triad,
|
||||
all_triplets,
|
||||
all_triads,
|
||||
triads_by_type,
|
||||
triad_type,
|
||||
random_triad,
|
||||
)
|
||||
from .vitality import closeness_vitality as closeness_vitality
|
||||
from .voronoi import voronoi_cells as voronoi_cells
|
||||
from .wiener import wiener_index as wiener_index
|
||||
from .polynomials import tutte_polynomial, chromatic_polynomial
|
||||
|
||||
# Make certain subpackages available to the user as direct imports from
|
||||
# the `networkx` namespace.
|
||||
import approximation as approximation
|
||||
import assortativity as assortativity
|
||||
import bipartite as bipartite
|
||||
import node_classification as node_classification
|
||||
import centrality as centrality
|
||||
import chordal as chordal
|
||||
import cluster as cluster
|
||||
import clique as clique
|
||||
import components as components
|
||||
import connectivity as connectivity
|
||||
import community as community
|
||||
import coloring as coloring
|
||||
import flow as flow
|
||||
import isomorphism as isomorphism
|
||||
import link_analysis as link_analysis
|
||||
import lowest_common_ancestors as lowest_common_ancestors
|
||||
import operators as operators
|
||||
import shortest_paths as shortest_paths
|
||||
import tournament as tournament
|
||||
import traversal as traversal
|
||||
import tree as tree
|
||||
|
||||
# Make certain functions from some of the previous subpackages available
|
||||
# to the user as direct imports from the `networkx` namespace.
|
||||
from .bipartite import (
|
||||
complete_bipartite_graph as complete_bipartite_graph,
|
||||
)
|
||||
from .bipartite import is_bipartite as is_bipartite
|
||||
from .bipartite import project as project
|
||||
from .bipartite import projected_graph as projected_graph
|
||||
from .connectivity import (
|
||||
all_pairs_node_connectivity as all_pairs_node_connectivity,
|
||||
)
|
||||
from .connectivity import all_node_cuts as all_node_cuts
|
||||
from .connectivity import (
|
||||
average_node_connectivity as average_node_connectivity,
|
||||
)
|
||||
from .connectivity import edge_connectivity as edge_connectivity
|
||||
from .connectivity import edge_disjoint_paths as edge_disjoint_paths
|
||||
from .connectivity import k_components as k_components
|
||||
from .connectivity import k_edge_components as k_edge_components
|
||||
from .connectivity import k_edge_subgraphs as k_edge_subgraphs
|
||||
from .connectivity import k_edge_augmentation as k_edge_augmentation
|
||||
from .connectivity import is_k_edge_connected as is_k_edge_connected
|
||||
from .connectivity import minimum_edge_cut as minimum_edge_cut
|
||||
from .connectivity import minimum_node_cut as minimum_node_cut
|
||||
from .connectivity import node_connectivity as node_connectivity
|
||||
from .connectivity import node_disjoint_paths as node_disjoint_paths
|
||||
from .connectivity import stoer_wagner as stoer_wagner
|
||||
from .flow import capacity_scaling as capacity_scaling
|
||||
from .flow import cost_of_flow as cost_of_flow
|
||||
from .flow import gomory_hu_tree as gomory_hu_tree
|
||||
from .flow import max_flow_min_cost as max_flow_min_cost
|
||||
from .flow import maximum_flow as maximum_flow
|
||||
from .flow import maximum_flow_value as maximum_flow_value
|
||||
from .flow import min_cost_flow as min_cost_flow
|
||||
from .flow import min_cost_flow_cost as min_cost_flow_cost
|
||||
from .flow import minimum_cut as minimum_cut
|
||||
from .flow import minimum_cut_value as minimum_cut_value
|
||||
from .flow import network_simplex as network_simplex
|
||||
from .isomorphism import could_be_isomorphic as could_be_isomorphic
|
||||
from .isomorphism import (
|
||||
fast_could_be_isomorphic as fast_could_be_isomorphic,
|
||||
)
|
||||
from .isomorphism import (
|
||||
faster_could_be_isomorphic as faster_could_be_isomorphic,
|
||||
)
|
||||
from .isomorphism import is_isomorphic as is_isomorphic
|
||||
from .tree.branchings import maximum_branching as maximum_branching
|
||||
from .tree.branchings import (
|
||||
maximum_spanning_arborescence as maximum_spanning_arborescence,
|
||||
)
|
||||
from .tree.branchings import minimum_branching as minimum_branching
|
||||
from .tree.branchings import (
|
||||
minimum_spanning_arborescence as minimum_spanning_arborescence,
|
||||
)
|
||||
from .tree.branchings import (
|
||||
ArborescenceIterator as ArborescenceIterator,
|
||||
)
|
||||
from .tree.coding import (
|
||||
from_nested_tuple,
|
||||
from_prufer_sequence,
|
||||
NotATree,
|
||||
to_nested_tuple,
|
||||
to_prufer_sequence,
|
||||
)
|
||||
from .tree.decomposition import junction_tree as junction_tree
|
||||
from .tree.mst import (
|
||||
minimum_spanning_edges,
|
||||
maximum_spanning_edges,
|
||||
minimum_spanning_tree,
|
||||
maximum_spanning_tree,
|
||||
random_spanning_tree,
|
||||
partition_spanning_tree,
|
||||
EdgePartition,
|
||||
SpanningTreeIterator,
|
||||
)
|
||||
from .tree.operations import join as join
|
||||
from .tree.recognition import is_arborescence, is_branching, is_forest, is_tree
|
|
@ -0,0 +1,45 @@
|
|||
from .clustering_coefficient import average_clustering as average_clustering
|
||||
from ...algorithms.approximation.clique import (
|
||||
clique_removal as clique_removal,
|
||||
max_clique as max_clique,
|
||||
large_clique_size as large_clique_size,
|
||||
maximum_independent_set as maximum_independent_set,
|
||||
)
|
||||
|
||||
from .connectivity import (
|
||||
local_node_connectivity as local_node_connectivity,
|
||||
node_connectivity as node_connectivity,
|
||||
all_pairs_node_connectivity as all_pairs_node_connectivity,
|
||||
)
|
||||
|
||||
from .distance_measures import diameter as diameter
|
||||
|
||||
from .dominating_set import (
|
||||
min_weighted_dominating_set as min_weighted_dominating_set,
|
||||
min_edge_dominating_set as min_edge_dominating_set,
|
||||
)
|
||||
|
||||
from .kcomponents import k_components as k_components
|
||||
from .matching import min_maximal_matching as min_maximal_matching
|
||||
from .ramsey import ramsey_R2 as ramsey_R2
|
||||
from .steinertree import metric_closure as metric_closure, steiner_tree as steiner_tree
|
||||
|
||||
from .traveling_salesman import (
|
||||
traveling_salesman_problem as traveling_salesman_problem,
|
||||
christofides as christofides,
|
||||
asadpour_atsp as asadpour_atsp,
|
||||
greedy_tsp as greedy_tsp,
|
||||
simulated_annealing_tsp as simulated_annealing_tsp,
|
||||
threshold_accepting_tsp as threshold_accepting_tsp,
|
||||
)
|
||||
|
||||
from .treewidth import (
|
||||
treewidth_min_degree as treewidth_min_degree,
|
||||
treewidth_min_fill_in as treewidth_min_fill_in,
|
||||
)
|
||||
|
||||
from .vertex_cover import min_weighted_vertex_cover as min_weighted_vertex_cover
|
||||
from .maxcut import (
|
||||
randomized_partitioning as randomized_partitioning,
|
||||
one_exchange as one_exchange,
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
from ...utils import not_implemented_for
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"clique_removal",
|
||||
"max_clique",
|
||||
"large_clique_size",
|
||||
"maximum_independent_set",
|
||||
]
|
||||
|
||||
def maximum_independent_set(G: Graph) -> set: ...
|
||||
def max_clique(G: Graph) -> set: ...
|
||||
def clique_removal(G: Graph): ...
|
||||
def large_clique_size(G: Graph): ...
|
|
@ -0,0 +1,7 @@
|
|||
from ...utils import not_implemented_for, py_random_state
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["average_clustering"]
|
||||
|
||||
@py_random_state(2)
|
||||
def average_clustering(G: Graph, trials=1000, seed=None) -> float: ...
|
|
@ -0,0 +1,14 @@
|
|||
from typing import Mapping
|
||||
import itertools
|
||||
from operator import itemgetter
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"local_node_connectivity",
|
||||
"node_connectivity",
|
||||
"all_pairs_node_connectivity",
|
||||
]
|
||||
|
||||
def local_node_connectivity(G: Graph, source, target, cutoff=None): ...
|
||||
def node_connectivity(G: Graph, s=None, t=None): ...
|
||||
def all_pairs_node_connectivity(G: Graph, nbunch=None, cutoff=None) -> Mapping: ...
|
|
@ -0,0 +1,7 @@
|
|||
from ...utils.decorators import py_random_state
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["diameter"]
|
||||
|
||||
@py_random_state(1)
|
||||
def diameter(G: Graph, seed=None): ...
|
|
@ -0,0 +1,10 @@
|
|||
from ...utils import not_implemented_for
|
||||
from ..matching import maximal_matching
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]
|
||||
|
||||
# TODO Why doesn't this algorithm work for directed graphs?
|
||||
|
||||
def min_weighted_dominating_set(G: Graph, weight: str | None = None) -> set: ...
|
||||
def min_edge_dominating_set(G: Graph) -> set: ...
|
|
@ -0,0 +1,38 @@
|
|||
from typing import Mapping
|
||||
import itertools
|
||||
from collections import defaultdict
|
||||
from collections.abc import Mapping
|
||||
from functools import cached_property
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from . import local_node_connectivity
|
||||
from ...exception import NetworkXError
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["k_components"]
|
||||
|
||||
def k_components(G: Graph, min_density: float = 0.95) -> Mapping: ...
|
||||
|
||||
class _AntiGraph(Graph):
|
||||
|
||||
all_edge_dict: dict = ...
|
||||
|
||||
def single_edge_dict(self): ...
|
||||
|
||||
edge_attr_dict_factory = single_edge_dict # type: ignore
|
||||
|
||||
def __getitem__(self, n) -> Mapping: ...
|
||||
def neighbors(self, n): ...
|
||||
|
||||
...
|
||||
...
|
||||
|
||||
@cached_property
|
||||
def adj(self): ...
|
||||
def subgraph(self, nodes): ...
|
||||
|
||||
...
|
||||
|
||||
@cached_property
|
||||
def degree(self): ...
|
||||
def adjacency(self): ...
|
|
@ -0,0 +1,5 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["min_maximal_matching"]
|
||||
|
||||
def min_maximal_matching(G: Graph) -> set: ...
|
|
@ -0,0 +1,15 @@
|
|||
from typing import Any
|
||||
from ..._typing import Scalar
|
||||
from ...utils.decorators import not_implemented_for, py_random_state
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["randomized_partitioning", "one_exchange"]
|
||||
|
||||
@py_random_state(1)
|
||||
def randomized_partitioning(
|
||||
G: Graph, seed=None, p: Scalar = 0.5, weight: Any = None
|
||||
): ...
|
||||
@py_random_state(2)
|
||||
def one_exchange(
|
||||
G: Graph, initial_cut: set | None = None, seed=None, weight: Any = None
|
||||
): ...
|
|
@ -0,0 +1,7 @@
|
|||
from ...utils import not_implemented_for
|
||||
from ...utils import arbitrary_element
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["ramsey_R2"]
|
||||
|
||||
def ramsey_R2(G: Graph): ...
|
|
@ -0,0 +1,9 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from itertools import chain
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for, pairwise
|
||||
|
||||
__all__ = ["metric_closure", "steiner_tree"]
|
||||
|
||||
def metric_closure(G: Graph, weight="weight"): ...
|
||||
def steiner_tree(G: Graph, terminal_nodes: ArrayLike, weight="weight"): ...
|
|
@ -0,0 +1,54 @@
|
|||
from typing import Mapping, Literal
|
||||
from numpy.typing import ArrayLike
|
||||
from ...classes.graph import Graph
|
||||
import math
|
||||
|
||||
from ...algorithms.tree.mst import random_spanning_tree
|
||||
from ...utils import not_implemented_for, pairwise, py_random_state
|
||||
|
||||
__all__ = [
|
||||
"traveling_salesman_problem",
|
||||
"christofides",
|
||||
"asadpour_atsp",
|
||||
"greedy_tsp",
|
||||
"simulated_annealing_tsp",
|
||||
"threshold_accepting_tsp",
|
||||
]
|
||||
|
||||
def swap_two_nodes(soln, seed) -> ArrayLike: ...
|
||||
def move_one_node(soln, seed) -> ArrayLike: ...
|
||||
def christofides(G: Graph, weight="weight", tree=None) -> ArrayLike: ...
|
||||
def traveling_salesman_problem(
|
||||
G: Graph, weight="weight", nodes=None, cycle=True, method=None
|
||||
) -> ArrayLike: ...
|
||||
@py_random_state(2)
|
||||
def asadpour_atsp(G: Graph, weight="weight", seed=None, source=None): ...
|
||||
def held_karp_ascent(G: Graph, weight="weight"): ...
|
||||
def spanning_tree_distribution(G: Graph, z: Mapping) -> Mapping: ...
|
||||
def greedy_tsp(G: Graph, weight="weight", source=None): ...
|
||||
@py_random_state(9)
|
||||
def simulated_annealing_tsp(
|
||||
G: Graph,
|
||||
init_cycle,
|
||||
weight="weight",
|
||||
source=None,
|
||||
temp=100,
|
||||
move="1-1",
|
||||
max_iterations=10,
|
||||
N_inner=100,
|
||||
alpha=0.01,
|
||||
seed=None,
|
||||
): ...
|
||||
@py_random_state(9)
|
||||
def threshold_accepting_tsp(
|
||||
G: Graph,
|
||||
init_cycle: ArrayLike | Literal["greedy"],
|
||||
weight="weight",
|
||||
source=None,
|
||||
threshold=1,
|
||||
move="1-1",
|
||||
max_iterations=10,
|
||||
N_inner=100,
|
||||
alpha=0.1,
|
||||
seed=None,
|
||||
): ...
|
|
@ -0,0 +1,17 @@
|
|||
import itertools
|
||||
import sys
|
||||
from heapq import heapify, heappop, heappush
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["treewidth_min_degree", "treewidth_min_fill_in"]
|
||||
|
||||
def treewidth_min_degree(G: Graph): ...
|
||||
def treewidth_min_fill_in(G: Graph): ...
|
||||
|
||||
class MinDegreeHeuristic:
|
||||
def __init__(self, graph): ...
|
||||
def best_node(self, graph): ...
|
||||
|
||||
def min_fill_in_heuristic(graph): ...
|
||||
def treewidth_decomp(G: Graph, heuristic=...): ...
|
|
@ -0,0 +1,4 @@
|
|||
__all__ = ["min_weighted_vertex_cover"]
|
||||
from ...classes.graph import Graph
|
||||
|
||||
def min_weighted_vertex_cover(G: Graph, weight=None) -> set: ...
|
|
@ -0,0 +1,23 @@
|
|||
from .connectivity import (
|
||||
average_degree_connectivity as average_degree_connectivity,
|
||||
k_nearest_neighbors as k_nearest_neighbors,
|
||||
)
|
||||
from .correlation import (
|
||||
degree_pearson_correlation_coefficient as degree_pearson_correlation_coefficient,
|
||||
degree_assortativity_coefficient as degree_assortativity_coefficient,
|
||||
attribute_assortativity_coefficient as attribute_assortativity_coefficient,
|
||||
numeric_assortativity_coefficient as numeric_assortativity_coefficient,
|
||||
)
|
||||
from .mixing import (
|
||||
attribute_mixing_matrix as attribute_mixing_matrix,
|
||||
attribute_mixing_dict as attribute_mixing_dict,
|
||||
degree_mixing_matrix as degree_mixing_matrix,
|
||||
degree_mixing_dict as degree_mixing_dict,
|
||||
numeric_mixing_matrix as numeric_mixing_matrix,
|
||||
mixing_dict as mixing_dict,
|
||||
)
|
||||
from .neighbor_degree import average_neighbor_degree as average_neighbor_degree
|
||||
from .pairs import (
|
||||
node_attribute_xy as node_attribute_xy,
|
||||
node_degree_xy as node_degree_xy,
|
||||
)
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Literal, Mapping
|
||||
from collections import defaultdict
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["average_degree_connectivity", "k_nearest_neighbors"]
|
||||
|
||||
def average_degree_connectivity(
|
||||
G: Graph,
|
||||
source="in+out",
|
||||
target: Literal["in+out", "out", "in"] = "in+out",
|
||||
nodes=None,
|
||||
weight=None,
|
||||
) -> Mapping: ...
|
||||
def k_nearest_neighbors(
|
||||
G: Graph, source="in+out", target="in+out", nodes=None, weight=None
|
||||
): ...
|
|
@ -0,0 +1,27 @@
|
|||
from ...classes.graph import Graph
|
||||
from .mixing import (
|
||||
attribute_mixing_matrix,
|
||||
degree_mixing_matrix,
|
||||
)
|
||||
from .pairs import node_degree_xy
|
||||
|
||||
__all__ = [
|
||||
"degree_pearson_correlation_coefficient",
|
||||
"degree_assortativity_coefficient",
|
||||
"attribute_assortativity_coefficient",
|
||||
"numeric_assortativity_coefficient",
|
||||
]
|
||||
|
||||
def degree_assortativity_coefficient(
|
||||
G: Graph, x="out", y="in", weight=None, nodes=None
|
||||
) -> float: ...
|
||||
def degree_pearson_correlation_coefficient(
|
||||
G: Graph, x="out", y="in", weight=None, nodes=None
|
||||
) -> float: ...
|
||||
def attribute_assortativity_coefficient(
|
||||
G: Graph, attribute: str, nodes=None
|
||||
) -> float: ...
|
||||
def numeric_assortativity_coefficient(
|
||||
G: Graph, attribute: str, nodes=None
|
||||
) -> float: ...
|
||||
def attribute_ac(M): ...
|
|
@ -0,0 +1,44 @@
|
|||
from typing import Mapping
|
||||
from .pairs import node_attribute_xy, node_degree_xy
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import dict_to_numpy_array
|
||||
|
||||
__all__ = [
|
||||
"attribute_mixing_matrix",
|
||||
"attribute_mixing_dict",
|
||||
"degree_mixing_matrix",
|
||||
"degree_mixing_dict",
|
||||
"numeric_mixing_matrix",
|
||||
"mixing_dict",
|
||||
]
|
||||
|
||||
def attribute_mixing_dict(
|
||||
G: Graph, attribute: str, nodes=None, normalized=False
|
||||
) -> Mapping: ...
|
||||
def attribute_mixing_matrix(
|
||||
G: Graph,
|
||||
attribute: str,
|
||||
nodes=None,
|
||||
mapping: Mapping | None = None,
|
||||
normalized=True,
|
||||
): ...
|
||||
def degree_mixing_dict(
|
||||
G: Graph, x="out", y="in", weight=None, nodes=None, normalized=False
|
||||
) -> Mapping: ...
|
||||
def degree_mixing_matrix(
|
||||
G: Graph,
|
||||
x="out",
|
||||
y="in",
|
||||
weight=None,
|
||||
nodes=None,
|
||||
normalized=True,
|
||||
mapping: Mapping | None = None,
|
||||
): ...
|
||||
def numeric_mixing_matrix(
|
||||
G: Graph,
|
||||
attribute: str,
|
||||
nodes=None,
|
||||
normalized=True,
|
||||
mapping: Mapping | None = None,
|
||||
): ...
|
||||
def mixing_dict(xy, normalized=False) -> Mapping: ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["average_neighbor_degree"]
|
||||
|
||||
def average_neighbor_degree(
|
||||
G: Graph, source="out", target="out", nodes=None, weight=None
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,6 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["node_attribute_xy", "node_degree_xy"]
|
||||
|
||||
def node_attribute_xy(G: Graph, attribute, nodes=None): ...
|
||||
def node_degree_xy(G: Graph, x="out", y="in", weight=None, nodes=None): ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = ["is_at_free", "find_asteroidal_triple"]
|
||||
|
||||
def find_asteroidal_triple(G: Graph) -> list | None: ...
|
||||
def is_at_free(G: Graph) -> bool: ...
|
||||
def create_component_structure(G: Graph) -> Mapping: ...
|
|
@ -0,0 +1,58 @@
|
|||
from .basic import (
|
||||
is_bipartite as is_bipartite,
|
||||
is_bipartite_node_set as is_bipartite_node_set,
|
||||
color as color,
|
||||
sets as sets,
|
||||
density as density,
|
||||
degrees as degrees,
|
||||
)
|
||||
from .centrality import (
|
||||
degree_centrality as degree_centrality,
|
||||
betweenness_centrality as betweenness_centrality,
|
||||
closeness_centrality as closeness_centrality,
|
||||
)
|
||||
from .cluster import (
|
||||
clustering as clustering,
|
||||
average_clustering as average_clustering,
|
||||
latapy_clustering as latapy_clustering,
|
||||
robins_alexander_clustering as robins_alexander_clustering,
|
||||
)
|
||||
from .covering import min_edge_cover as min_edge_cover
|
||||
from .edgelist import (
|
||||
generate_edgelist as generate_edgelist,
|
||||
write_edgelist as write_edgelist,
|
||||
parse_edgelist as parse_edgelist,
|
||||
read_edgelist as read_edgelist,
|
||||
)
|
||||
from .matching import (
|
||||
maximum_matching as maximum_matching,
|
||||
hopcroft_karp_matching as hopcroft_karp_matching,
|
||||
eppstein_matching as eppstein_matching,
|
||||
to_vertex_cover as to_vertex_cover,
|
||||
minimum_weight_full_matching as minimum_weight_full_matching,
|
||||
)
|
||||
from .matrix import (
|
||||
biadjacency_matrix as biadjacency_matrix,
|
||||
from_biadjacency_matrix as from_biadjacency_matrix,
|
||||
)
|
||||
from .projection import (
|
||||
project as project,
|
||||
projected_graph as projected_graph,
|
||||
weighted_projected_graph as weighted_projected_graph,
|
||||
collaboration_weighted_projected_graph as collaboration_weighted_projected_graph,
|
||||
overlap_weighted_projected_graph as overlap_weighted_projected_graph,
|
||||
generic_weighted_projected_graph as generic_weighted_projected_graph,
|
||||
)
|
||||
|
||||
from .redundancy import node_redundancy as node_redundancy
|
||||
from .spectral import spectral_bipartivity as spectral_bipartivity
|
||||
from .generators import (
|
||||
configuration_model as configuration_model,
|
||||
havel_hakimi_graph as havel_hakimi_graph,
|
||||
reverse_havel_hakimi_graph as reverse_havel_hakimi_graph,
|
||||
alternating_havel_hakimi_graph as alternating_havel_hakimi_graph,
|
||||
preferential_attachment_graph as preferential_attachment_graph,
|
||||
random_graph as random_graph,
|
||||
gnmk_random_graph as gnmk_random_graph,
|
||||
complete_bipartite_graph as complete_bipartite_graph,
|
||||
)
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Mapping
|
||||
|
||||
from ...algorithms.components import connected_components
|
||||
from ...classes.graph import Graph
|
||||
from ...exception import AmbiguousSolution
|
||||
|
||||
__all__ = [
|
||||
"is_bipartite",
|
||||
"is_bipartite_node_set",
|
||||
"color",
|
||||
"sets",
|
||||
"density",
|
||||
"degrees",
|
||||
]
|
||||
|
||||
def color(G: Graph) -> Mapping: ...
|
||||
def is_bipartite(G: Graph): ...
|
||||
def is_bipartite_node_set(G: Graph, nodes): ...
|
||||
def sets(G: Graph, top_nodes=None) -> tuple[set, set]: ...
|
||||
def density(B, nodes) -> float: ...
|
||||
def degrees(B, nodes, weight=None) -> tuple[dict, ...]: ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["degree_centrality", "betweenness_centrality", "closeness_centrality"]
|
||||
|
||||
def degree_centrality(G: Graph, nodes) -> Mapping: ...
|
||||
def betweenness_centrality(G: Graph, nodes) -> Mapping: ...
|
||||
def closeness_centrality(G: Graph, nodes, normalized: bool = True) -> Mapping: ...
|
|
@ -0,0 +1,29 @@
|
|||
from collections.abc import Iterable
|
||||
from typing import Mapping
|
||||
from numpy.typing import ArrayLike
|
||||
|
||||
import itertools
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"clustering",
|
||||
"average_clustering",
|
||||
"latapy_clustering",
|
||||
"robins_alexander_clustering",
|
||||
]
|
||||
|
||||
def cc_dot(nu, nv): ...
|
||||
def cc_max(nu, nv): ...
|
||||
def cc_min(nu, nv): ...
|
||||
|
||||
modes: dict = ...
|
||||
|
||||
def latapy_clustering(G: Graph, nodes=None, mode: str = "dot") -> Mapping: ...
|
||||
|
||||
clustering = ...
|
||||
|
||||
def average_clustering(
|
||||
G: Graph, nodes: ArrayLike | Iterable | None = None, mode: str = "dot"
|
||||
) -> float: ...
|
||||
def robins_alexander_clustering(G: Graph) -> float: ...
|
|
@ -0,0 +1,8 @@
|
|||
from .matching import hopcroft_karp_matching
|
||||
from ...algorithms.covering import min_edge_cover as _min_edge_cover
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["min_edge_cover"]
|
||||
|
||||
def min_edge_cover(G: Graph, matching_algorithm=None) -> set: ...
|
|
@ -0,0 +1,34 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["generate_edgelist", "write_edgelist", "parse_edgelist", "read_edgelist"]
|
||||
|
||||
from ...utils import not_implemented_for, open_file
|
||||
|
||||
def write_edgelist(
|
||||
G: Graph,
|
||||
path,
|
||||
comments: str = "#",
|
||||
delimiter: str = " ",
|
||||
data: bool | ArrayLike = True,
|
||||
encoding: str = "utf-8",
|
||||
): ...
|
||||
def generate_edgelist(G: Graph, delimiter: str = " ", data=True) -> str: ...
|
||||
def parse_edgelist(
|
||||
lines,
|
||||
comments: str = "#",
|
||||
delimiter: str | None = None,
|
||||
create_using=None,
|
||||
nodetype=None,
|
||||
data=True,
|
||||
): ...
|
||||
def read_edgelist(
|
||||
path,
|
||||
comments: str = "#",
|
||||
delimiter: str | None = None,
|
||||
create_using=None,
|
||||
nodetype=None,
|
||||
data=True,
|
||||
edgetype=None,
|
||||
encoding: str = "utf-8",
|
||||
): ...
|
|
@ -0,0 +1,37 @@
|
|||
from numpy.typing import ArrayLike
|
||||
import math
|
||||
import numbers
|
||||
from functools import reduce
|
||||
from ...classes.graph import Graph
|
||||
|
||||
from ...utils import nodes_or_number, py_random_state
|
||||
|
||||
__all__ = [
|
||||
"configuration_model",
|
||||
"havel_hakimi_graph",
|
||||
"reverse_havel_hakimi_graph",
|
||||
"alternating_havel_hakimi_graph",
|
||||
"preferential_attachment_graph",
|
||||
"random_graph",
|
||||
"gnmk_random_graph",
|
||||
"complete_bipartite_graph",
|
||||
]
|
||||
|
||||
def complete_bipartite_graph(n1, n2, create_using=None): ...
|
||||
@py_random_state(3)
|
||||
def configuration_model(
|
||||
aseq: ArrayLike, bseq: ArrayLike, create_using=None, seed=None
|
||||
): ...
|
||||
def havel_hakimi_graph(aseq: ArrayLike, bseq: ArrayLike, create_using=None): ...
|
||||
def reverse_havel_hakimi_graph(aseq: ArrayLike, bseq: ArrayLike, create_using=None): ...
|
||||
def alternating_havel_hakimi_graph(
|
||||
aseq: ArrayLike, bseq: ArrayLike, create_using=None
|
||||
): ...
|
||||
@py_random_state(3)
|
||||
def preferential_attachment_graph(
|
||||
aseq: ArrayLike, p: float, create_using=None, seed=None
|
||||
): ...
|
||||
@py_random_state(3)
|
||||
def random_graph(n: int, m: int, p: float, seed=None, directed=False): ...
|
||||
@py_random_state(3)
|
||||
def gnmk_random_graph(n: int, m: int, k: int, seed=None, directed=False): ...
|
|
@ -0,0 +1,40 @@
|
|||
from typing import Mapping
|
||||
|
||||
# This module uses material from the Wikipedia article Hopcroft--Karp algorithm
|
||||
# <https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm>, accessed on
|
||||
# January 3, 2015, which is released under the Creative Commons
|
||||
# Attribution-Share-Alike License 3.0
|
||||
# <http://creativecommons.org/licenses/by-sa/3.0/>. That article includes
|
||||
# pseudocode, which has been translated into the corresponding Python code.
|
||||
#
|
||||
# Portions of this module use code from David Eppstein's Python Algorithms and
|
||||
# Data Structures (PADS) library, which is dedicated to the public domain (for
|
||||
# proof, see <http://www.ics.uci.edu/~eppstein/PADS/ABOUT-PADS.txt>).
|
||||
import collections
|
||||
import itertools
|
||||
|
||||
from .matrix import biadjacency_matrix
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"maximum_matching",
|
||||
"hopcroft_karp_matching",
|
||||
"eppstein_matching",
|
||||
"to_vertex_cover",
|
||||
"minimum_weight_full_matching",
|
||||
]
|
||||
|
||||
INFINITY = ...
|
||||
|
||||
def hopcroft_karp_matching(G: Graph, top_nodes=None) -> Mapping: ...
|
||||
def eppstein_matching(G: Graph, top_nodes=None) -> Mapping: ...
|
||||
def to_vertex_cover(G: Graph, matching: Mapping, top_nodes=None): ...
|
||||
|
||||
#: Returns the maximum cardinality matching in the given bipartite graph.
|
||||
#:
|
||||
#: This function is simply an alias for :func:`hopcroft_karp_matching`.
|
||||
maximum_matching = ...
|
||||
|
||||
def minimum_weight_full_matching(
|
||||
G: Graph, top_nodes=None, weight="weight"
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,16 @@
|
|||
from numpy.typing import ArrayLike
|
||||
import itertools
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["biadjacency_matrix", "from_biadjacency_matrix"]
|
||||
|
||||
def biadjacency_matrix(
|
||||
G: Graph,
|
||||
row_order,
|
||||
column_order: ArrayLike | None = None,
|
||||
dtype=None,
|
||||
weight="weight",
|
||||
format="csr",
|
||||
): ...
|
||||
def from_biadjacency_matrix(A, create_using=None, edge_attribute: str = "weight"): ...
|
|
@ -0,0 +1,22 @@
|
|||
from collections.abc import Iterable
|
||||
from numpy.typing import ArrayLike
|
||||
from ...exception import NetworkXAlgorithmError
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"project",
|
||||
"projected_graph",
|
||||
"weighted_projected_graph",
|
||||
"collaboration_weighted_projected_graph",
|
||||
"overlap_weighted_projected_graph",
|
||||
"generic_weighted_projected_graph",
|
||||
]
|
||||
|
||||
def projected_graph(B, nodes: ArrayLike | Iterable, multigraph=False): ...
|
||||
def weighted_projected_graph(B, nodes: ArrayLike | Iterable, ratio=False): ...
|
||||
def collaboration_weighted_projected_graph(B, nodes: ArrayLike | Iterable): ...
|
||||
def overlap_weighted_projected_graph(B, nodes: ArrayLike | Iterable, jaccard=True): ...
|
||||
def generic_weighted_projected_graph(
|
||||
B, nodes: ArrayLike | Iterable, weight_function=None
|
||||
): ...
|
||||
def project(B, nodes, create_using=None): ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
from itertools import combinations
|
||||
|
||||
from networkx import NetworkXError
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["node_redundancy"]
|
||||
|
||||
def node_redundancy(G: Graph, nodes=None) -> Mapping: ...
|
|
@ -0,0 +1,5 @@
|
|||
__all__ = ["spectral_bipartivity"]
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
def spectral_bipartivity(G: Graph, nodes=None, weight="weight") -> float | dict: ...
|
|
@ -0,0 +1,18 @@
|
|||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
from itertools import chain
|
||||
from ..classes.graph import Graph
|
||||
|
||||
__all__ = ["edge_boundary", "node_boundary"]
|
||||
|
||||
def edge_boundary(
|
||||
G: Graph,
|
||||
nbunch1: Iterable,
|
||||
nbunch2: Iterable | None = None,
|
||||
data: bool | Any = False,
|
||||
keys: bool = False,
|
||||
default: Any = None,
|
||||
): ...
|
||||
def node_boundary(
|
||||
G: Graph, nbunch1: Iterable, nbunch2: Iterable | None = None
|
||||
) -> set: ...
|
|
@ -0,0 +1,10 @@
|
|||
from itertools import chain
|
||||
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = ["bridges", "has_bridges", "local_bridges"]
|
||||
|
||||
def bridges(G: Graph, root=None): ...
|
||||
def has_bridges(G: Graph, root=None) -> bool: ...
|
||||
def local_bridges(G: Graph, with_span: bool = True, weight=None): ...
|
|
@ -0,0 +1,74 @@
|
|||
from .betweenness import (
|
||||
betweenness_centrality as betweenness_centrality,
|
||||
edge_betweenness_centrality as edge_betweenness_centrality,
|
||||
edge_betweenness as edge_betweenness,
|
||||
)
|
||||
from .betweenness_subset import (
|
||||
betweenness_centrality_subset as betweenness_centrality_subset,
|
||||
betweenness_centrality_source as betweenness_centrality_source,
|
||||
edge_betweenness_centrality_subset as edge_betweenness_centrality_subset,
|
||||
)
|
||||
from .closeness import (
|
||||
closeness_centrality as closeness_centrality,
|
||||
incremental_closeness_centrality as incremental_closeness_centrality,
|
||||
)
|
||||
from .current_flow_betweenness import (
|
||||
current_flow_betweenness_centrality as current_flow_betweenness_centrality,
|
||||
approximate_current_flow_betweenness_centrality as approximate_current_flow_betweenness_centrality,
|
||||
edge_current_flow_betweenness_centrality as edge_current_flow_betweenness_centrality,
|
||||
)
|
||||
from .current_flow_betweenness_subset import (
|
||||
current_flow_betweenness_centrality_subset as current_flow_betweenness_centrality_subset,
|
||||
edge_current_flow_betweenness_centrality_subset as edge_current_flow_betweenness_centrality_subset,
|
||||
)
|
||||
from .current_flow_closeness import (
|
||||
current_flow_closeness_centrality as current_flow_closeness_centrality,
|
||||
information_centrality as information_centrality,
|
||||
)
|
||||
from .degree_alg import (
|
||||
degree_centrality as degree_centrality,
|
||||
in_degree_centrality as in_degree_centrality,
|
||||
out_degree_centrality as out_degree_centrality,
|
||||
)
|
||||
from .dispersion import dispersion as dispersion
|
||||
from .eigenvector import (
|
||||
eigenvector_centrality as eigenvector_centrality,
|
||||
eigenvector_centrality_numpy as eigenvector_centrality_numpy,
|
||||
)
|
||||
from .group import (
|
||||
group_betweenness_centrality as group_betweenness_centrality,
|
||||
group_closeness_centrality as group_closeness_centrality,
|
||||
group_degree_centrality as group_degree_centrality,
|
||||
group_in_degree_centrality as group_in_degree_centrality,
|
||||
group_out_degree_centrality as group_out_degree_centrality,
|
||||
prominent_group as prominent_group,
|
||||
)
|
||||
from .harmonic import harmonic_centrality as harmonic_centrality
|
||||
from .katz import (
|
||||
katz_centrality as katz_centrality,
|
||||
katz_centrality_numpy as katz_centrality_numpy,
|
||||
)
|
||||
from .load import (
|
||||
load_centrality as load_centrality,
|
||||
edge_load_centrality as edge_load_centrality,
|
||||
)
|
||||
from .percolation import (
|
||||
percolation_centrality as percolation_centrality,
|
||||
)
|
||||
from .reaching import (
|
||||
global_reaching_centrality as global_reaching_centrality,
|
||||
local_reaching_centrality as local_reaching_centrality,
|
||||
)
|
||||
from .second_order import second_order_centrality as second_order_centrality
|
||||
from .subgraph_alg import (
|
||||
subgraph_centrality_exp as subgraph_centrality_exp,
|
||||
subgraph_centrality as subgraph_centrality,
|
||||
communicability_betweenness_centrality as communicability_betweenness_centrality,
|
||||
estrada_index as estrada_index,
|
||||
)
|
||||
from .trophic import (
|
||||
trophic_levels as trophic_levels,
|
||||
trophic_differences as trophic_differences,
|
||||
trophic_incoherence_parameter as trophic_incoherence_parameter,
|
||||
)
|
||||
from .voterank_alg import voterank as voterank
|
|
@ -0,0 +1,28 @@
|
|||
from typing import Mapping
|
||||
import warnings
|
||||
from collections import deque
|
||||
from heapq import heappop, heappush
|
||||
from itertools import count
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import py_random_state
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = ["betweenness_centrality", "edge_betweenness_centrality", "edge_betweenness"]
|
||||
|
||||
@py_random_state(5)
|
||||
def betweenness_centrality(
|
||||
G: Graph,
|
||||
k=None,
|
||||
normalized: bool = True,
|
||||
weight=None,
|
||||
endpoints: bool = False,
|
||||
seed=None,
|
||||
) -> Mapping: ...
|
||||
@py_random_state(4)
|
||||
def edge_betweenness_centrality(
|
||||
G: Graph, k=None, normalized: bool = True, weight=None, seed=None
|
||||
) -> Mapping: ...
|
||||
|
||||
# obsolete name
|
||||
def edge_betweenness(G: Graph, k=None, normalized=True, weight=None, seed=None): ...
|
|
@ -0,0 +1,22 @@
|
|||
from typing import Mapping
|
||||
import warnings
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"betweenness_centrality_subset",
|
||||
"betweenness_centrality_source",
|
||||
"edge_betweenness_centrality_subset",
|
||||
]
|
||||
|
||||
def betweenness_centrality_subset(
|
||||
G: Graph, sources, targets, normalized: bool = False, weight=None
|
||||
) -> Mapping: ...
|
||||
def edge_betweenness_centrality_subset(
|
||||
G: Graph, sources, targets, normalized: bool = False, weight=None
|
||||
) -> Mapping: ...
|
||||
|
||||
# obsolete name
|
||||
def betweenness_centrality_source(
|
||||
G: Graph, normalized=True, weight=None, sources=None
|
||||
): ...
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Mapping
|
||||
import functools
|
||||
from ...classes.graph import Graph
|
||||
|
||||
from ...exception import NetworkXError
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = ["closeness_centrality", "incremental_closeness_centrality"]
|
||||
|
||||
def closeness_centrality(
|
||||
G: Graph, u=None, distance=None, wf_improved=True
|
||||
) -> Mapping: ...
|
||||
def incremental_closeness_centrality(
|
||||
G: Graph,
|
||||
edge: tuple,
|
||||
prev_cc: Mapping | None = None,
|
||||
insertion: bool = True,
|
||||
wf_improved=True,
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,37 @@
|
|||
from typing import Mapping
|
||||
from .flow_matrix import (
|
||||
CGInverseLaplacian,
|
||||
FullInverseLaplacian,
|
||||
SuperLUInverseLaplacian,
|
||||
flow_matrix_row,
|
||||
)
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import (
|
||||
not_implemented_for,
|
||||
py_random_state,
|
||||
reverse_cuthill_mckee_ordering,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"current_flow_betweenness_centrality",
|
||||
"approximate_current_flow_betweenness_centrality",
|
||||
"edge_current_flow_betweenness_centrality",
|
||||
]
|
||||
|
||||
@py_random_state(7)
|
||||
def approximate_current_flow_betweenness_centrality(
|
||||
G: Graph,
|
||||
normalized=True,
|
||||
weight=None,
|
||||
dtype=...,
|
||||
solver="full",
|
||||
epsilon: float = 0.5,
|
||||
kmax: int = 10000,
|
||||
seed=None,
|
||||
) -> Mapping: ...
|
||||
def current_flow_betweenness_centrality(
|
||||
G: Graph, normalized=True, weight=None, dtype=..., solver="full"
|
||||
) -> Mapping: ...
|
||||
def edge_current_flow_betweenness_centrality(
|
||||
G: Graph, normalized=True, weight=None, dtype=..., solver="full"
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,16 @@
|
|||
from typing import Mapping
|
||||
from .flow_matrix import flow_matrix_row
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for, reverse_cuthill_mckee_ordering
|
||||
|
||||
__all__ = [
|
||||
"current_flow_betweenness_centrality_subset",
|
||||
"edge_current_flow_betweenness_centrality_subset",
|
||||
]
|
||||
|
||||
def current_flow_betweenness_centrality_subset(
|
||||
G: Graph, sources, targets, normalized=True, weight=None, dtype=..., solver="lu"
|
||||
) -> Mapping: ...
|
||||
def edge_current_flow_betweenness_centrality_subset(
|
||||
G: Graph, sources, targets, normalized=True, weight=None, dtype=..., solver="lu"
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,16 @@
|
|||
from typing import Mapping
|
||||
from .flow_matrix import (
|
||||
CGInverseLaplacian,
|
||||
FullInverseLaplacian,
|
||||
SuperLUInverseLaplacian,
|
||||
)
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for, reverse_cuthill_mckee_ordering
|
||||
|
||||
__all__ = ["current_flow_closeness_centrality", "information_centrality"]
|
||||
|
||||
def current_flow_closeness_centrality(
|
||||
G: Graph, weight=None, dtype=..., solver="lu"
|
||||
) -> Mapping: ...
|
||||
|
||||
information_centrality = ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
from ...classes.graph import Graph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = ["degree_centrality", "in_degree_centrality", "out_degree_centrality"]
|
||||
|
||||
def degree_centrality(G: Graph) -> Mapping: ...
|
||||
def in_degree_centrality(G: Graph) -> Mapping: ...
|
||||
def out_degree_centrality(G: Graph) -> Mapping: ...
|
|
@ -0,0 +1,10 @@
|
|||
from typing import Mapping
|
||||
from itertools import combinations
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["dispersion"]
|
||||
|
||||
def dispersion(
|
||||
G: Graph, u=None, v=None, normalized: bool = True, alpha=1.0, b=0.0, c=0.0
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,14 @@
|
|||
from typing import Mapping
|
||||
import math
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["eigenvector_centrality", "eigenvector_centrality_numpy"]
|
||||
|
||||
def eigenvector_centrality(
|
||||
G: Graph, max_iter=100, tol=1.0e-6, nstart=None, weight=None
|
||||
) -> Mapping: ...
|
||||
def eigenvector_centrality_numpy(
|
||||
G: Graph, weight=None, max_iter=50, tol=0
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,33 @@
|
|||
# Helpers for current-flow betweenness and current-flow closness
|
||||
# Lazy computations for inverse Laplacian and flow-matrix rows.
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
def flow_matrix_row(G: Graph, weight=None, dtype=..., solver="lu"): ...
|
||||
|
||||
# Class to compute the inverse laplacian only for specified rows
|
||||
# Allows computation of the current-flow matrix without storing entire
|
||||
# inverse laplacian matrix
|
||||
class InverseLaplacian:
|
||||
def __init__(self, L, width=None, dtype=None): ...
|
||||
def init_solver(self, L): ...
|
||||
def solve(self, r): ...
|
||||
def solve_inverse(self, r): ...
|
||||
def get_rows(self, r1, r2): ...
|
||||
def get_row(self, r): ...
|
||||
def width(self, L): ...
|
||||
|
||||
class FullInverseLaplacian(InverseLaplacian):
|
||||
def init_solver(self, L): ...
|
||||
def solve(self, rhs): ...
|
||||
def solve_inverse(self, r): ...
|
||||
|
||||
class SuperLUInverseLaplacian(InverseLaplacian):
|
||||
def init_solver(self, L): ...
|
||||
def solve_inverse(self, r): ...
|
||||
def solve(self, rhs): ...
|
||||
|
||||
class CGInverseLaplacian(InverseLaplacian):
|
||||
def init_solver(self, L): ...
|
||||
def solve(self, rhs): ...
|
||||
def solve_inverse(self, r): ...
|
|
@ -0,0 +1,31 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from copy import deepcopy
|
||||
from ...classes.graph import Graph
|
||||
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"group_betweenness_centrality",
|
||||
"group_closeness_centrality",
|
||||
"group_degree_centrality",
|
||||
"group_in_degree_centrality",
|
||||
"group_out_degree_centrality",
|
||||
"prominent_group",
|
||||
]
|
||||
|
||||
def group_betweenness_centrality(
|
||||
G: Graph, C, normalized=True, weight=None, endpoints=False
|
||||
): ...
|
||||
def prominent_group(
|
||||
G: Graph,
|
||||
k: int,
|
||||
weight=None,
|
||||
C=None,
|
||||
endpoints=False,
|
||||
normalized=True,
|
||||
greedy=False,
|
||||
) -> tuple[float, ArrayLike]: ...
|
||||
def group_closeness_centrality(G: Graph, S: ArrayLike | set, weight=None) -> float: ...
|
||||
def group_degree_centrality(G: Graph, S: ArrayLike | set) -> float: ...
|
||||
def group_in_degree_centrality(G: Graph, S: ArrayLike | set) -> float: ...
|
||||
def group_out_degree_centrality(G: Graph, S: ArrayLike | set) -> float: ...
|
|
@ -0,0 +1,10 @@
|
|||
from typing import Mapping
|
||||
from functools import partial
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["harmonic_centrality"]
|
||||
|
||||
def harmonic_centrality(
|
||||
G: Graph, nbunch=None, distance=None, sources=None
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,25 @@
|
|||
from typing import Mapping
|
||||
import math
|
||||
|
||||
from ...utils import not_implemented_for
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["katz_centrality", "katz_centrality_numpy"]
|
||||
|
||||
def katz_centrality(
|
||||
G: Graph,
|
||||
alpha: float = 0.1,
|
||||
beta=1.0,
|
||||
max_iter=1000,
|
||||
tol=1.0e-6,
|
||||
nstart: Mapping | None = None,
|
||||
normalized=True,
|
||||
weight=None,
|
||||
) -> Mapping: ...
|
||||
def katz_centrality_numpy(
|
||||
G: Graph,
|
||||
alpha: float = 0.1,
|
||||
beta=1.0,
|
||||
normalized: bool = True,
|
||||
weight: str | None = None,
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,14 @@
|
|||
from typing import Mapping
|
||||
from operator import itemgetter
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["load_centrality", "edge_load_centrality"]
|
||||
|
||||
def newman_betweenness_centrality(
|
||||
G: Graph, v=None, cutoff=None, normalized=True, weight=None
|
||||
) -> Mapping: ...
|
||||
|
||||
load_centrality = ...
|
||||
|
||||
def edge_load_centrality(G: Graph, cutoff=False): ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["percolation_centrality"]
|
||||
|
||||
def percolation_centrality(
|
||||
G: Graph, attribute="percolation", states=None, weight=None
|
||||
) -> Mapping: ...
|
|
@ -0,0 +1,11 @@
|
|||
from ...classes.digraph import DiGraph
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import pairwise
|
||||
|
||||
__all__ = ["global_reaching_centrality", "local_reaching_centrality"]
|
||||
|
||||
def global_reaching_centrality(G: DiGraph, weight=None, normalized=True) -> float: ...
|
||||
def local_reaching_centrality(
|
||||
G: DiGraph, v, paths=None, weight=None, normalized=True
|
||||
) -> float: ...
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Mapping
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
# Authors: Erwan Le Merrer (erwan.lemerrer@technicolor.com)
|
||||
|
||||
__all__ = ["second_order_centrality"]
|
||||
|
||||
def second_order_centrality(G: Graph) -> Mapping: ...
|
|
@ -0,0 +1,15 @@
|
|||
from typing import Mapping
|
||||
from ...utils import not_implemented_for
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"subgraph_centrality_exp",
|
||||
"subgraph_centrality",
|
||||
"communicability_betweenness_centrality",
|
||||
"estrada_index",
|
||||
]
|
||||
|
||||
def subgraph_centrality_exp(G: Graph) -> Mapping: ...
|
||||
def subgraph_centrality(G: Graph) -> Mapping: ...
|
||||
def communicability_betweenness_centrality(G: Graph) -> Mapping: ...
|
||||
def estrada_index(G: Graph) -> float: ...
|
|
@ -0,0 +1,11 @@
|
|||
from ...classes.digraph import DiGraph
|
||||
from typing import Mapping
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["trophic_levels", "trophic_differences", "trophic_incoherence_parameter"]
|
||||
|
||||
def trophic_levels(G: DiGraph, weight="weight") -> Mapping: ...
|
||||
def trophic_differences(G: DiGraph, weight="weight") -> Mapping: ...
|
||||
def trophic_incoherence_parameter(
|
||||
G: DiGraph, weight="weight", cannibalism: bool = False
|
||||
) -> float: ...
|
|
@ -0,0 +1,6 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["voterank"]
|
||||
|
||||
def voterank(G: Graph, number_of_nodes=None) -> ArrayLike: ...
|
|
@ -0,0 +1,6 @@
|
|||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = ["chain_decomposition"]
|
||||
|
||||
def chain_decomposition(G: Graph, root=None): ...
|
|
@ -0,0 +1,25 @@
|
|||
import sys
|
||||
import warnings
|
||||
|
||||
from ..classes.graph import Graph
|
||||
from ..algorithms.components import connected_components
|
||||
from ..exception import NetworkXException
|
||||
from ..utils import arbitrary_element, not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"is_chordal",
|
||||
"find_induced_nodes",
|
||||
"chordal_graph_cliques",
|
||||
"chordal_graph_treewidth",
|
||||
"NetworkXTreewidthBoundExceeded",
|
||||
"complete_to_chordal_graph",
|
||||
]
|
||||
|
||||
class NetworkXTreewidthBoundExceeded(NetworkXException):
|
||||
pass
|
||||
|
||||
def is_chordal(G: Graph) -> bool: ...
|
||||
def find_induced_nodes(G: Graph, s, t, treewidth_bound: float = ...): ...
|
||||
def chordal_graph_cliques(G: Graph): ...
|
||||
def chordal_graph_treewidth(G: Graph) -> int: ...
|
||||
def complete_to_chordal_graph(G: Graph): ...
|
|
@ -0,0 +1,47 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from collections import defaultdict, deque
|
||||
from itertools import chain, combinations, islice
|
||||
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"find_cliques",
|
||||
"find_cliques_recursive",
|
||||
"make_max_clique_graph",
|
||||
"make_clique_bipartite",
|
||||
"graph_clique_number",
|
||||
"graph_number_of_cliques",
|
||||
"node_clique_number",
|
||||
"number_of_cliques",
|
||||
"cliques_containing_node",
|
||||
"enumerate_all_cliques",
|
||||
"max_weight_clique",
|
||||
]
|
||||
|
||||
def enumerate_all_cliques(G: Graph): ...
|
||||
def find_cliques(G: Graph, nodes=None): ...
|
||||
|
||||
# TODO Should this also be not implemented for directed graphs?
|
||||
def find_cliques_recursive(G: Graph, nodes=None): ...
|
||||
def make_max_clique_graph(G: Graph, create_using=None): ...
|
||||
def make_clique_bipartite(
|
||||
G: Graph, fpos: bool | None = None, create_using=None, name=None
|
||||
): ...
|
||||
def graph_clique_number(G: Graph, cliques: ArrayLike | None = None) -> int: ...
|
||||
def graph_number_of_cliques(G: Graph, cliques: ArrayLike | None = None) -> int: ...
|
||||
def node_clique_number(
|
||||
G: Graph, nodes=None, cliques=None, separate_nodes=False
|
||||
) -> int | dict: ...
|
||||
def number_of_cliques(G: Graph, nodes=None, cliques=None): ...
|
||||
def cliques_containing_node(G: Graph, nodes=None, cliques=None): ...
|
||||
|
||||
class MaxWeightClique:
|
||||
def __init__(self, G: Graph, weight): ...
|
||||
def update_incumbent_if_improved(self, C, C_weight): ...
|
||||
def greedily_find_independent_set(self, P): ...
|
||||
def find_branching_nodes(self, P, target): ...
|
||||
def expand(self, C, C_weight, P): ...
|
||||
def find_max_weight_clique(self): ...
|
||||
|
||||
def max_weight_clique(G: Graph, weight="weight") -> tuple[ArrayLike, int]: ...
|
|
@ -0,0 +1,24 @@
|
|||
from typing import Mapping
|
||||
|
||||
from collections import Counter
|
||||
from itertools import chain, combinations
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"triangles",
|
||||
"average_clustering",
|
||||
"clustering",
|
||||
"transitivity",
|
||||
"square_clustering",
|
||||
"generalized_degree",
|
||||
]
|
||||
|
||||
def triangles(G: Graph, nodes=None) -> Mapping: ...
|
||||
def average_clustering(
|
||||
G: Graph, nodes=None, weight=None, count_zeros: bool = True
|
||||
) -> float: ...
|
||||
def clustering(G: Graph, nodes=None, weight=None) -> float | dict: ...
|
||||
def transitivity(G: Graph) -> float: ...
|
||||
def square_clustering(G: Graph, nodes=None) -> Mapping: ...
|
||||
def generalized_degree(G: Graph, nodes=None): ...
|
|
@ -0,0 +1,6 @@
|
|||
from .greedy_coloring import greedy_color as greedy_color
|
||||
from .equitable_coloring import (
|
||||
equitable_color as equitable_color,
|
||||
)
|
||||
|
||||
__all__ = ["greedy_color", "equitable_color"]
|
|
@ -0,0 +1,15 @@
|
|||
from collections import defaultdict
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["equitable_color"]
|
||||
|
||||
def is_coloring(G: Graph, coloring): ...
|
||||
def is_equitable(G: Graph, coloring, num_colors=None): ...
|
||||
def make_C_from_F(F): ...
|
||||
def make_N_from_L_C(L, C): ...
|
||||
def make_H_from_C_N(C, N): ...
|
||||
def change_color(u, X, Y, N, H, F, C, L): ...
|
||||
def move_witnesses(src_color, dst_color, N, H, F, C, T_cal, L): ...
|
||||
def pad_graph(G: Graph, num_colors): ...
|
||||
def procedure_P(V_minus, V_plus, N, H, F, C, L, excluded_colors=None): ...
|
||||
def equitable_color(G: Graph, num_colors): ...
|
|
@ -0,0 +1,49 @@
|
|||
import itertools
|
||||
from collections import defaultdict, deque
|
||||
|
||||
from ...utils import arbitrary_element, py_random_state
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"greedy_color",
|
||||
"strategy_connected_sequential",
|
||||
"strategy_connected_sequential_bfs",
|
||||
"strategy_connected_sequential_dfs",
|
||||
"strategy_independent_set",
|
||||
"strategy_largest_first",
|
||||
"strategy_random_sequential",
|
||||
"strategy_saturation_largest_first",
|
||||
"strategy_smallest_last",
|
||||
]
|
||||
|
||||
def strategy_largest_first(G: Graph, colors): ...
|
||||
@py_random_state(2)
|
||||
def strategy_random_sequential(G: Graph, colors, seed=None): ...
|
||||
def strategy_smallest_last(G: Graph, colors): ...
|
||||
def strategy_independent_set(G: Graph, colors): ...
|
||||
def strategy_connected_sequential_bfs(G: Graph, colors): ...
|
||||
def strategy_connected_sequential_dfs(G: Graph, colors): ...
|
||||
def strategy_connected_sequential(G: Graph, colors, traversal="bfs"): ...
|
||||
def strategy_saturation_largest_first(G: Graph, colors): ...
|
||||
|
||||
#: Dictionary mapping name of a strategy as a string to the strategy function.
|
||||
STRATEGIES: dict = ...
|
||||
|
||||
def greedy_color(G: Graph, strategy="largest_first", interchange: bool = False): ...
|
||||
|
||||
# Tools for coloring with interchanges
|
||||
class _Node:
|
||||
__slots__: list = ...
|
||||
|
||||
def __init__(self, node_id, n): ...
|
||||
def __repr__(self): ...
|
||||
def assign_color(self, adj_entry, color): ...
|
||||
def clear_color(self, adj_entry, color): ...
|
||||
def iter_neighbors(self): ...
|
||||
def iter_neighbors_color(self, color): ...
|
||||
|
||||
class _AdjEntry:
|
||||
__slots__: list = ...
|
||||
|
||||
def __init__(self, node_id): ...
|
||||
def __repr__(self): ...
|
|
@ -0,0 +1,8 @@
|
|||
from typing import Mapping
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = ["communicability", "communicability_exp"]
|
||||
|
||||
def communicability(G: Graph) -> dict[dict, dict]: ...
|
||||
def communicability_exp(G: Graph) -> dict[dict, dict]: ...
|
|
@ -0,0 +1,25 @@
|
|||
from .asyn_fluid import asyn_fluidc as asyn_fluidc
|
||||
from .centrality import girvan_newman as girvan_newman
|
||||
from .kclique import k_clique_communities as k_clique_communities
|
||||
from .kernighan_lin import kernighan_lin_bisection as kernighan_lin_bisection
|
||||
from .label_propagation import (
|
||||
label_propagation_communities,
|
||||
asyn_lpa_communities as label_propagation_communities,
|
||||
asyn_lpa_communities,
|
||||
)
|
||||
from .lukes import lukes_partitioning as lukes_partitioning
|
||||
from .modularity_max import (
|
||||
greedy_modularity_communities as greedy_modularity_communities,
|
||||
naive_greedy_modularity_communities as naive_greedy_modularity_communities,
|
||||
)
|
||||
from .quality import (
|
||||
coverage as coverage,
|
||||
modularity as modularity,
|
||||
performance as performance,
|
||||
partition_quality as partition_quality,
|
||||
)
|
||||
from .community_utils import is_partition as is_partition
|
||||
from .louvain import (
|
||||
louvain_communities as louvain_communities,
|
||||
louvain_partitions as louvain_partitions,
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
from collections.abc import Iterable
|
||||
from ...classes.graph import Graph
|
||||
|
||||
from collections import Counter
|
||||
|
||||
from ...algorithms.components import is_connected
|
||||
from ...exception import NetworkXError
|
||||
from ...utils import groups, not_implemented_for, py_random_state
|
||||
|
||||
__all__ = ["asyn_fluidc"]
|
||||
|
||||
@py_random_state(3)
|
||||
def asyn_fluidc(G: Graph, k, max_iter=100, seed=None) -> Iterable: ...
|
|
@ -0,0 +1,5 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["girvan_newman"]
|
||||
|
||||
def girvan_newman(G: Graph, most_valuable_edge=None): ...
|
|
@ -0,0 +1,5 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["is_partition"]
|
||||
|
||||
def is_partition(G: Graph, communities): ...
|
|
@ -0,0 +1,7 @@
|
|||
from collections import defaultdict
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["k_clique_communities"]
|
||||
|
||||
def k_clique_communities(G: Graph, k: int, cliques=None): ...
|
|
@ -0,0 +1,16 @@
|
|||
from itertools import count
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from .community_utils import is_partition
|
||||
from ...utils import BinaryHeap, not_implemented_for, py_random_state
|
||||
|
||||
__all__ = ["kernighan_lin_bisection"]
|
||||
|
||||
@py_random_state(4)
|
||||
def kernighan_lin_bisection(
|
||||
G: Graph,
|
||||
partition: tuple | None = None,
|
||||
max_iter: int = 10,
|
||||
weight="weight",
|
||||
seed=None,
|
||||
) -> tuple: ...
|
|
@ -0,0 +1,14 @@
|
|||
from collections.abc import Iterable
|
||||
from ...classes.graph import Graph
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import groups, not_implemented_for, py_random_state
|
||||
|
||||
__all__ = ["label_propagation_communities", "asyn_lpa_communities"]
|
||||
|
||||
@py_random_state(2)
|
||||
def asyn_lpa_communities(
|
||||
G: Graph, weight: str | None = None, seed=None
|
||||
) -> Iterable: ...
|
||||
def label_propagation_communities(G: Graph) -> Iterable: ...
|
|
@ -0,0 +1,17 @@
|
|||
from numpy.typing import ArrayLike
|
||||
|
||||
from collections import defaultdict, deque
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import py_random_state
|
||||
|
||||
__all__ = ["louvain_communities", "louvain_partitions"]
|
||||
|
||||
@py_random_state("seed")
|
||||
def louvain_communities(
|
||||
G: Graph, weight="weight", resolution=1, threshold=0.0000001, seed=None
|
||||
) -> ArrayLike: ...
|
||||
@py_random_state("seed")
|
||||
def louvain_partitions(
|
||||
G: Graph, weight="weight", resolution=1, threshold=0.0000001, seed=None
|
||||
): ...
|
|
@ -0,0 +1,21 @@
|
|||
from numpy.typing import ArrayLike
|
||||
|
||||
from copy import deepcopy
|
||||
from functools import lru_cache
|
||||
from random import choice
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
__all__ = ["lukes_partitioning"]
|
||||
|
||||
D_EDGE_W: str = ...
|
||||
D_EDGE_VALUE: float = ...
|
||||
D_NODE_W: str = ...
|
||||
D_NODE_VALUE: int = ...
|
||||
PKEY: str = ...
|
||||
CLUSTER_EVAL_CACHE_SIZE: int = ...
|
||||
|
||||
def lukes_partitioning(
|
||||
G: Graph, max_size: int, node_weight=None, edge_weight=None
|
||||
) -> ArrayLike: ...
|
|
@ -0,0 +1,24 @@
|
|||
from numpy.typing import ArrayLike
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from .quality import modularity
|
||||
from ...utils import not_implemented_for
|
||||
from ...utils.mapped_queue import MappedQueue
|
||||
|
||||
__all__ = [
|
||||
"greedy_modularity_communities",
|
||||
"naive_greedy_modularity_communities",
|
||||
"_naive_greedy_modularity_communities",
|
||||
]
|
||||
|
||||
def greedy_modularity_communities(
|
||||
G: Graph, weight=None, resolution=1, cutoff=1, best_n=None, n_communities=None
|
||||
) -> ArrayLike: ...
|
||||
def naive_greedy_modularity_communities(
|
||||
G: Graph, resolution=1, weight=None
|
||||
) -> ArrayLike: ...
|
||||
|
||||
# old name
|
||||
_naive_greedy_modularity_communities = ...
|
|
@ -0,0 +1,27 @@
|
|||
from typing import Sequence
|
||||
|
||||
from itertools import combinations
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from networkx import NetworkXError
|
||||
from .community_utils import is_partition
|
||||
from ...utils import not_implemented_for
|
||||
from ...utils.decorators import argmap
|
||||
|
||||
__all__ = ["coverage", "modularity", "performance", "partition_quality"]
|
||||
|
||||
class NotAPartition(NetworkXError):
|
||||
def __init__(self, G: Graph, collection): ...
|
||||
|
||||
require_partition = ...
|
||||
|
||||
def intra_community_edges(G: Graph, partition): ...
|
||||
def inter_community_edges(G: Graph, partition): ...
|
||||
def inter_community_non_edges(G: Graph, partition): ...
|
||||
@require_partition
|
||||
def performance(G: Graph, partition: Sequence) -> float: ...
|
||||
@require_partition
|
||||
def coverage(G: Graph, partition: Sequence) -> float: ...
|
||||
def modularity(G: Graph, communities, weight="weight", resolution=1) -> float: ...
|
||||
@require_partition
|
||||
def partition_quality(G: Graph, partition: Sequence): ...
|
|
@ -0,0 +1,31 @@
|
|||
from .connected import (
|
||||
number_connected_components as number_connected_components,
|
||||
connected_components as connected_components,
|
||||
is_connected as is_connected,
|
||||
node_connected_component as node_connected_component,
|
||||
)
|
||||
from .strongly_connected import (
|
||||
number_strongly_connected_components as number_strongly_connected_components,
|
||||
strongly_connected_components as strongly_connected_components,
|
||||
is_strongly_connected as is_strongly_connected,
|
||||
strongly_connected_components_recursive as strongly_connected_components_recursive,
|
||||
kosaraju_strongly_connected_components as kosaraju_strongly_connected_components,
|
||||
condensation as condensation,
|
||||
)
|
||||
from .weakly_connected import (
|
||||
number_weakly_connected_components as number_weakly_connected_components,
|
||||
weakly_connected_components as weakly_connected_components,
|
||||
is_weakly_connected as is_weakly_connected,
|
||||
)
|
||||
from .attracting import (
|
||||
number_attracting_components as number_attracting_components,
|
||||
attracting_components as attracting_components,
|
||||
is_attracting_component as is_attracting_component,
|
||||
)
|
||||
from .biconnected import (
|
||||
biconnected_components as biconnected_components,
|
||||
biconnected_component_edges as biconnected_component_edges,
|
||||
is_biconnected as is_biconnected,
|
||||
articulation_points as articulation_points,
|
||||
)
|
||||
from .semiconnected import is_semiconnected as is_semiconnected
|
|
@ -0,0 +1,13 @@
|
|||
from ...classes.digraph import DiGraph
|
||||
from ...classes.multidigraph import MultiDiGraph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"number_attracting_components",
|
||||
"attracting_components",
|
||||
"is_attracting_component",
|
||||
]
|
||||
|
||||
def attracting_components(G: DiGraph | MultiDiGraph): ...
|
||||
def number_attracting_components(G: DiGraph | MultiDiGraph) -> int: ...
|
||||
def is_attracting_component(G: DiGraph | MultiDiGraph) -> bool: ...
|
|
@ -0,0 +1,15 @@
|
|||
from itertools import chain
|
||||
from ...classes.graph import Graph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"biconnected_components",
|
||||
"biconnected_component_edges",
|
||||
"is_biconnected",
|
||||
"articulation_points",
|
||||
]
|
||||
|
||||
def is_biconnected(G: Graph) -> bool: ...
|
||||
def biconnected_component_edges(G: Graph): ...
|
||||
def biconnected_components(G: Graph): ...
|
||||
def articulation_points(G: Graph): ...
|
|
@ -0,0 +1,16 @@
|
|||
from ...classes.graph import Graph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
from ...utils import arbitrary_element
|
||||
|
||||
__all__ = [
|
||||
"number_connected_components",
|
||||
"connected_components",
|
||||
"is_connected",
|
||||
"node_connected_component",
|
||||
]
|
||||
|
||||
def connected_components(G: Graph): ...
|
||||
def number_connected_components(G: Graph): ...
|
||||
def is_connected(G: Graph) -> bool: ...
|
||||
def node_connected_component(G: Graph, n) -> set: ...
|
|
@ -0,0 +1,7 @@
|
|||
from numpy.typing import ArrayLike
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for, pairwise
|
||||
|
||||
__all__ = ["is_semiconnected"]
|
||||
|
||||
def is_semiconnected(G: Graph, topo_order: ArrayLike | tuple | None = None) -> bool: ...
|
|
@ -0,0 +1,18 @@
|
|||
from ...classes.graph import Graph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"number_strongly_connected_components",
|
||||
"strongly_connected_components",
|
||||
"is_strongly_connected",
|
||||
"strongly_connected_components_recursive",
|
||||
"kosaraju_strongly_connected_components",
|
||||
"condensation",
|
||||
]
|
||||
|
||||
def strongly_connected_components(G: Graph): ...
|
||||
def kosaraju_strongly_connected_components(G: Graph, source=None): ...
|
||||
def strongly_connected_components_recursive(G: Graph): ...
|
||||
def number_strongly_connected_components(G: Graph): ...
|
||||
def is_strongly_connected(G: Graph) -> bool: ...
|
||||
def condensation(G: Graph, scc=None): ...
|
|
@ -0,0 +1,12 @@
|
|||
from ...classes.graph import Graph
|
||||
from ...utils.decorators import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"number_weakly_connected_components",
|
||||
"weakly_connected_components",
|
||||
"is_weakly_connected",
|
||||
]
|
||||
|
||||
def weakly_connected_components(G: Graph): ...
|
||||
def number_weakly_connected_components(G: Graph): ...
|
||||
def is_weakly_connected(G: Graph) -> bool: ...
|
|
@ -0,0 +1,36 @@
|
|||
from .connectivity import (
|
||||
average_node_connectivity as average_node_connectivity,
|
||||
local_node_connectivity as local_node_connectivity,
|
||||
node_connectivity as node_connectivity,
|
||||
local_edge_connectivity as local_edge_connectivity,
|
||||
edge_connectivity as edge_connectivity,
|
||||
all_pairs_node_connectivity as all_pairs_node_connectivity,
|
||||
)
|
||||
from .cuts import (
|
||||
minimum_st_node_cut as minimum_st_node_cut,
|
||||
minimum_node_cut as minimum_node_cut,
|
||||
minimum_st_edge_cut as minimum_st_edge_cut,
|
||||
minimum_edge_cut as minimum_edge_cut,
|
||||
)
|
||||
from .edge_augmentation import (
|
||||
k_edge_augmentation as k_edge_augmentation,
|
||||
is_k_edge_connected as is_k_edge_connected,
|
||||
is_locally_k_edge_connected as is_locally_k_edge_connected,
|
||||
)
|
||||
from .edge_kcomponents import (
|
||||
k_edge_components as k_edge_components,
|
||||
k_edge_subgraphs as k_edge_subgraphs,
|
||||
bridge_components as bridge_components,
|
||||
EdgeComponentAuxGraph as EdgeComponentAuxGraph,
|
||||
)
|
||||
from .disjoint_paths import (
|
||||
edge_disjoint_paths as edge_disjoint_paths,
|
||||
node_disjoint_paths as node_disjoint_paths,
|
||||
)
|
||||
from .kcomponents import k_components as k_components
|
||||
from .kcutsets import all_node_cuts as all_node_cuts
|
||||
from .stoerwagner import stoer_wagner as stoer_wagner
|
||||
from .utils import (
|
||||
build_auxiliary_node_connectivity as build_auxiliary_node_connectivity,
|
||||
build_auxiliary_edge_connectivity as build_auxiliary_edge_connectivity,
|
||||
)
|
|
@ -0,0 +1,39 @@
|
|||
from typing import Mapping
|
||||
|
||||
import itertools
|
||||
from operator import itemgetter
|
||||
from ...classes.graph import Graph
|
||||
|
||||
# Define the default maximum flow function to use in all flow based
|
||||
# connectivity algorithms.
|
||||
from ...algorithms.flow import (
|
||||
boykov_kolmogorov,
|
||||
build_residual_network,
|
||||
dinitz,
|
||||
edmonds_karp,
|
||||
shortest_augmenting_path,
|
||||
)
|
||||
|
||||
default_flow_func = ...
|
||||
|
||||
from .utils import build_auxiliary_edge_connectivity, build_auxiliary_node_connectivity
|
||||
|
||||
__all__ = [
|
||||
"average_node_connectivity",
|
||||
"local_node_connectivity",
|
||||
"node_connectivity",
|
||||
"local_edge_connectivity",
|
||||
"edge_connectivity",
|
||||
"all_pairs_node_connectivity",
|
||||
]
|
||||
|
||||
def local_node_connectivity(
|
||||
G: Graph, s, t, flow_func=None, auxiliary=None, residual=None, cutoff=None
|
||||
): ...
|
||||
def node_connectivity(G: Graph, s=None, t=None, flow_func=None): ...
|
||||
def average_node_connectivity(G: Graph, flow_func=None) -> float: ...
|
||||
def all_pairs_node_connectivity(G: Graph, nbunch=None, flow_func=None) -> Mapping: ...
|
||||
def local_edge_connectivity(
|
||||
G: Graph, s, t, flow_func=None, auxiliary=None, residual=None, cutoff=None
|
||||
): ...
|
||||
def edge_connectivity(G: Graph, s=None, t=None, flow_func=None, cutoff=None): ...
|
|
@ -0,0 +1,27 @@
|
|||
import itertools
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
# Define the default maximum flow function to use in all flow based
|
||||
# cut algorithms.
|
||||
from ...algorithms.flow import build_residual_network, edmonds_karp
|
||||
|
||||
default_flow_func = ...
|
||||
|
||||
from .utils import build_auxiliary_edge_connectivity, build_auxiliary_node_connectivity
|
||||
|
||||
__all__ = [
|
||||
"minimum_st_node_cut",
|
||||
"minimum_node_cut",
|
||||
"minimum_st_edge_cut",
|
||||
"minimum_edge_cut",
|
||||
]
|
||||
|
||||
def minimum_st_edge_cut(
|
||||
G: Graph, s, t, flow_func=None, auxiliary=None, residual=None
|
||||
) -> set: ...
|
||||
def minimum_st_node_cut(
|
||||
G: Graph, s, t, flow_func=None, auxiliary=None, residual=None
|
||||
) -> set: ...
|
||||
def minimum_node_cut(G: Graph, s=None, t=None, flow_func=None) -> set: ...
|
||||
def minimum_edge_cut(G: Graph, s=None, t=None, flow_func=None) -> set: ...
|
|
@ -0,0 +1,37 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
# Define the default maximum flow function to use for the undelying
|
||||
# maximum flow computations
|
||||
from ...algorithms.flow import (
|
||||
edmonds_karp,
|
||||
preflow_push,
|
||||
shortest_augmenting_path,
|
||||
)
|
||||
from ...exception import NetworkXNoPath
|
||||
|
||||
default_flow_func = ...
|
||||
from itertools import filterfalse as _filterfalse
|
||||
|
||||
# Functions to build auxiliary data structures.
|
||||
from .utils import build_auxiliary_edge_connectivity, build_auxiliary_node_connectivity
|
||||
|
||||
__all__ = ["edge_disjoint_paths", "node_disjoint_paths"]
|
||||
|
||||
def edge_disjoint_paths(
|
||||
G: Graph,
|
||||
s,
|
||||
t,
|
||||
flow_func=None,
|
||||
cutoff: int | None = None,
|
||||
auxiliary=None,
|
||||
residual=None,
|
||||
): ...
|
||||
def node_disjoint_paths(
|
||||
G: Graph,
|
||||
s,
|
||||
t,
|
||||
flow_func=None,
|
||||
cutoff: int | None = None,
|
||||
auxiliary=None,
|
||||
residual=None,
|
||||
): ...
|
|
@ -0,0 +1,36 @@
|
|||
import itertools as it
|
||||
import math
|
||||
from collections import defaultdict, namedtuple
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...utils import not_implemented_for, py_random_state
|
||||
|
||||
__all__ = ["k_edge_augmentation", "is_k_edge_connected", "is_locally_k_edge_connected"]
|
||||
|
||||
def is_k_edge_connected(G: Graph, k) -> bool: ...
|
||||
def is_locally_k_edge_connected(G: Graph, s, t, k) -> bool: ...
|
||||
def k_edge_augmentation(
|
||||
G: Graph, k, avail=None, weight: str | None = None, partial: bool = False
|
||||
): ...
|
||||
def partial_k_edge_augmentation(G: Graph, k, avail, weight: str | None = None): ...
|
||||
def one_edge_augmentation(
|
||||
G: Graph, avail=None, weight: str | None = None, partial: bool = False
|
||||
): ...
|
||||
def bridge_augmentation(G: Graph, avail=None, weight: str | None = None): ...
|
||||
|
||||
# --- Algorithms and Helpers ---
|
||||
|
||||
MetaEdge = ...
|
||||
|
||||
def unconstrained_one_edge_augmentation(G: Graph): ...
|
||||
def weighted_one_edge_augmentation(
|
||||
G: Graph, avail, weight: str | None = None, partial: bool = False
|
||||
): ...
|
||||
def unconstrained_bridge_augmentation(G: Graph): ...
|
||||
def weighted_bridge_augmentation(G: Graph, avail, weight: str | None = None): ...
|
||||
def collapse(G: Graph, grouped_nodes): ...
|
||||
def complement_edges(G: Graph): ...
|
||||
@py_random_state(4)
|
||||
def greedy_k_edge_augmentation(
|
||||
G: Graph, k, avail=None, weight: str | None = None, seed=None
|
||||
): ...
|
|
@ -0,0 +1,25 @@
|
|||
import itertools as it
|
||||
from functools import partial
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...algorithms import bridges
|
||||
from ...utils import arbitrary_element, not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"k_edge_components",
|
||||
"k_edge_subgraphs",
|
||||
"bridge_components",
|
||||
"EdgeComponentAuxGraph",
|
||||
]
|
||||
|
||||
def k_edge_components(G: Graph, k): ...
|
||||
def k_edge_subgraphs(G: Graph, k): ...
|
||||
def bridge_components(G: Graph): ...
|
||||
|
||||
class EdgeComponentAuxGraph:
|
||||
@classmethod
|
||||
def construct(cls, G: Graph): ...
|
||||
def k_edge_components(self, k): ...
|
||||
def k_edge_subgraphs(self, k): ...
|
||||
|
||||
def general_k_edge_subgraphs(G: Graph, k): ...
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Mapping
|
||||
from collections import defaultdict
|
||||
from itertools import combinations
|
||||
from operator import itemgetter
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
# Define the default maximum flow function.
|
||||
from ...algorithms.flow import edmonds_karp
|
||||
from ...utils import not_implemented_for
|
||||
|
||||
default_flow_func = ...
|
||||
|
||||
__all__ = ["k_components"]
|
||||
|
||||
def k_components(G: Graph, flow_func=None) -> Mapping: ...
|
||||
def build_k_number_dict(kcomps): ...
|
|
@ -0,0 +1,19 @@
|
|||
import copy
|
||||
from collections import defaultdict
|
||||
from itertools import combinations
|
||||
from operator import itemgetter
|
||||
|
||||
from ...classes.graph import Graph
|
||||
from ...algorithms.flow import (
|
||||
build_residual_network,
|
||||
edmonds_karp,
|
||||
shortest_augmenting_path,
|
||||
)
|
||||
|
||||
from .utils import build_auxiliary_node_connectivity
|
||||
|
||||
default_flow_func = ...
|
||||
|
||||
__all__ = ["all_node_cuts"]
|
||||
|
||||
def all_node_cuts(G: Graph, k=None, flow_func=None): ...
|
|
@ -0,0 +1,9 @@
|
|||
from itertools import islice
|
||||
|
||||
from ...classes.graph import Graph
|
||||
|
||||
from ...utils import BinaryHeap, arbitrary_element, not_implemented_for
|
||||
|
||||
__all__ = ["stoer_wagner"]
|
||||
|
||||
def stoer_wagner(G: Graph, weight: str = "weight", heap=...): ...
|
|
@ -0,0 +1,6 @@
|
|||
from ...classes.graph import Graph
|
||||
|
||||
__all__ = ["build_auxiliary_node_connectivity", "build_auxiliary_edge_connectivity"]
|
||||
|
||||
def build_auxiliary_node_connectivity(G: Graph): ...
|
||||
def build_auxiliary_edge_connectivity(G: Graph): ...
|
|
@ -0,0 +1,24 @@
|
|||
from typing import Mapping
|
||||
from ..classes.graph import Graph
|
||||
from ..exception import NetworkXError
|
||||
from ..utils import not_implemented_for
|
||||
|
||||
__all__ = [
|
||||
"core_number",
|
||||
"find_cores",
|
||||
"k_core",
|
||||
"k_shell",
|
||||
"k_crust",
|
||||
"k_corona",
|
||||
"k_truss",
|
||||
"onion_layers",
|
||||
]
|
||||
|
||||
def core_number(G: Graph) -> Mapping: ...
|
||||
def find_cores(G: Graph): ...
|
||||
def k_core(G: Graph, k: int | None = None, core_number: Mapping | None = None): ...
|
||||
def k_shell(G: Graph, k: int | None = None, core_number: Mapping | None = None): ...
|
||||
def k_crust(G: Graph, k: int | None = None, core_number: Mapping | None = None): ...
|
||||
def k_corona(G: Graph, k: int, core_number: Mapping | None = None): ...
|
||||
def k_truss(G: Graph, k: int): ...
|
||||
def onion_layers(G: Graph) -> Mapping: ...
|
|
@ -0,0 +1,10 @@
|
|||
from functools import partial
|
||||
from itertools import chain
|
||||
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import arbitrary_element, not_implemented_for
|
||||
|
||||
__all__ = ["min_edge_cover", "is_edge_cover"]
|
||||
|
||||
def min_edge_cover(G: Graph, matching_algorithm=None) -> set: ...
|
||||
def is_edge_cover(G: Graph, cover: set) -> bool: ...
|
|
@ -0,0 +1,33 @@
|
|||
from typing import Any
|
||||
|
||||
from itertools import chain
|
||||
|
||||
from ..classes.graph import Graph
|
||||
|
||||
__all__ = [
|
||||
"boundary_expansion",
|
||||
"conductance",
|
||||
"cut_size",
|
||||
"edge_expansion",
|
||||
"mixing_expansion",
|
||||
"node_expansion",
|
||||
"normalized_cut_size",
|
||||
"volume",
|
||||
]
|
||||
|
||||
# TODO STILL NEED TO UPDATE ALL THE DOCUMENTATION!
|
||||
|
||||
def cut_size(G: Graph, S, T=None, weight: Any = None): ...
|
||||
def volume(G: Graph, S, weight: Any = None): ...
|
||||
def normalized_cut_size(G: Graph, S, T=None, weight: Any = None): ...
|
||||
def conductance(G: Graph, S, T=None, weight: Any = None): ...
|
||||
def edge_expansion(G: Graph, S, T=None, weight: Any = None): ...
|
||||
def mixing_expansion(G: Graph, S, T=None, weight: Any = None): ...
|
||||
|
||||
# TODO What is the generalization to two arguments, S and T? Does the
|
||||
# denominator become `min(len(S), len(T))`?
|
||||
def node_expansion(G: Graph, S): ...
|
||||
|
||||
# TODO What is the generalization to two arguments, S and T? Does the
|
||||
# denominator become `min(len(S), len(T))`?
|
||||
def boundary_expansion(G: Graph, S): ...
|
|
@ -0,0 +1,18 @@
|
|||
from collections import defaultdict
|
||||
|
||||
from ..classes.graph import Graph
|
||||
from ..utils import not_implemented_for, pairwise
|
||||
|
||||
__all__ = [
|
||||
"cycle_basis",
|
||||
"simple_cycles",
|
||||
"recursive_simple_cycles",
|
||||
"find_cycle",
|
||||
"minimum_cycle_basis",
|
||||
]
|
||||
|
||||
def cycle_basis(G: Graph, root=None): ...
|
||||
def simple_cycles(G: Graph): ...
|
||||
def recursive_simple_cycles(G: Graph): ...
|
||||
def find_cycle(G: Graph, source=None, orientation=None): ...
|
||||
def minimum_cycle_basis(G: Graph, weight: str | None = None): ...
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче