Giter Club home page Giter Club logo

pymnet's People

Contributors

alexguirre avatar arashbm avatar bolozna avatar damink avatar dataspider avatar ercco avatar luizirber avatar pitmonticone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pymnet's Issues

importing pymnet library

Dear bolozna,

I apologise in advance as I am relatively new to python and perhaps the issue I'm experiencing is the result of that rather than a real issue. I really tried to make sure I checked everything, but you never new when learning a new programming language..

I'm trying to get the pymnet library running. I cloned the repository and I have added the library directory to my python path in Spyder. Now I'm running the first lines but run into the error:

ImportError: cannot import name 'sampling' from 'pymnet' (/usr/local/anaconda3/envs/multilayer-networks/lib/python3.7/site-packages/pymnet/init.py)

If you have any idea what I'm doing wrong here and if you could point me in a right direction (documentation?) I'm super grateful.

Thank you very much in advance,
Tessa

[REVIEW] Missing documentation about `pymnet.net.MultilayerNode`

Dear authors,

While running your tutorial, I noticed the existence of the class pymnet.net.MultilayerNode:

from pymnet import *
net = MultilayerNetwork(aspects=0)
net.add_node(1)
net[1]
<pymnet.net.MultilayerNode object at 0x000002CD29CAAA50>

which exists here.

Anyway I could not find documentation for it. Since it exposes public APIs, I'd suggest providing such documentation.

Also, I noticed the use of str to name the function that returns the weighted degree of a node. Since the str name is historically assigned to strings in Python, I would suggest renaming it to something else.

[REVIEW] Error when computing automorphism

Dear authors,

While running the tutorial on automorphisms, I got the error:

import pymnet
net_social = pymnet.MultiplexNetwork(couplings='categorical', fullyInterconnected=False)
net_social["Alice", "Bob", "Friends"] = 1
net_social["Alice", "Carol", "Friends"] = 1
net_social["Bob", "Carol", "Friends"] = 1
net_social["Alice", "Bob", "Married"] = 1

net_transport = pymnet.MultiplexNetwork(couplings='categorical', fullyInterconnected=False)
net_transport["Helsinki", "Turku", "Train"] = 1
net_transport["Helsinki", "Tampere", "Train"] = 1
net_transport["Turku", "Tampere", "Train"] = 1
net_transport["Helsinki", "Turku", "Ferry"] = 1

print(pymnet.get_automorphism_generators(net_social, allowed_aspects=[0]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\claud\anaconda3\envs\pymnet_review\Lib\site-packages\pymnet\isomorphisms\__init__.py", line 197, in get_automorphism_generators
    assert len(automorphism_group_generator_backends) > 0, \
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: No backends for automorphism generators were imported!

I understand that the bliss-blind package is needed. Anyway, I could not find it online (also, it should come installed as a dependency on Windows x64 machines, according to the documentation).

Preparing Software Publication

Checklist

Primary responsibilities assigned following our discussion, feel free to modify/object.
Once an item is considered done, check its box.
Async discussion in the thread for this issue.

General checks

  • Source code publicly available on GitHub
  • OSI approved plain-text LICENSE file
  • Author contribution

Functionality

  • Installation possible via pypi @arashbm
  • Cleaner handling of Networkx dependency @arashbm
  • Networkx 3.x support (optional) @arashbm
  • Graphlet functionality (handling Bliss dependency: make it compatible w/ Python 3, replace by SOTA graph isomorphism library, ...?) @arashbm + @ercco
  • Update project requirements/toml to reflect Networkx 3.x support @arashbm

Code quality

  • (Almost) full test coverage @ercco (graphlet + sampling functionality), all others for the rest
  • Automated testing (GitHub actions) @arashbm
  • Codecov integration (optional) @dataspider
  • Codeclimate integration (optional) @dataspider

Documentation

  • Installation instructions + clearly stated list of dependencies + automated package management @arashbm
  • Automated documentation (sphinx + GitHub actions) @arashbm
  • Code of conduct (w/ MK contact webpage as default contact point) @dataspider

Writeup

  • Separate "publication" branch @dataspider
  • Writing folder "paper" with "paper.md" and "paper.bib" in it @dataspider
  • Summary of purpose and high-level functionality @bolozna (first draft)
  • Statement of need @ercco (first draft)
  • State of the field ("related packages", papers using pymnet already) @ercco (first draft)
  • Example usage with code examples and pretty figures @ercco + @dataspider
  • High-quality writing @dataspider
  • Complete references using rmarkdown citation syntax @dataspider
  • Check acknowledgements section + add grant number @bolozna

Bells and Whistles

  • Docstrings for remaining API methods + add to references.rst @ercco (graphlet + sampling functionality)
  • Other CI (incl. updating pypi package) @arashbm
  • State-of-the-art example data provision @dataspider
  • Example usage (old tutorials -> ipynb tutorials) @dataspider
  • Proof-reading all tutorials @dataspider
  • Proof-reading all docstrings @dataspider
  • Community guidelines (see GitHub's templates) @dataspider @arashbm

[REVIEW] Error in Tutorial: Network types: Multiplex networks

Dear authors,

In the tutorial section about multiplex networks, after defining the 2-aspect multiplex network conet you try to add a layer to its third aspect, which results in an error.

conet = MultiplexNetwork(couplings=['categorical','ordinal'])
conet.add_node('node')
conet.add_layer('a',1)
conet.add_layer('b',1)
conet.add_layer(1,2)
conet.add_layer(2,2)
conet.add_layer(3,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\claud\anaconda3\envs\pymnet_review\Lib\site-packages\pymnet\net.py", line 997, in add_layer
    if layer not in self.slices[aspect]:
                    ~~~~~~~~~~~^^^^^^^^
IndexError: list index out of range

[REVIEW]: Typo in docstring of `pymnet.read_ucinet`

There is a typo here.

The paragraph can be fixed as follows:

Currently, the network is assumed to be unweighted and, if the input file contains a directed network, an undirected one is returned anyway. The directions are removed in a way that i and j are connected if there is either link i->j or j->i (or both).

Error when creating a four-layer multilayer

When I add edges of a single layer using the code like mnet = MultilayerNetwork(aspects = 3) and mnet[1,2,'gene','gene'] = 1, it reports the error like "KeyError: 'Invalid number of indices.'". But when I change the aspects of the multilayer network to 2 mnet = MultilayerNetwork(aspects = 2) and run the same code to add edges, the program runs correctly. So what is the cause of this error?

[REVIEW] Strange behaviours

Dear authors,

While reviewing your package, I noticed the following unexpected behaviours:

  1. Assigning strings to edges is allowed:
from pymnet import *
net = MultilayerNetwork(aspects=0)
net[1,2] = "hello"
net[1,2] 
"hello"
  1. Modifying the MultilayerNetwork via a MultilayerNode:
from pymnet import *
net = MultilayerNetwork(aspects=0)
net.add_node(1)
net[1].mnet.add_node(2)
list(net)
[1, 2]

I understand that these behaviors do not break the software, therefore fixing them is not mandatory for this review. Anyway, for the future, I would like to respectively point out:

  1. Disallowing this by e.g. throwing and error;
  2. Using getters and setters, or name mangling;

[REVIEW]: Installation instructions in docs/tutorial

In the docs/tutorial

  • the mentioned URL to the GitHub repository works, but it is a redirect. Could you update it?
  • the mentioned git clone path is outdated and requires a public SSH key. Could you substitute it with the HTTPS version (i.e. git clone https://github.com/mnets/pymnet.git)?

collections.MutableMapping removed in Python 3.10, causing error on import

On Python 3.10.8:

>>> import pymnet as pn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Multilayer-networks-library/pymnet/__init__.py", line 1, in <module>
    from .net import MultilayerNetwork,MultiplexNetwork
  File "Multilayer-networks-library/pymnet/net.py", line 810, in <module>
    class MultiplexIntraNetDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

Related: https://stackoverflow.com/questions/59636631/importerror-cannot-import-name-mutablemapping-from-collections
Looks like MutableMapping has been moved from collections to collections.abc.

Temporary fix found in the StackOverflow answer: https://stackoverflow.com/a/75382123

[REVIEW] Edits to JOSS paper

Overall the paper looks good. Some comments:

  • The "Statement of Need" section was clearly written and helpful.
  • There might not be space, but it would be cool to have a visualization of a small empirical multilayer network.
  • In the summary, there are a few long and confusing sentences. For example, in the sentence "Multilayer networks (Kivelä et al., 2014) generalize graphs to capture the rich network data often associated with complex systems, allowing us to study a broad range of phenomena using a common representation, using the same multilayer tools and methods" can you remove the comma or end with "using the same representations, tools, and methods." In addition, can you rewrite "For many systems, there is a need to represent richer network data, such as multidimensional features, several types of interactions, numerous layers of hierarchy, and multiple modalities, to capture the structure and dynamics of the systems more accurately than simple graphs would allow." to something like "Many systems contain nodes with multidimensional features, interactions of different types, different levels of hierarchy, and multiple modalities, which are more faithfully captured with multilayer networks than simple graphs."
  • The "Main Features and Examples" section was well-written and helpful.

openjournals/joss-reviews#6930

[REVIEW] Improve contribution guide

I see that there is a brief contribution guide in the README. It would be helpful to add a few issues with the "Good first issues" (For example, see NetworkX, and link to this label in the contribution section.

In the future, it would be great to make the contribution guide a bit more step-by-step (e.g., fork the repository, make your changes, check test coverage, format code, add docs (is there a docstring format?), make a PR, etc.)

openjournals/joss-reviews#6930

[REVIEW]: Improve test coverage

It would be great if this package were better covered. There are one or two modules with very little test coverage, which would be low-hanging fruit to improve coverage.

In addition, it would be great to add minimum coverage requirements for new pull requests using the CodeCov yaml file.

openjournals/joss-reviews#6930

Import error

Hi @bolozna ,

Please could you help me out with below mentioned error:
ImportError: cannot import name 'sampling' from partially initialized module 'pymnet' (most likely due to a circular import) (/home/duvuki/anaconda3/envs/colstrike/lib/python3.9/site-packages/pymnet/init.py)

I searched for posts with solutions, and tried commenting from . import sampling (last line) in init.py
Still receiving same error.
Thanks in advance!!

[REVIEW] Residuals from Python 2

Dear authors,

I noticed that in the tutorial on Using NetworkX functions, some residuals from Python 2 are present:

print net
print map(nx.number_connected_components,models.er(1000,3*[0.005]).A.values())

Moreover the last line, when ported to python 3, does not return [9, 11, 8] as reported:

print(map(nx.number_connected_components,models.er(1000,3*[0.005]).A.values()))
<map object at 0x000001B26309D4B0>

[REVIEW]: Paper title

The current paper title is “pymnet: A Multilayer-Networks Library for Python”.

I believe the hyphen in “Multilayer-Networks” is unnecessary. I suggest removing the hyphen and considering alternative titles such as:

  1. pymnet: A Multilayer Networks Library for Python”
  2. pymnet: A Python Library for Multilayer Networks”
  3. pymnet: A Multilayer Networks Library in Python”

Plotting a six-layer multilayer

Hi, I'm trying to plot a multilayer with six layers, but I only get 3 and a half layers. I have tried modifying the figsize but the other layers are still blank, although the lab of those layers appears. I would appreciate your help to visualize the whole network.

Also, I would like to know how to set the order of layers.

Thanks for advance.

image

ImportError: cannot import name 'sampling' from 'pymnet'

Hello,
After I installed pymnet from git, I run into the below issue when trying run "from pymnet import *":

ImportError: cannot import name 'sampling' from partially initialized module 'pymnet' (most likely due to a circular import)

Can you help me on this? thanks,
Yuanyuan

[REVIEW]: Add other related Python packages

In the "Related Packages" section of the paper you write the following paragraph:

pymnet/paper/paper.md

Lines 96 to 98 in b96b48c

The only other library offering tools to work with multilayer networks in Python is [multiNetX](https://github.com/nkoub/multinetx), which appeared after `pymnet` and seems no longer actively maintained.
Support for working with multilayer networks in Julia is offered by [MultilayerGraphs.jl](https://github.com/JuliaGraphs/MultilayerGraphs.jl) from @moroni2023, who also compile a list of R packages offering similar functionality.

Could you consider including Py3Plex?

Assertion error.

mnet = MultilayerNetwork(aspects=2) #aspects==dimension
mnet[1,2,'a','b','x','y']=1
mnet.add_layer('c',1)
mnet.add_layer('z', 2)
fig=draw(mnet)

I tried example of multi aspects.
But they said,

Traceback (most recent call last):
File "D:/TSMM/2.DigitalHumanities/MultilayerNetworksLibrary/multi_aspect2.py", line 14, in
fig=draw(mnet)
File "D:\TSMM\2.DigitalHumanities\MultilayerNetworksLibrary\pymnet\visuals\drawcore.py", line 159, in draw
assert net.aspects==1
AssertionError

Is there a way to export the model to the web?

Hi @bolozna

I want the model to be displayed on the web page.And I saw that there is code in pymnet about implementing it with threejs. I called an earlier version of threejs to render successfully.But I found that the content about the layer is not well generated.
Thanks in advance

[REVIEW]: Typos in `docs/overview`

Please consider fixing these typos in docs/overview

Here we take e a similar approach

We typically consider that the number of aspects, $d$, to be constant and not dependent on the size of the data.

That is, the graph is a dictionary where each node [...] is a key and values whose value is another dictionary containing information about the neighbors of each node.

JOSS Review Issue: openjournals/joss-reviews#6930

[REVIEW] Figure not showing

Dear authors,

If I run your tutorial on Visualizing Networks, the figure does not show:

from pymnet import *
net = models.er_multilayer(5,2,0.2)
fig = draw(net,show=True)
C:\Users\claud\anaconda3\envs\pymnet_review\Lib\site-packages\pymnet\visuals\drawbackends\mpl.py:79: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()

I tried installing PyQt6 (as suggested here) to no avail.

Would you have any idea on what could the problem be (perhaps it is related to my machine or environment)?

Environment:

(pymnet_review) C:\Users\claud>conda list
# packages in environment at C:\Users\claud\anaconda3\envs\pymnet_review:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h2bbff1b_6
ca-certificates           2024.3.11            haa95532_0
contourpy                 1.2.1                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
expat                     2.6.2                hd77b12b_0
fonttools                 4.53.0                   pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
libffi                    3.4.4                hd77b12b_1
matplotlib                3.9.0                    pypi_0    pypi
networkx                  3.3                      pypi_0    pypi
numpy                     2.0.0                    pypi_0    pypi
openssl                   3.0.14               h827c3e9_0
packaging                 24.1                     pypi_0    pypi
pillow                    10.3.0                   pypi_0    pypi
pip                       24.0            py312haa95532_0
pymnet                    0.2.0                    pypi_0    pypi
pyparsing                 3.1.2                    pypi_0    pypi
pyqt6                     6.7.0                    pypi_0    pypi
pyqt6-qt6                 6.7.2                    pypi_0    pypi
pyqt6-sip                 13.6.0                   pypi_0    pypi
python                    3.12.4               h14ffc60_1
python-dateutil           2.9.0.post0              pypi_0    pypi
scipy                     1.13.1                   pypi_0    pypi
setuptools                69.5.1          py312haa95532_0
six                       1.16.0                   pypi_0    pypi
sqlite                    3.45.3               h2bbff1b_0
tk                        8.6.14               h0416ee5_0
tzdata                    2024a                h04d1e81_0
vc                        14.2                 h2eaa2aa_1
vs2015_runtime            14.29.30133          h43f2093_3
wheel                     0.43.0          py312haa95532_0
xz                        5.4.6                h8cc25b3_1
zlib                      1.2.13               h8cc25b3_1

OS: windows 10

IDE: vscode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.