Solving type instability when using Graphs.jl

I think this is due to your struct having an abstractly typed field.

You can fix this in many different ways, from specific to generic:

struct Network
    graph::SimpleDiGraph{Int}
    ...
end
struct Network{V<:Integer}
    graph::SimpleDiGraph{V}
    ...
end
struct Network{G<:AbstractGraph}
    graph::G
    ...
end
2 Likes