Code Monkey home page Code Monkey logo

perfectbipartitematching's Introduction

Perfect Bipartite Matching

This repository holds a solution to a problem, which can be reconstructed as a perfect bipartite matching problem, which I was tasked to solve. Two versions of the code are provided - one with comments, and one without. The remainer of this README is an explanation of the Problem. The paper regarding the problem, algorithm, results, complexities and proofs is also provided as paper.pdf.


Problem

We were tasked to find out which player has the winning strategy in the following game:

Veronique and Mark play the following game: Veronique starts by naming an actress u, then Mark responds with an actor v which has co-starred with u, then Veronique names an actress w which co-stars with actor v, and so on. Of course they are not allowed to name the same actress or actor twice. The first player who gets stuck (i.e. is not able to respond any more) loses.

Given a fixed set of actresses X, a fixed set of actors Y and a fixed list of movies with casts, this is a finite game where both players have all information. So either Veronique or Mark should have a winning strategy (i.e. able to always win, no matter what moves the other player makes).

Veronique always starts.


Input

Input to the program is given via stdin, in the following format:

2 2
DianaKruger
MelanieLaurent
BradPitt
NormanReedus
IngloriousBasterds
3
DianaKruger
MelanieLaurent
BradPitt
Sky
2
DianaKruger
NormanReedus

The first line contains integers n with 1 <= n and m with 0 <= m, which represent the number of actors/actresses and the amount of movies respectively. Note that |X| = |Y| = n. Following this line is n lines of names of actresses, and then n lines of names of actors. Then m times the following:

  • The name of the movie.
  • The cast size s with 1 <= s <= 1000 of the movie, as an integer.
  • s lines of cast members. All names are unique.

Output

Output should be given via stdout. The program should either output Mark or Veronique, depending on who has the winning strategy.


Contributing

I am not taking contributions for this repository, as it is designed as an archive.


License

This project is licensed under the MIT License - see the LICENSE.md file for details.

perfectbipartitematching's People

Contributors

tomaarsen avatar

Watchers

 avatar  avatar

Forkers

kpmrozowski

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.