Skip to content

Commit 378eb6c

Browse files
authored
Merge pull request #211 from JuliaDynamics/hw/fixinsp
fix number of elements
2 parents 9fc4c84 + b782d25 commit 378eb6c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

NetworkDynamicsInspector/src/graphplot.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ function _adapt_xy_scaling!(xratio, yratio, ax)
264264
end
265265

266266
function gpstate_control_card(app, type)
267+
NEL = type == :vertex ? nv : ne
267268
VEIndex = type == :vertex ? VIndex : EIndex
268269
label = type == :vertex ? "Node state:" : "Edge state:"
269270
stateobs = type == :vertex ? app.graphplot.nstate : app.graphplot.estate
@@ -279,7 +280,7 @@ function gpstate_control_card(app, type)
279280
options = Observable{Vector{OptionGroup{Symbol}}}()
280281
on(app.sol; update=true) do _sol
281282
_nw = extract_nw(_sol)
282-
idxs = VEIndex.(1:nv(_nw))
283+
idxs = VEIndex.(1:NEL(_nw))
283284
options[] = gen_state_options(_nw, idxs)
284285
nothing
285286
end
@@ -310,7 +311,7 @@ function gpstate_control_card(app, type)
310311
if length(_state) == 0
311312
maxrange[] = (-1.0, 1.0)
312313
elseif length(_state) == 1
313-
idxs = VEIndex.(1:nv(extract_nw(_sol)), only(_state))
314+
idxs = VEIndex.(1:NEL(extract_nw(_sol)), only(_state))
314315
r = Float32.(_maxrange(_sol, idxs, _rel))
315316

316317
if r[1] == r[2]

0 commit comments

Comments
 (0)