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.

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

If you use this code in a scientific study, please cite the respective references and this library, as: Benatti, A., Silva, F. N., de Arruda, H. F., & da F. Costa, L. "Complex Networks Accessibility and Symmetry." (2022)..

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

network_symmetry-0.4.2-cp311-cp311-win_amd64.whl (37.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

network_symmetry-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (471.3 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

network_symmetry-0.4.2-cp311-cp311-macosx_11_0_arm64.whl (77.1 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

network_symmetry-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl (82.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

network_symmetry-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (470.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

network_symmetry-0.4.2-cp310-cp310-macosx_11_0_arm64.whl (77.1 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

network_symmetry-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl (82.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

network_symmetry-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (470.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

network_symmetry-0.4.2-cp39-cp39-macosx_11_0_arm64.whl (77.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

network_symmetry-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl (82.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 Windows x86-64

network_symmetry-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (470.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

network_symmetry-0.4.2-cp38-cp38-macosx_11_0_arm64.whl (77.1 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

network_symmetry-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl (82.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m Windows x86-64

network_symmetry-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (468.0 kB view details)

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

network_symmetry-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl (82.9 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file network_symmetry-0.4.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1da5866e911bcabe61a9bac32129880569b7da095d035902ccb14ea6965a99c3
MD5 afd13f4058706dc0a7ba69a072214cec
BLAKE2b-256 f3961d8c57cf081bf2146760e8cb631dac97850181c023fdd5e760097ea33e6e

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09395823bcb8a9c66ef89036565aaf52693d67938d04ca8475744ddd318dd75c
MD5 d849a495ec8ce3234f8cfe304c3972ce
BLAKE2b-256 e9a33ccbaf2992f93aa0f258c9fdc9f92c58a8e8575ca973b165d0d282ad7515

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a7f339b6ae9a3569d718b529bdddeb9a3e51558126224112d185536f83740f6
MD5 f04dc79a2c5c6154d0b2e0aaf4f86148
BLAKE2b-256 784bd6cc83ffe3f91a7bad66e6dc42ff42d413707a323d970b85782936331e6f

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b0145b0d889c442f40391d1ec7c3bfb3b086738adffd271d795f3c3735076d4
MD5 9c3598f270d08e03a44228e4c30c04d4
BLAKE2b-256 d4de642fb81a879022e2fc135014a5724cfd502de9afca2c07ac2b64e19d6540

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3b645dd40a53b2e6926348d0e85d04bb1408f3d7536c73d1f3b7564fb039c088
MD5 7b4ef6d20e39882a8dbccef277e079bd
BLAKE2b-256 769ecd48c6985ceb9e5f1aba308c4f609a0dbe5cfede5be5b44b2341cfe142f1

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f313f01a168954347519a875055a32871cf2523936b179060553daef2058f888
MD5 7cda56efb6378ae872d1ad1e8a795952
BLAKE2b-256 6c77d485df079d081919a07855e4f09b773602a6d9f6b9474c77777cf4d31693

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6742b140607f8d0888b8f29a36d441f220f431ab70f0610e73bcc72264cd0bbb
MD5 3e57d446242c5f573f9fb8f3809033c8
BLAKE2b-256 04d0e7056e33ba376ba0332d9bb408c5498633a5fbdfedebcb7403b7018d9f28

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 782ed443e8e24ba47dff45c6fb63f0fadae4c535f050a8a6b55cea3c5b8fa400
MD5 c2d21cc17c2d8cbdccfafd4799fc28b1
BLAKE2b-256 4d53f0c37b841aa2782e55ef4e1ab4427ca6f54973eb933ff595210249aee2d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4ee5f74c5f4b5cfa101390dd477a72fb546cafba85a8cb9dc4e4f1f81977e8fa
MD5 3998cf2fa70cded3221db2fb1ea6514e
BLAKE2b-256 5b3f1e5f99bea77ba67829c54775302b82ab9dd770b6309e34474108fd3e2219

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b180b100bae5861f457ea227ff19443d136685e61c3ce54539010bee2dbaa19
MD5 212c5547496d1d31dd66c64676a5f6a7
BLAKE2b-256 230e84d81115118a08c2d94f05dac3568bb2edefa3bc5ce2b52b073c03bb03d1

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6cfb889e43c2fb08283a4ed4316a5639e51e5cbde23b2d991db10cf294923070
MD5 3ce1669925ce64e65988af5896a725d5
BLAKE2b-256 7e0a0adb986f4fe85f02971664ef7a1b2ff0321f6e7ec2e0db840f53a337f000

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93623cc40553841ad1dec3dc3d8bdd28404a8857d1087a75199bb5f1535b0edb
MD5 393d581a6b9efb5ba52a5dfb61f4628d
BLAKE2b-256 b3ffa734bd82279cac9c5cdad275505581e51827fac6186b0c5b84a0f6d10adb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 61d506c386985af82d055e71ed0f1405ff671f167ad7b6fd185a3abfd8bc083e
MD5 4a7478de3ed9931c3d2d972022cea228
BLAKE2b-256 bc2ebc39f766396256a89966300794a64af3b9fbc3c9bfd07f5f435f798e42c8

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4ec7f261ce9c34f656cfada24102e9b7b09d6741233a7609b51c4a47e756a14
MD5 0c1fccba8928e79b8e2523f05c2bf651
BLAKE2b-256 5468684deb568f47d6561456b6b146cd949e539b00ab2a8b5bfd56620c84e075

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 950ea44bc7f3552d43cd4fcdbc2a97cd08a67c423fee2bea5d41b54459f862b2
MD5 f14a4c106122a230cfa445f2360c3cf4
BLAKE2b-256 ffd261ba94e8fceb3ebcf4eea71918111d560b8182816a872df208a60ccc4c62

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb3b99d3c09fbdb36f182de75b0934a48a4b34d2decb21b590cdcfe61539ff18
MD5 f118756c1057265be611b699c386781d
BLAKE2b-256 ff1234cc918e7627a81df8d56b19773b58b79b0c9ac15d855efb5a522f8f2d00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0ebc97dcf7389dcf92ae3318045422b60cc3c602128247e1fa970cf37739a1f8
MD5 dffb30d3ff4ee6543b183bcd350ec5fe
BLAKE2b-256 492015503cd7663765fabba9705ba545d9e0ac41a58d88169888818fbf6f586e

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf4c7e16e6871bfc2f9dfbd4a69db5d63c693e8d231730d7215774ed5f17dbed
MD5 1cfa044ef76eba0f42d966fa191fc17f
BLAKE2b-256 cbbef37d31ad77d150f28cddc709c828ef45e14197c18240bcbb9d840cc03c96

See more details on using hashes here.

File details

Details for the file network_symmetry-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for network_symmetry-0.4.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 81002ea6f77f836601e3eb4201d0f34c75a74ba2640ccba3cf11e906bfa8c52f
MD5 1b5c708beef2fa17f54ac696c5476d95
BLAKE2b-256 9404276ec81bab1ae7ccf7d89d6e0eb105977b3e5666bfab42215f3064c2837a

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