~tfardet/NNGT

c66b0577eab03cb97c4990878fce61241f122187 — Tanguy Fardet 3 months ago 3f511d3 main
Bugfix: undirected density, support with/without loops
70 files changed, 116 insertions(+), 73 deletions(-)

M nngt/__init__.py
M nngt/analysis/__init__.py
M nngt/analysis/activity_analysis.py
M nngt/analysis/bayesian_blocks.py
M nngt/analysis/clustering.py
M nngt/analysis/graph_analysis.py
M nngt/analysis/gt_functions.py
M nngt/analysis/ig_functions.py
M nngt/analysis/nngt_functions.py
M nngt/analysis/nx_functions.py
M nngt/core/__init__.py
M nngt/core/connections.py
M nngt/core/graph.py
M nngt/core/graph_interface.py
M nngt/core/group_structure.py
M nngt/core/gt_graph.py
M nngt/core/ig_graph.py
M nngt/core/networks.py
M nngt/core/neural_pop_group.py
M nngt/core/nngt_graph.py
M nngt/core/nx_graph.py
M nngt/core/spatial_graph.py
M nngt/database/__init__.py
M nngt/database/csv_utils.py
M nngt/database/db_generation.py
M nngt/database/db_main.py
M nngt/database/pickle_field.py
M nngt/generation/__init__.py
M nngt/generation/connect_algorithms.py
M nngt/generation/connectors.py
M nngt/generation/graph_connectivity.py
M nngt/generation/mpi_connect.py
M nngt/generation/rewiring.py
M nngt/geospatial/__init__.py
M nngt/geospatial/_cartopy_ne.py
M nngt/geospatial/countries.py
M nngt/geospatial/plot.py
M nngt/io/__init__.py
M nngt/io/graph_loading.py
M nngt/io/graph_saving.py
M nngt/io/io_helpers.py
M nngt/io/loading_helpers.py
M nngt/io/saving_helpers.py
M nngt/lib/__init__.py
M nngt/lib/_frozendict.py
M nngt/lib/connect_tools.py
M nngt/lib/constants.py
M nngt/lib/converters.py
M nngt/lib/db_tools.py
M nngt/lib/decorator.py
M nngt/lib/errors.py
M nngt/lib/graph_backends.py
M nngt/lib/graph_helpers.py
M nngt/lib/logger.py
M nngt/lib/nngt_config.py
M nngt/lib/rng_tools.py
M nngt/lib/sorting.py
M nngt/lib/test_functions.py
M nngt/plot/__init__.py
M nngt/plot/animations.py
M nngt/plot/custom_plt.py
M nngt/plot/hive_helpers.py
M nngt/plot/plt_networks.py
M nngt/plot/plt_properties.py
M nngt/simulation/__init__.py
M nngt/simulation/nest_activity.py
M nngt/simulation/nest_graph.py
M nngt/simulation/nest_plot.py
M nngt/simulation/nest_utils.py
M testing/test_basics.py
M nngt/__init__.py => nngt/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/__init__.py => nngt/analysis/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/activity_analysis.py => nngt/analysis/activity_analysis.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/bayesian_blocks.py => nngt/analysis/bayesian_blocks.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/clustering.py => nngt/analysis/clustering.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/graph_analysis.py => nngt/analysis/graph_analysis.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/gt_functions.py => nngt/analysis/gt_functions.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/ig_functions.py => nngt/analysis/ig_functions.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/nngt_functions.py => nngt/analysis/nngt_functions.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/analysis/nx_functions.py => nngt/analysis/nx_functions.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/__init__.py => nngt/core/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/connections.py => nngt/core/connections.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/graph.py => nngt/core/graph.py +24 -5
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by


@@ 1239,12 1239,31 @@ class Graph(nngt.core.GraphObject):
                raise InvalidArgument(
                    "Unknown attribute class '{}'.".format(attribute_class))

    def get_density(self):
    def get_density(self, ignore_loops=True):
        '''
        Density of the graph: :math:`\\frac{E}{N^2}`, where `E` is the number
        of edges and `N` the number of nodes.
        Density of the graph.

        Parameters
        ----------
        ignore_loops : bool, optional (default: True)
            Whether self-loops should be considered.

        Note
        ----

        The density is computed via :math:`(2 - d)\\frac{E}{N(N - 1)}` if
        `ignore_loops` is True, or via :math:`\\frac{E}{N(N - 1) / (2 - d) + N}`
        if it is False.
        `E` is the number of edges, `N` the number of nodes, and `d` is 0 if
        the graph is undirected and 1 if it is directed.
        '''
        return self.edge_nb() / self.node_nb()**2
        E = self.edge_nb()
        N = self.node_nb()

        if ignore_loops:
            return E / (N * (N - 1) / (2 - self.is_directed()) + N)

        return (2 - self.is_directed()) * E / (N * (N - 1))

    def is_weighted(self):
        ''' Whether the edges have weights '''

M nngt/core/graph_interface.py => nngt/core/graph_interface.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/group_structure.py => nngt/core/group_structure.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/gt_graph.py => nngt/core/gt_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/ig_graph.py => nngt/core/ig_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/networks.py => nngt/core/networks.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/neural_pop_group.py => nngt/core/neural_pop_group.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/nngt_graph.py => nngt/core/nngt_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/nx_graph.py => nngt/core/nx_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/core/spatial_graph.py => nngt/core/spatial_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/database/__init__.py => nngt/database/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/database/csv_utils.py => nngt/database/csv_utils.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/database/db_generation.py => nngt/database/db_generation.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/database/db_main.py => nngt/database/db_main.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/database/pickle_field.py => nngt/database/pickle_field.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/__init__.py => nngt/generation/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/connect_algorithms.py => nngt/generation/connect_algorithms.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/connectors.py => nngt/generation/connectors.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/graph_connectivity.py => nngt/generation/graph_connectivity.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/mpi_connect.py => nngt/generation/mpi_connect.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/generation/rewiring.py => nngt/generation/rewiring.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/geospatial/__init__.py => nngt/geospatial/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/geospatial/_cartopy_ne.py => nngt/geospatial/_cartopy_ne.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/geospatial/countries.py => nngt/geospatial/countries.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/geospatial/plot.py => nngt/geospatial/plot.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/__init__.py => nngt/io/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/graph_loading.py => nngt/io/graph_loading.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/graph_saving.py => nngt/io/graph_saving.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/io_helpers.py => nngt/io/io_helpers.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/loading_helpers.py => nngt/io/loading_helpers.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/io/saving_helpers.py => nngt/io/saving_helpers.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/__init__.py => nngt/lib/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/_frozendict.py => nngt/lib/_frozendict.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/connect_tools.py => nngt/lib/connect_tools.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/constants.py => nngt/lib/constants.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/converters.py => nngt/lib/converters.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/db_tools.py => nngt/lib/db_tools.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/decorator.py => nngt/lib/decorator.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/errors.py => nngt/lib/errors.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/graph_backends.py => nngt/lib/graph_backends.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/graph_helpers.py => nngt/lib/graph_helpers.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/logger.py => nngt/lib/logger.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/nngt_config.py => nngt/lib/nngt_config.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/rng_tools.py => nngt/lib/rng_tools.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/sorting.py => nngt/lib/sorting.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/lib/test_functions.py => nngt/lib/test_functions.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/__init__.py => nngt/plot/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/animations.py => nngt/plot/animations.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/custom_plt.py => nngt/plot/custom_plt.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/hive_helpers.py => nngt/plot/hive_helpers.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/plt_networks.py => nngt/plot/plt_networks.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/plot/plt_properties.py => nngt/plot/plt_properties.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/simulation/__init__.py => nngt/simulation/__init__.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/simulation/nest_activity.py => nngt/simulation/nest_activity.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/simulation/nest_graph.py => nngt/simulation/nest_graph.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/simulation/nest_plot.py => nngt/simulation/nest_plot.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M nngt/simulation/nest_utils.py => nngt/simulation/nest_utils.py +1 -1
@@ 6,7 6,7 @@
# and reproducible graph analysis: generate and analyze networks with your
# favorite graph library (graph-tool/igraph/networkx) on any platform, without
# any change to your code.
# Copyright (C) 2015-2021 Tanguy Fardet
# Copyright (C) 2015-2022 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

M testing/test_basics.py => testing/test_basics.py +24 -0
@@ 816,6 816,29 @@ def test_to_undirected():
    assert np.array_equal(u.adjacency_matrix().todense(), m)


@pytest.mark.mpi_skip
def test_density():
    # directed
    num_nodes = 3
    g = nngt.Graph(num_nodes)

    edges = [(0, 1), (1, 2), (2, 0)]

    g.new_edges(edges)

    assert np.isclose(g.get_density(ignore_loops=True), 1/3)
    assert np.isclose(g.get_density(ignore_loops=False), 0.5)

    # undirected
    g = nngt.Graph(num_nodes, directed=False)

    edges = [(0, 1), (1, 2), (2, 0)]

    g.new_edges(edges)

    assert np.isclose(g.get_density(ignore_loops=True), 0.5)
    assert np.isclose(g.get_density(ignore_loops=False), 1)


# ---------- #
# Test suite #


@@ 836,3 859,4 @@ if __name__ == "__main__":
        test_edge_creation()
        test_has_edges_edge_id()
        test_delete()
        test_density()