|
|
|
@ -1,3 +1,45 @@
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# multired.py
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# Copyright (C) 2015 Vincenzo (Enzo) Nicosia <katolaz@yahoo.it>
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# long with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
# This module provides the class multiplex_red, which implements the
|
|
|
|
|
# algorithm for the structural reduction of multi-layer networks
|
|
|
|
|
# based on the Von Neumann entropy and Quantum Jensen-Shannon
|
|
|
|
|
# divergence of graphs.
|
|
|
|
|
#
|
|
|
|
|
# If you use this code please cite the paper:
|
|
|
|
|
#
|
|
|
|
|
# M. De Domenico, V. Nicosia, A. Arenas, V. Latora,
|
|
|
|
|
# "Structural reducibility of multilayer networks"
|
|
|
|
|
# Nat. Commun. 6, 6864 (2015) doi:10.1038/ncomms7864
|
|
|
|
|
#
|
|
|
|
|
# --------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# -- 2015/04/23 -- release 0.1
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import math
|
|
|
|
|
import numpy as np
|
|
|
|
|