Please let me know how can i form the objective function for finding the 
maximum weighted sub graph. Constraint will be highest degree of each node can 
be 2. 
I have the below code:

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]



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to