Ejemplo n.º 1
0
        public static IEnumerable <IPath> ApplayRobertsFlores(this IOrgraph orgraph)
        {
            var factory = new GraphAtoFactory();
            var node    = orgraph.GetFirstNode();

            return(GetAllCircuit(node, orgraph, new HashSet <INode>(orgraph.Nodes.Count), node, factory, s => Console.WriteLine(s)));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            var graphFactory = new GraphAtoFactory();

            //AlgorithmsCourse.Task7();
            AlgorithmsCourse.Task10();
            //DiscreteMathematicsCourse.Task7(graphFactory);
            //DiscreteMathematicsCourse.Task8(graphFactory);
            //DiscreteMathematicsCourse.Task9(graphFactory);
        }
Ejemplo n.º 3
0
 public static IEnumerable<string> ApplayFleury(this IGraph graph)
 {
     var factory = new GraphAtoFactory();
     var cycle = factory.CreatePoute();
     var node = graph.GetFirstNode();
     int i = 0;
     do
     {
         var edges = node.GetEdges(graph).ToList();
         var p = edges.ToDictionary(e => e, e => !e.IsBrige(node.GetNext(e), graph));
         var edge = edges.FirstOrDefault(e => !e.IsBrige(node.GetNext(e), graph)) ?? edges.FirstOrDefault();
         yield return $"Step {i}, Cycle: {cycle.Print()}, Graph: {graph.Print()}, Current node: {node}, Current edge: {edge}";
         if (edge is null) break;
         node = node.GetNext(edge);
         graph.RemoveEdge(edge);
         cycle.Append(edge);
         i++;
     } while (true);
 }