Bipartite Graph Matching

Source: Internet
Author: User

HDU 2063

Returns the maximum matching value for a bipartite graph.

Complete bare question. Paste code.

# Include
 
  
# Include
  
   
# Include
   
    
# Include
    
     
Using namespace std; vector
     
      
G [1005]; bool check [1005]; int mac [1005]; int n; void add_edge (int from, int to) {G [from]. push_back (to); G [to]. push_back (from);} bool dfs (int u) {for (int I = 0; I
      
       
HDU 2444

Determines whether the image is a bipartite graph. If it is a bipartite graph, the maximum matching of the graph is obtained.

I used a DFS to determine whether it is a bipartite graph. I don't know if there is any simpler method.

# Include
        
         
# Include
         
          
# Include
          
           
# Include
           
            
# Include
            
             
# Include
             
               Using namespace std; vector
              
                G [205]; bool check [205]; int mac [205]; int re [205]; void add_edge (int from, int to) {G [from]. push_back (to); G [to]. push_back (from);} bool rdfs (int u, int k) {re [u] = k; bool flag = true; int k1; if (k = 1) k1 = 2; else k1 = 1; for (int I = 0; I
               
                
HDU 1281

Question: There are some places on a board that can hold a "car" to find the maximum number of points, and the number of points is the key point. The key point is that deleting the "car" that can be placed at this point will reduce.

Returns the X set column of the row to the Y set. Each point is an edge from the X-Y.

Perform bipartite graph matching. Then enumerate the edge and find the maximum match after deleting this edge. If it is less than before, it is the key point.

#include
                 
                  #include
                  
                   #include#include
                   
                    #include
                    
                     using namespace std;int mac[205];bool check[205];vector
                     
                       G[205];int z,y;int n;int k[10005][2];void add_edge(int from,int to){    G[from].push_back(to);    G[to].push_back(from);}bool dfs(int u){    for(int i=0;i
                      
                       

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.