Skip to content

Commit

Permalink
Rename min/max dim
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanelteren committed Feb 20, 2024
1 parent 4676473 commit 8713a46
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions networkx/drawing/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,18 +1227,17 @@ def estimate_factor(n, swing, traction, speed, speed_efficiency, jitter_toleranc
else:
dim = len(next(iter(pos.values())))

# default node positions proportional to the input dimensions
# (if it exists)
max_dim = 1
min_dim = 0
# Scale the position of the node proportional to the @pos
max_pos_range = 1
min_pos_range = 0
# check if we have a valid pos else just return (empty graph)
if pos:
max_dim = np.array([max(i) for i in pos.values()]).max()
min_dim = np.array([min(i) for i in pos.values()]).min()
max_pos_range = np.array([max(i) for i in pos.values()]).max()
min_pos_range = np.array([min(i) for i in pos.values()]).min()
else:
return pos

pos_arr = np.random.rand(len(G), dim) * max_dim - min_dim
pos_arr = np.random.rand(len(G), dim) * max_pos_range - min_pos_range

mass = np.zeros(len(G))
size = np.zeros(len(G))
Expand Down

0 comments on commit 8713a46

Please sign in to comment.