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.1.tar.gz (81.6 kB view details)

Uploaded Source

Built Distributions

network_symmetry-0.2.1-cp39-cp39-manylinux2010_x86_64.whl (443.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.1-cp39-cp39-manylinux2010_i686.whl (385.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

network_symmetry-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl (84.6 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

network_symmetry-0.2.1-cp38-cp38-manylinux2010_x86_64.whl (444.2 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.1-cp38-cp38-manylinux2010_i686.whl (385.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

network_symmetry-0.2.1-cp38-cp38-macosx_10_15_x86_64.whl (84.3 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

network_symmetry-0.2.1-cp37-cp37m-manylinux2010_x86_64.whl (442.4 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.1-cp37-cp37m-manylinux2010_i686.whl (385.0 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

network_symmetry-0.2.1-cp37-cp37m-macosx_10_15_x86_64.whl (84.3 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

network_symmetry-0.2.1-cp36-cp36m-manylinux2010_x86_64.whl (441.2 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

network_symmetry-0.2.1-cp36-cp36m-manylinux2010_i686.whl (383.7 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

network_symmetry-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl (84.0 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: network-symmetry-0.2.1.tar.gz
  • Upload date:
  • Size: 81.6 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.1.tar.gz
Algorithm Hash digest
SHA256 28db48bc206e03d52f1cfa4c9126bbbd40897ce77c37ca113dc857a7bd5f01ea
MD5 88a3ef3cbb67fe1a32c04552dc156849
BLAKE2b-256 7fd7a35c7a3e4cda03e72ece51bcc225922d612b7c9a141723bf5754a982ff4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 49d80d24e06ee85e2a6e5ee9043c96e45dd035cd274296e343055f15d78143ed
MD5 010cb8c94e070595fd0db642f6264d7a
BLAKE2b-256 e6eb630754e676c6b72779fb30b0247953e3ed45f743a2f42dd200e0514fc81d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp39-cp39-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 0f5fa106a64366714174e95a6fe70bac61e780cc6b0d7dc150c91046c5d26a8d
MD5 24e69f182f584c43f207814ea025ceea
BLAKE2b-256 fd265bb7a2d02ff7273d94e6fdaca1518d7dca180c3c12799981e4f08924a9b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d8347450704a23e81cd96c5356116b42b81cac0c42d5625372d4d170d1e40b1c
MD5 41afebfe8d8fd27f4fe1621942fca475
BLAKE2b-256 f0b7d809bbcbc6b037ab1644c8a5b467863527083d335fb5b765a466f2a49096

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6cf4bcf1327cb6572fbe8787a991d1d4f1f0ffaaec1ad308457263b9e2f4e2cf
MD5 f06bbe126673c3395f56264301c83742
BLAKE2b-256 4e592e3c6240be2be70e0c9a5e4d0067f3b34b19a9f6f3df1c7390089dcbf449

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 e4628db6bb0f9b1f7ecfd26a5bb1472d176e6ef2a75ac9485c7df018e6d83e82
MD5 f02b2192a57306b9b8ab85a606f64d03
BLAKE2b-256 0db20824eed5cc3c37d918a69ecd1595501cc11a737deb427c50957529957860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ce285414cce3418eb9ddcff5dacbe0f9b9cf018bd5e762f4e34100f4ef01e4b5
MD5 85406053c5b4f61c10fb1a78c4ba354c
BLAKE2b-256 c77f661da8d671abaebabb8ed20c22b0dd3cc6bff91a3eac486df4f17fdc3b92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 652fd706649c948cab9559d71ad94d85a152d1ca31842ecd50a9fbe40c361102
MD5 b7aaa70787327b3e759ac3fc94b73f69
BLAKE2b-256 b9002bf1075fd537d0c8b65d63b1ecc24ee566f7820584e04705f9756bbc97a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 27eb7d758c33bc7560845b95d70206ee0b5ba374fc70b48ff53afd78091fdfd1
MD5 def98357bd0f18c4fdcaf1d70bf4135d
BLAKE2b-256 81fe81c1377dadb7be88b83af4f87d104525b781a67033c8c87d4d17d25aef5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 c261f0dcb8055486e5878f961e3a29198f8033c77a610eaa8cbcd4bb58b1122b
MD5 9755db86c78dd03248271868d9d63813
BLAKE2b-256 f08fbe354266a91654db4c04b7569a8e43e7632d663f2c34c71b53f92dccd58c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8476b0207535c4d61f0e84fbc5c7a1e7c2995a1c0f1e2c8d8b3b630eaef14945
MD5 48a9228192962e404ac06ded33a9cb38
BLAKE2b-256 43e207606c9625287a19cdb48d9c8b44c349cebd238dbc9b36d43944ef4345c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 1a2f2893052d54b897d7a7b0d8ffb57ac0e134619464654b5cd6419fd2d4e856
MD5 5a49c653963884de3c5a5cbe274d1e79
BLAKE2b-256 f107e255a4efcd6ee347dfbe7a7f00ce5d74f8853c39e05674b2adf824fa85e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8cd8b2e20af0db3e022c7e553668e1a9ea0db3a3373a9b483800ce97f08034db
MD5 4207b3c9e9d954c1a40244a7b704768a
BLAKE2b-256 2d9895806af6382664767cd587d210cf7d756f734d3518bee037fc5572be2657

See more details on using hashes here.

Supported by

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