You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indeed, I can reproduce it here. It only seems to be the case for two nodes, and occurs because at some point coordinates for all nodes vanish (due to a combination of gravity and strong-connectedness), which makes the totalEffectiveTraction vanish as well and raise a ZeroDivisionError.
A similar error occurs when all positions are initialized to the same value.
Hi,
the following code snippet works around 50% of the time and throws "ZeroDivisionError" 50% of the time.
forceatlas2 = ForceAtlas2(
# Behavior alternatives
outboundAttractionDistribution=True, # Dissuade hubs
linLogMode=False, # NOT IMPLEMENTED
adjustSizes=False, # Prevent overlap (NOT IMPLEMENTED)
edgeWeightInfluence=1.0,
# Performance
jitterTolerance=1.0, # Tolerance
barnesHutOptimize=True,
barnesHutTheta=1.2,
multiThreaded=False, # NOT IMPLEMENTED
# Tuning
scalingRatio=2.0,
strongGravityMode=False,
gravity=0.5,
# Log
verbose=True)
G = nx.complete_graph(2)
forceatlas2.forceatlas2_networkx_layout(G, pos=None, iterations=1000)
Output when it works:
0%| | 0/1000 [00:00<?, ?it/s]
0%| | 0/1000 [00:00<?, ?it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:00<00:00, 112015.38it/s]
BarnesHut Approximation took 0.00 seconds
Output when it doesn't work
0%| | 0/1000 [00:00<?, ?it/s]
0%| | 0/1000 [00:00<?, ?it/s]
ZeroDivisionError: float division
The text was updated successfully, but these errors were encountered: