igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] problem with igraph_maximum_bipartite_matching


From: Mohammad R Karimi
Subject: [igraph] problem with igraph_maximum_bipartite_matching
Date: Mon, 16 Feb 2015 17:11:45 +0330

Hi Every one!
I used in one of my program. when i set these weights , it worked correctly:

0,0,0,0,0,
0,0,0,0,0,
490,492,849,902,838,
491,507,899,883,765,
261,248,585,648,697

but when i added the following weights , it couldn't match any vertexes:

0,0,0,0,0,
0,0,0,0,0,
490,492,849,877,838,
491,507,899,903,765,
261,248,585,613,697

I can't understand what the problem is. I'm sure we can find a matching set with that weights.

Here's my code :
igraph_small(&graph,
                     0,5, 0,6, 0,7, 0,8, 0,9,
                     1,5, 1,6, 1,7, 1,8, 1,9,
                     2,5, 2,6, 2,7, 2,8, 2,9,
                     3,5, 3,6, 3,7, 3,8, 3,9,
                     4,5, 4,6, 4,7, 4,8, 4,9,
                     -1);
        igraph_vector_bool_init(&types, 10);
        for (i = 0; i < 10; i++)
            VECTOR(types)[i] = (i >= 5);
        igraph_vector_long_init(&matching, 0);
        igraph_vector_init_copy(&weights, weight_array,
                                sizeof(weight_array) / sizeof(weight_array[0]));

        igraph_maximum_bipartite_matching(&graph, &types, &matching_size,
                                          &matching_weight, &matching, &weights,DBL_EPSILON);

        igraph_is_maximal_matching(&graph, &types, &matching, &is_matching);
        if (!is_matching) {
            isMatched = false;
            qDebug()<<"Not Matched!!!";
        }
        else
        {
            isMatched=true;
            qDebug()<<"Matched.";
        }

--
Mohammad Reza Karimi Dastjerdi
Student of Computer Engineering
K.N.Toosi University of Technology
Department of Electrical and Computer Engineering Tehran, Iran

reply via email to

[Prev in Thread] Current Thread [Next in Thread]