HyperGraph.cs

31 lines | 777 B Blame History Raw Download
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HyperGraph
{
    class HyperGraph
    {
        public List<List<string>> HyperEdge;

        public HyperGraph(Matrix<int> matrix)
        {
            HyperEdge = new List<List<string>>();

            //  По ребрам (столбцам)
            for (int j = 0; j < matrix.countColumn; j++)
            {
                HyperEdge.Add(new List<string>());
                //  По вершинам (строкам)
                for (int i = 0; i < matrix.countRow; i++)
                {
                    if (matrix[i][j] == 1)
                        HyperEdge[j].Add("v" + i);
                }
            }
        }
    }
}