mnets / pymnet Goto Github PK
View Code? Open in Web Editor NEWThe original library for analyzing multilayer networks.
Home Page: https://mnets.github.io/pymnet/
License: GNU General Public License v3.0
The original library for analyzing multilayer networks.
Home Page: https://mnets.github.io/pymnet/
License: GNU General Public License v3.0
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
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.
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).
Is there a reason for having both pyproject.toml and setup.py? Can you remove setup.py?
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.
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
This is certainly not essential to this review, but for greater consistency (in the future), I would choose snakecase or camelcase and stick with it. Right now, there is a mix of both.
Please consider fixing these typos in docs/tutorial/networktypes
:
These
totwo ways are equivalent, but [...]
The multilayer networks can in theory be used to represent
edmultiplex networks
JOSS Review Issue: openjournals/joss-reviews#6930
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).
I have identified an issue in the Reading and Writing Networks section of the documentation. Currently, this section only includes information about the read_ucinet
function.
To ensure comprehensive documentation, please include the full API related to reading and writing networks. This will enhance the usability and clarity of the documentation for all users.
I really liked the overview page, but it would be great to 1) link to it on the README 2) add a visual(s) of multilayer networks for newcomers and 3) clarify the language surrounding "aspects". I understand that (like in Multilayer Networks), this is pretty standard terminology, but it might be more consistent to rename aspects
to num_layers
or something similar.
TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'
As stated in matplotlib/matplotlib#20770 matplotlib's FigureBase.gca() deprecated the 'projection' argument, however Pymnet draw() is still using it in the current version.
There is a typo here:
pymnet/pymnet/graphlets/graphlet_measures.py
Lines 25 to 26 in 872e248
Fix: substitute permutated
with permuted
.
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?
Dear authors,
While reviewing your package, I noticed the following unexpected behaviours:
from pymnet import *
net = MultilayerNetwork(aspects=0)
net[1,2] = "hello"
net[1,2]
"hello"
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:
Not necessary for this review, but in the future, it could be useful to standardize the docstrings. One example of a standard is numpydoc.
In the docs/tutorial
git clone https://github.com/mnets/pymnet.git
)?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
Overall the paper looks good. Some comments:
Seems like vscode needed %matplotlib inline to use pymnet. It works now thanks.
AttributeError Traceback (most recent call last)
in ()
23 two_layer_net[4, 4, 'a', 'b'] = 1
24
---> 25 fig = draw(two_layer_net, layout="circular")
.......
AttributeError: 'NoneType' object has no attribute 'text'
There are several long lines (this one, for example) which should be wrapped using a formatter such as black.
In addition, using isort would help standardize import statement order.
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.)
Hello
May I ask how to call related packages to solve some related node indicators? For example, the degree and centrality of nodes, etc.
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.
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!!
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>
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:
pymnet
: A Multilayer Networks Library for Python”pymnet
: A Python Library for Multilayer Networks”pymnet
: A Multilayer Networks Library in Python”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.
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
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
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
Can you condense this line to
try:
from collections import MutableMapping
except ImportError:
from collections.abc import MutableMapping
I don't love the pass
statements. With the above, if neither work, it will throw an error.
The tutorials are really helpful, but it would be great if there was a tutorial on working with an empirical dataset (See Netzschleuder, for example).
Please consider fixing these typos in docs/overview
Here we take
ea similar approach
We typically consider
thatthe 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 valueswhose value is another dictionary containing information about the neighbors of each node.
JOSS Review Issue: openjournals/joss-reviews#6930
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.