How to work with JuMP and Graphs.jl

It’s useful to also show the errors you get.

In that case I think you need to do

@constraint(model, x[Edge(1 => 2), 1] == 1)

As far as I know JuMP cannot understand Graphs.jl so you have to give it the numbers. Use get_prop! from MetaGraphs.jl for that.

Probably a good resource is GitHub - JuliaGraphs/GraphsOptim.jl: A package for graph optimization algorithms that rely on mathematical programming.
Have a look at the source code to see how they define models.

3 Likes