private void RunBipartiteMatch(List <Edge <string> > edges, IEnumerable <string> setA,
                                       IEnumerable <string> setB, int expectedMatchSize)
        {
            var graph = edges.ToAdjacencyGraph <string, Edge <string> >();

            var vertexFactory = new StringVertexFactory();

            if (graph.VertexCount > 0)
            {
                this.MaxBipartiteMatch <string, Edge <string> >(graph, setA, setB,
                                                                () => (vertexFactory.CreateVertex()),
                                                                (source, target) => new Edge <string>(source, target),
                                                                expectedMatchSize
                                                                );
            }
        }
Exemplo n.º 2
0
        private void RunBipartiteMatchAndCheck(
            [NotNull, ItemNotNull] IEnumerable <Edge <string> > edges,
            [NotNull, ItemNotNull] IEnumerable <string> setA,
            [NotNull, ItemNotNull] IEnumerable <string> setB,
            int expectedMatchSize)
        {
            AdjacencyGraph <string, Edge <string> > graph = edges.ToAdjacencyGraph <string, Edge <string> >();

            var vertexFactory = new StringVertexFactory();

            if (graph.VertexCount > 0)
            {
                MaxBipartiteMatch(
                    graph,
                    setA.ToArray(),
                    setB.ToArray(),
                    () => vertexFactory.CreateVertex(),
                    _edgeFactory,
                    expectedMatchSize);
            }
        }
Exemplo n.º 3
0
        private static void RunBipartiteMatch(
            [NotNull, ItemNotNull] IEnumerable <Edge <string> > edges,
            [NotNull, ItemNotNull] IEnumerable <string> setA,
            [NotNull, ItemNotNull] IEnumerable <string> setB,
            int expectedMatchSize)
        {
            AdjacencyGraph <string, Edge <string> > graph = edges.ToAdjacencyGraph <string, Edge <string> >();

            var vertexFactory = new StringVertexFactory();

            if (graph.VertexCount > 0)
            {
                MaxBipartiteMatch(
                    graph,
                    setA.ToArray(),
                    setB.ToArray(),
                    () => (vertexFactory.CreateVertex()),
                    (source, target) => new Edge <string>(source, target),
                    expectedMatchSize);
            }
        }