# Ticket #8798: trac_8798.patch

File trac_8798.patch, 9.4 KB (added by ncohen, 10 years ago)
• ## sage/graphs/generic_graph.py

# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1272442371 -7200
# Node ID 60485faf0c71d23dae5639b1bb140e3413404e69
# Parent  ef74a6ed21179df343f658c015d7b068bb28c0f3
trac 8798 : remove duplicates of feedback_vertex_set and feedback_edge_set from generic_graph.py

diff -r ef74a6ed2117 -r 60485faf0c71 sage/graphs/generic_graph.py
 a else: raise ValueError("Only two algorithms are available : Cliquer and MILP.") def feedback_edge_set(self,value_only=False): r""" Computes the minimum feedback edge set of a digraph ( also called feedback arc set ). The minimum feedback edge set of a digraph is a set of edges that intersect all the circuits of the digraph. Equivalently, a minimum feedback arc set of a DiGraph is a set S of arcs such that the digraph G-S is acyclic. For more informations, see ( http://en.wikipedia.org/wiki/Feedback_arc_set ) INPUT : - value_only (boolean) -- - When set to True, only the minimum cardinal of a minimum edge set is returned. - When set to False, the Set of edges of a minimal edge set is returned. This problem is solved using Linear Programming, which certainly is not the best way and will have to be updated. The program solved is the following : .. MATH: \mbox{Minimize : }&\sum_{(u,v)\in G} b_{(u,v)}\\ \mbox{Such that : }&\\ &\forall v\in G, \sum_{i\in [0,\dots,n-1]}x_{v,i}=1\\ &\forall i\in [0,\dots,n-1], \sum_{v\in G}x_{v,i}=1\\ &\forall v\in G,\sum_{i\in [0,\dots,n-1]} ix_{v,i}=d_v\\ &\forall (u,v)\in G, d_u-d_v+nb_{(u,v)}\geq 0\\ An explanation : An acyclic digraph can be seen as a poset, and every poset has a linear extension. This means that in any acyclic digraph the vertices can be ordered with a total order < in such a way that if (u,v)\in G, then `u