~tfardet/nngt-developers

NNGT: Maintenance: fix doc + deprecated igraph functions v1 PROPOSED

~tfardet: 1
 Maintenance: fix doc + deprecated igraph functions

 3 files changed, 22 insertions(+), 24 deletions(-)
#851531 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~tfardet/nngt-developers/patches/35633/mbox | git am -3
Learn more about email & git

[PATCH NNGT] Maintenance: fix doc + deprecated igraph functions Export this patch

From: Tanguy Fardet <tanguyfardet@protonmail.com>

---
 doc/conf.py                     |  8 +++-----
 nngt/analysis/graph_analysis.py | 18 +++++++++---------
 nngt/analysis/ig_functions.py   | 20 ++++++++++----------
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index a2e1edf..c8a98a2 100755
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -57,13 +57,11 @@ try:
        # NEST is not available
        raise ImportError
except:
    import mock
    mock_object = mock.Mock(__name__ = "Mock", __bases__ = (object,))

    class Mock(object):

        def __init__(self, *args, **kwargs):
            super(Mock, self).__init__()
            super().__init__()
            self.__file__ = None

        def __call__(self, *args, **kwargs):
            return self
@@ -175,7 +173,7 @@ gen_autosum(source, target, 'nngt', 'summary', dtype="class",
                    "GroupProperty"))

gen_autosum(target, target, 'nngt.Group', 'summary', dtype="classmembers")
gen_autosum(target, target, 'nngt.NeuralGroup', 'summary', 
gen_autosum(target, target, 'nngt.NeuralGroup', 'summary',
            dtype="classmembers")
gen_autosum(target, target, 'nngt.Structure', 'summary', dtype="classmembers")
gen_autosum(target, target, 'nngt.NeuralPop', 'summary', dtype="classmembers")
diff --git a/nngt/analysis/graph_analysis.py b/nngt/analysis/graph_analysis.py
index e73fa50..f415bef 100755
--- a/nngt/analysis/graph_analysis.py
+++ b/nngt/analysis/graph_analysis.py
@@ -52,17 +52,17 @@ __all__ = [
    "betweenness",
    "betweenness_distrib",
    "binning",
	"closeness",
	"connected_components",
    "closeness",
    "connected_components",
    "degree_distrib",
	"diameter",
    "diameter",
    "node_attributes",
	"num_iedges",
	"reciprocity",
    "num_iedges",
    "reciprocity",
    "shortest_distance",
    "shortest_path",
    "small_world_propensity",
	"spectral_radius",
    "spectral_radius",
    "subgraph_centrality",
    "transitivity",
]
@@ -477,7 +477,7 @@ def shortest_path(g, source, target, directed=True, weights=None):
    References
    ----------
    .. [gt-sd] :gtdoc:`topology.shortest_distance`
    .. [ig-sp] :igdoc:`shortest_paths`
    .. [ig-dist] :igdoc:`distances`
    .. [nx-sp] :nxdoc:`algorithms.shortest_paths.generic.shortest_path`
    '''
    raise NotImplementedError(_backend_required)
@@ -554,7 +554,7 @@ def shortest_distance(g, sources=None, targets=None, directed=True,
    References
    ----------
    .. [gt-sd] :gtdoc:`topology.shortest_distance`
    .. [ig-sp] :igdoc:`shortest_paths`
    .. [ig-dist] :igdoc:`distances`
    .. [nx-sp] :nxdoc:`algorithms.shortest_paths.weighted.multi_source_dijkstra`
    '''
    raise NotImplementedError(_backend_required)
@@ -602,7 +602,7 @@ def average_path_length(g, sources=None, targets=None, directed=None,
    References
    ----------
    .. [gt-sd] :gtdoc:`topology.shortest_distance`
    .. [ig-sp] :igdoc:`shortest_paths`
    .. [ig-dist] :igdoc:`distances`
    .. [nx-sp] :nxdoc:`algorithms.shortest_paths.generic.average_shortest_path_length`

    See also
diff --git a/nngt/analysis/ig_functions.py b/nngt/analysis/ig_functions.py
index 85d19c3..ed1091c 100644
--- a/nngt/analysis/ig_functions.py
+++ b/nngt/analysis/ig_functions.py
@@ -295,7 +295,7 @@ def connected_components(g, ctype=None):

    References
    ----------
    .. [ig-connected-components] :igdoc:`clusters`
    .. [ig-connected-components] :igdoc:`connected_components`
    '''
    if ctype is None:
        ctype = "scc" if g.is_directed() else "wcc"
@@ -307,14 +307,14 @@ def connected_components(g, ctype=None):
    elif ctype != "scc":
        raise ValueError("`ctype` must be either 'scc' or 'wcc'.")

    clusters = g.graph.clusters(ig_type)
    igcc = g.graph.connected_components(ig_type)

    cc = np.zeros(g.node_nb(), dtype=int)

    for i, nodes in enumerate(clusters):
    for i, nodes in enumerate(igcc):
        cc[nodes] = i

    hist = np.array([len(c) for c in clusters], dtype=int)
    hist = np.array([len(c) for c in igcc], dtype=int)

    return cc, hist

@@ -469,7 +469,7 @@ def shortest_distance(g, sources=None, targets=None, directed=None,

    References
    ----------
    .. [ig-sp] :igdoc:`shortest_paths`
    .. [ig-dist] :igdoc:`distances`
    '''
    # weighted or selective algorithm
    g, graph, w = _get_ig_graph(g, directed, weights, combine_weights,
@@ -479,12 +479,12 @@ def shortest_distance(g, sources=None, targets=None, directed=None,

    # special case for one source/one target
    if is_integer(sources) and is_integer(targets):
        return graph.shortest_paths(source=sources, target=targets,
                                    weights=w)[0][0]
        return graph.distances(source=sources, target=targets,
                               weights=w)[0][0]

    # multiple sources/targets
    mat_dist = graph.shortest_paths(source=sources, target=targets,
                                    weights=w)
    mat_dist = graph.distances(source=sources, target=targets,
                               weights=w)

    mat_dist = np.array(mat_dist, dtype=float)

@@ -549,7 +549,7 @@ def average_path_length(g, sources=None, targets=None, directed=None,

    References
    ----------
    .. [ig-sp] :igdoc:`shortest_paths`
    .. [ig-dist] :igdoc:`distances`
    '''
    directed = g.is_directed() if directed is None else directed

-- 
2.34.4
NNGT/patches/.build.yml: SUCCESS in 29m9s

[Maintenance: fix doc + deprecated igraph functions][0] from [~tfardet][1]

[0]: https://lists.sr.ht/~tfardet/nngt-developers/patches/35633
[1]: mailto:tanguyfardet@protonmail.com

✓ #851531 SUCCESS NNGT/patches/.build.yml https://builds.sr.ht/~tfardet/job/851531