hklarner / pyboolnet

PyBoolNet is a Python package for the generation, modification and analysis of Boolean networks.
43 stars 21 forks source link

AttributeError: 'DiGraph' object has no attribute 'node' #29

Closed hklarner closed 3 years ago

hklarner commented 4 years ago

Lately, I am using your package PyBoolNet to detect attractors of some networks, but I have some problems in doing the experiments. I would appreciate if you could help.

  1. An error occurs when using the Tarjan algorithm and the model checking-based algorithm. Please find the console output below.
    
    >>> import PyBoolNet
    >>> primes = PyBoolNet.FileExchange.bnet2primes("example.bnet”)

Tarjan algorithm

stg = PyBoolNet.StateTransitionGraphs.primes2stg(primes, "asynchronous") steady, cyclic = PyBoolNet.Attractors.compute_attractors_tarjan(stg)

Traceback (most recent call last): File "", line 1, in File ".../lib/python3.7/site-packages/PyBoolNet/Attractors.py", line 858, in compute_attractors_tarjan condensation_graph = PyBoolNet.Utility.DiGraphs.digraph2condensationgraph(STG) File ".../lib/python3.7/site-packages/PyBoolNet/Utility/DiGraphs.py", line 467, in digraph2condensationgraph cgraph.node[target]["depth"] = depth AttributeError: 'DiGraph' object has no attribute 'node'

model checking-based algorithm

attrs = PyBoolNet.Attractors.compute_json(primes, "asynchronous", FnameJson="attrs.json")

Attractors.compute_json(..) Traceback (most recent call last): File "", line 1, in File ".../lib/python3.7/site-packages/PyBoolNet/Attractors.py", line 95, in compute_json if completeness(Primes, Update): File ".../lib/python3.7/site-packages/PyBoolNet/Attractors.py", line 458, in completeness return _iterative_completeness_algorithm(Primes, Update, ComputeCounterexample=False) File ".../lib/python3.7/site-packages/PyBoolNet/Attractors.py", line 646, in _iterative_completeness_algorithm cgraph = PyBoolNet.Utility.DiGraphs.digraph2condensationgraph(igraph) File ".../lib/python3.7/site-packages/PyBoolNet/Utility/DiGraphs.py", line 467, in digraph2condensationgraph cgraph.node[target]["depth"] = depth AttributeError: 'DiGraph' object has no attribute 'node'

hklarner commented 4 years ago

What version of networkx are you using?

$ python3
>>> import networkx
>>> networkx.__version__
'2.2'
cuisu commented 4 years ago

I was using networkx 2.4. I change it to version 2.2 and it works now. Thanks.