But this code will only give me maximum number of edges that can be included in tha subgraph for the given constarint:
Please correct the code and help me proceed further:
ED=MixedIntegerLinearProgram(maximization=True)
var=ED.new_variable(binary=True)
ED.set_objective(sum([var[Set(e)] for e in DG.edges(labels = True)]))
for v in DG:
edges = DG.edges_incident(v, labels = True)
ED.add_constraint( sum([var[Set(e)] for e in edges]) <= 2 )
ED.solve()
var = ED.get_values(var)
print [e for e,i in var.items() if i]