public DirectedGraphMatrix Generate()
        {
            RandomNetworkGraphCreator generator = new RandomNetworkGraphCreator();

            generator.RowCount        = int.Parse(RowCount.Text);
            generator.NodePropability = double.Parse(NodePropability.Text) / 100.0;

            return(generator.Generate());
        }
        public DirectedGraphMatrix GenerateSkojarzenie()
        {
            RandomNetworkGraphCreator generator = new RandomNetworkGraphCreator();

            generator.MinimumNodePerRowLeft  = int.Parse(NodeCountLeft.Text);
            generator.MinimumNodePerRowRight = int.Parse(NodeCountRight.Text);

            generator.NoRandoms = true;
            generator.RowCount  = 2;

            var graph = generator.Generate();

            for (int x = 0; x < graph.NodesNr; ++x)
            {
                for (int y = 0; y < graph.NodesNr; ++y)
                {
                    if (graph.GetConnection(x, y))
                    {
                        graph.setWeight(x, y, 1);
                    }
                }
            }

            MaxFlow1 mf = new MaxFlow1(graph);

            mf.findMaxFlow(graph);

            var current = mf.getFlowMatrix();

            for (int y = 0; y < graph.NodesNr; ++y)
            {
                for (int x = 0; x < graph.NodesNr; ++x)
                {
                    graph.Current[x, y] = current[x, y];
                }
            }

            //teraz pokolorujmy
            int number = 1;

            for (int y = 0; y < graph.NodesNr; ++y)
            {
                for (int x = 0; x < graph.NodesNr; ++x)
                {
                    if (y == 0 || y == graph.NodesNr - 1)
                    {
                        continue;
                    }
                    if (x == 0 || x == graph.NodesNr - 1)
                    {
                        continue;
                    }
                    if (graph.SkojarzenieKolor[x] == 0 && graph.GetCurrent(x, y) > 0)
                    {
                        graph.SkojarzenieKolor[x] = number;
                        graph.SkojarzenieKolor[y] = number++;
                    }
                }
            }

            return(graph);
        }