static void Main(string[] args)
        {
            WeighGraph gr = new WeighGraph(5);

            gr.AddArc(0, 1, or: false);
            gr.AddArc(1, 2, or: false);
            gr.AddArc(0, 3, or: false);
            gr.AddArc(2, 3, or: false);
            gr.AddArc(2, 4, or: false);
            gr.AddArc(3, 4, or: false);

            var loop = gr.ContainsLoop();
            Dictionary <List <int>, int> set = new Dictionary <List <int>, int>(new ListEqualityComparer());

            for (int i = 0; i < loop.Count; i++)
            {
                HashSet <int> hTemp  = new HashSet <int>(loop[i]);
                List <int>    vertex = hTemp.ToList();
                if (set.ContainsKey(vertex) == false)
                {
                    set[vertex] = i;
                }
            }



            foreach (var it in set)
            {
                for (int i = 0; i < loop[it.Value].Count; i++)
                {
                    Console.Write(loop[it.Value][i] + 1);
                }
                Console.WriteLine();
            }
        }
 public WeighGraph(WeighGraph gr)
     : base(gr)
 {
 }