Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C

Uniquely Restricted Matchings in a Graph

0.00/5 (No votes)
1 Nov 2012CPOL1 min read 7K   68  
Algorithm to find out all the Matchings and Uniquely Restricted Matchings in a Graph

Introduction

The code is written in C language using Dev C++ tool. The code reads a graph from the file which is presented in as adjacency list. Then, it finds all the matching present in the graph. Then it filters out the uniquely restricted matching from the previous matching list.

Background 

A matching in a graph is a set of edges no two of which share a common vertex. A uniquely restricted matching in a graph is a matching M whose saturated vertices induce a subgraph which has only one perfect matching,which is M itself. The developed algorithm finds all the matching present in the graph and then finds the uniquely restricted matching. 

Using the code

Just a double-click on the mouse pad will do the job. Then enter the file-name to read the graph. There are 6 testcases given with the code. You may test others too, but with the same input structure for the graph in the text file.A brief description of how to use the article or code. The number in the first line is the no. of vertices present in the graph. Then the 1st numbers in each line are the vertex ids and the numbers next to them are the adjacent vertices to the 1st vertex i.e. the 1st number.

History

1.0.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)