Skip to main content

Library to compute accessibility and symmetry in networks

Project description

Network symmetry

Fast library, written in C for python to calculate network Accessibility and Symmetry. More information regarding these measurements are described in the papers listed as follows:

Travençolo, Bruno Augusto Nassif, and L. da F. Costa. "Accessibility in complex networks." Physics Letters A 373, no. 1 (2008): 89-95.

Silva, Filipi N., Cesar H. Comin, Thomas K. DM Peron, Francisco A. Rodrigues, Cheng Ye, Richard C. Wilson, Edwin R. Hancock, and Luciano da F. Costa. "Concentric network symmetry." Information Sciences 333 (2016): 61-80.

For the generalized accessibility, the following paper is used:

De Arruda, G. F., Barbieri, A. L., Rodriguez, P. M., Rodrigues, F. A., Moreno, Y., & da Fontoura Costa, L. Role of centrality for the identification of influential spreaders in complex networks. Physical Review E, 90(3) (2014), 032812.

If you use this code in a scientific study, please cite the respective references and this library.

A comprehensive guide to the theory and applications of the accessibility measurements is available from: Benatti, Alexandre, and Luciano da F. Costa. "Accessibility: Generalizing the Node Degree (A Tutorial)." (2021).

Install

Requires python headers and a C11 compatible compiler, such as gcc or clang.

To install it, simply run:

pip install network-symmetry

or clone this repository and install it from master by running:

pip install git+https://github.com/ABenatti/network_symmetry.git

Usage

Step 1: Import the libraries

import numpy as np
import network_symmetry as ns

Step 2: Convert network to an edge list and a list of weights (optional)

vertex_count = 10
edges = np.array([(0, 1), (0, 2), (1, 2), (0, 3), (1, 3), (2, 3), (2, 4), (3, 4), (0, 4),
                  (4, 5), (3, 5), (1, 5), (1, 6), (3, 6), (4, 6), (5, 7), (4, 7), (0, 7), 
                  (5, 8), (4, 8), (3, 8), (3, 9), (7, 9), (0, 9)])
weights = np.random.random(size=edges.shape[0])
directed = False

Step 3: Load the network data in a measurer object

measurer = ns.Network(vertex_count = vertex_count, 
                      edges = edges, 
                      directed = directed, 
                      weights = weights
                      )

Step 4: Set the parameters:

h_max = 3
measurer.set_parameters(h_max= h_max)

Step 5: Calculate the measurements:

measurer.compute_symmetry()
generalized_accessibility = measurer.accessibility_generalized()

Step 6: The outputs can be seen as follows.

print("\nResults:")
for h in range(2,h_max+1):
    print("h =", h)
    print(" Accessibility:")
    print(" ", measurer.accessibility(h))
    print(" Symmetry (backbone):")
    print(" ",measurer.symmetry_backbone(h))
    print(" Symmetry (merged):")
    print(" ",measurer.symmetry_merged(h))

print(" Generalized accessibility:")
print(" ", generalized_accessibility)

Important: In order to be faster, this version of accessibility considers a random walk in which the walker cannot return to the already visited nodes.

API Documentation

measurer = ns.Network(vertex_count = vertex_count, 
                      edges = edges, 
                      directed = directed, 
                      weights= weights
                      )
  • vertex_count - number of vertices in the network;
  • edges - list of edges;
  • directed - directed or not;
  • weights - list containing the weights of the edges (use the same order as edges).
measurer.set_parameters(h_max = 2,
                        merge_last_level = True,
                        live_stream = False,
                        parallel_jobs = 1,
                        verbose = False,
                        show_status = True
                        )
  • h_max - Compute all symmetries and accessibilities for h=2 to h_max, which must be greater or equal to 2;
  • merge_last_level - Merge the last level. True by default;
  • live_stream - Stream the output as results are obtained. Note that the results may be out of order;
  • parallel_jobs - The number of parallel jobs, which must be greater or equal to 1;
  • verbose - If True, shows the calculation steps;
  • show_status - If True, show the progress of the calculation.
measurer.compute_symmetry()

Compute symmetries and accessibilities by using the parameters set in "set_parameters".

accessibility = measurer.accessibility(h)
symmetry_backbone = measurer.symmetry_backbone(h)
symmetry_merged = measurer.symmetry_merged(h)
  • h- desired number of steps. These methods return the respective lists measurements. The order of measures in the lists follows the node orders.

Libraries

All of these codes were developed and executed with the environment described in "requirements.txt".

Citation Request

If you publish a paper related to this material, please cite this repository and the respective papers.

Acknowledgements

Alexandre Benatti thanks Coordenação de Aperfeiçoamento de Pessoal de Nível Superior – Brasil (CAPES) – Finance Code (001) (grant no. 88882.328749/2019-01). Henrique F. de Arruda acknowledges FAPESP for sponsorship (grant no. 2018/10489-0). Luciano da F. Costa thanks CNPq (grant no. 307085/2018-0) and NAP-PRP-USP for sponsorship. This work has been supported also by FAPESP grant no. 2015/22308-2.

License

This software is under the following license.

Copyright (c) 2021 network-accessibility

network-accessibility (c) by Alexandre Benatti, Henrique Ferraz de Arruda
Filipi Nascimento Silva, and Luciano da Fontoura Costa

network-accessibility is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>. 

Software provided as is and with absolutely no warranty, express or implied, 
with no liability for claim or damage.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

network-symmetry-0.2.3.tar.gz (83.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

network_symmetry-0.2.3-cp310-cp310-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.10Windows x86-64

network_symmetry-0.2.3-cp39-cp39-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.9Windows x86-64

network_symmetry-0.2.3-cp39-cp39-manylinux2010_x86_64.whl (441.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.3-cp39-cp39-manylinux2010_i686.whl (383.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ i686

network_symmetry-0.2.3-cp39-cp39-macosx_10_15_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

network_symmetry-0.2.3-cp38-cp38-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.8Windows x86-64

network_symmetry-0.2.3-cp38-cp38-manylinux2010_x86_64.whl (442.4 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.3-cp38-cp38-manylinux2010_i686.whl (383.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ i686

network_symmetry-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl (83.6 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

network_symmetry-0.2.3-cp37-cp37m-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

network_symmetry-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl (440.5 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

network_symmetry-0.2.3-cp37-cp37m-manylinux2010_i686.whl (383.1 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ i686

network_symmetry-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl (83.6 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

network_symmetry-0.2.3-cp36-cp36m-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

network_symmetry-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl (439.1 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

network_symmetry-0.2.3-cp36-cp36m-manylinux2010_i686.whl (381.8 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ i686

network_symmetry-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl (83.5 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

Details for the file network-symmetry-0.2.3.tar.gz.

File metadata

  • Download URL: network-symmetry-0.2.3.tar.gz
  • Upload date:
  • Size: 83.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for network-symmetry-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bd6b1102233462d92674fc05c71f3f3a9ccf22a5468aa7fe4be017528baf17ad
MD5 a849b9a6b81bff03feeabb056773a1d6
BLAKE2b-256 508cce8bf04ffa09e9005614730669fb818d60f07288fcd1e314039ea0303173

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fb42d192e68b11b931d29fafef4cf7c4197c79f198afca950e1d61308802bfae
MD5 a88cf5371457b563438c7d87bbe5504b
BLAKE2b-256 76e7490d2cdc92813e03834027614b615ee71130837fec7e2581546bcdb328b1

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0a30dde09bbf892897802682c4ef7d8d03530698adbae6f613a02fdb352db747
MD5 188542e4b135600d43643a6f32215387
BLAKE2b-256 bc09ba0d778271d051150a92daf229f2883e14a5fe5246c86e6c6003a243c5c7

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7fabc4395877ea3674bf6561cc757ef9687d68eb29285f6d9681ab4f2846fc6d
MD5 55a4474f8a01f98c07d53ff593aa1a26
BLAKE2b-256 cc5b9fbfa2f795ec769faf59ca569c65b21dec0a8f8f82b40c8bf84bd36f1c8c

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp39-cp39-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp39-cp39-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 2d28a4f002f5e67f4e86e96e2053c090d19719ea287748ba617f53569e8a37ae
MD5 0736cefeab37452a496d5301e6755392
BLAKE2b-256 6f51448b76de906bd594c1c2b17b8072eb3f365b7cbd89ddaddeb7c86564cab8

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e7c06f7201abbe64ad8861074e74d4a11de65adc1af50efd7d7cf9ff0dbd0dc5
MD5 0c99c704ee26fc47db99bcf6dd338b4c
BLAKE2b-256 db18e4fd6eec63e8692b8da4296df4d69de69f8ad39ef65c6257b679164a939c

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 98b2b2e2c2b220514cf81139d7fb63ab936a65b611abfd05ece3e3ba0940de0d
MD5 dc008bfa918e5907ff9aaf7fcc1cafc7
BLAKE2b-256 0644b99b9e13fb9d4c4aa891a396ab6cf63645066c5cfacc204aafd718505615

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 37b8e86309f71a428006d6d846ec524f41a5d0732fbac720896f4176f180e779
MD5 920679ce83b251235d6bbe480c23c31a
BLAKE2b-256 a574d37056a4ddba916eef46792d6ebd496432a4584e8c2c7bb2ab9587808e18

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp38-cp38-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 04f22815d342429d4e45ad1955517ca113ab8e7e2206f6f26b5a4d11a5fe807f
MD5 755e7308f73b772ff409de62c6fd8f9a
BLAKE2b-256 7ecaffa4be17d4fec8d9e12da44cd624e7265e7ac28fdcbbcb618865cbf5d58a

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0cfde394a46af65935ba6d7fc0e554fb520ad7e32057c4d3ee193e657effeb3b
MD5 0e5d4e4cae7ed6ac6cd3f3bdf3abd666
BLAKE2b-256 10cb7e50c6954d2262f4e274c5cf7e3b3f4a4e0538aa7d10d4403290a5003f62

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 467da11ba75d7550c5f5b85a65898dd1753541d974faec927bc9b63c2b859c52
MD5 a70c8ebb686f9fffe20289fb6c38d8cf
BLAKE2b-256 2e69f64464aab2c19a23ef83a4251c9768e8b3d6ebce5342cbcad1de7b9136f4

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 38fafddd61ff9d846be7326e32e3ca25cce9ff47b126a9209cae2c78d8bf0fd1
MD5 06ebe67cd3a32867f46c01ffcda0af85
BLAKE2b-256 a646bf9eec8d729de6df683f7028819abd38f8a9cf823a6a225023a2f597686e

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp37-cp37m-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 99a4af0b34dbbe3505d1e95872be6831ffe970e740af9390cd939b087c990204
MD5 809c9f5c0cb1f36ad06282ea10458981
BLAKE2b-256 deaaf05de06d92a5a80b0a2988d5d58d6ec95f336f7f79d56750d037143589b3

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d77c16e6ac263207190d4f7428a1119260a251d7199e27821c1ca7ec0c424113
MD5 7613de44b9a2f31085733488ebe9a9cb
BLAKE2b-256 975ef85bca572cd86b6e9db284a190c49a80e1a4e7162ac0e550dc19620b64ee

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 d3ac1725840854bb67f64d92cf31480e4b388533b4ea4f17efe1b4f1967d51a3
MD5 24ec3bd3e7b46360898a7b17c7229ea7
BLAKE2b-256 2a55a178f1749ab6620e0b384df7d100a9cd7303d224b47fde11147efc49832c

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6e2c5c512dba9d60d1e0087aa5d2162d7aadaede748b915988a5887812c8aada
MD5 0ea7da212244d346292381bfea41f6cf
BLAKE2b-256 a582fd9cf03010b9b3930e0fc5775e6942c95960e227c2be37d1e8e0eed55ba4

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp36-cp36m-manylinux2010_i686.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 23ffd8f99a079c9d57e7a703b308b27a6155daa49104c43d1a2cabd31138e3be
MD5 a62a8fe68faa1854fa75093fe5f3718d
BLAKE2b-256 89f24722bf19e2084a98a39e329d17a54be26e3505e2903f830e62adad19fef7

See more details on using hashes here.

File details

Details for the file network_symmetry-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7c12d11371ef382bb818afd62534e08ccb03c42652dbf74c72f18db0bfa22eb8
MD5 de1eed7ae132b7d071cdb55445dd2fbf
BLAKE2b-256 a2111dcbe410030fa177425cf6ad256783c5508654cdae5a65e24d579193f8f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page