GithubHelp home page GithubHelp logo

alanmazankiewicz / gpamatching Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 908 KB

This is an implementation of the global paths matching algorithm.

License: GNU General Public License v3.0

Python 3.67% C++ 90.71% C 5.33% Shell 0.29%

gpamatching's Introduction

GPAMatching

This is an implementation of the global paths matching algorithm.

The Global Paths Algorithm (GPA), was proposed by Maue and Sanders in "Engineering Algorithms for Approximate Weighted Matching" (WEA'07) as a synthesis of Greedy and Path Growing algorithms by Drake et. al. The greedy algorithm sorts the edges by descending weight (or rating) and then scans them. If an edge {u,v} and its end points are not matched yet, it is put into the matching.

Similar to the Greedy approach, GPA scans the edges in order of decreasing weight (or rating); but rather than immediately building a matching, it first constructs a collection of paths and even length cycles. To be more precise, these paths initially contain no edges. While scanning the edges, the set is extended by successively adding applicable edges. An edge is called applicable if it connects two endpoints of different paths or the two endpoints of an odd length path. Afterwards, optimal solutions/matchings are computed for each of these paths and cycles using dynamic programming. Both algorithms achieve a half-approximation in the worst case, but empirically, GPA gives considerably better results.

The program is licenced under GPL 3.0. If you publish results using our algorithms, please acknowledge our work by quoting the following paper:

@inproceedings{kaffpa, author = {P. Sanders and C. Schulz}, title = {{Engineering Multilevel Graph Partitioning Algorithms}}, booktitle = {Proceedings of the 19th European Symposium on Algorithms}, year = {2011}, pages = {469--480}, publisher = {Springer}, series = {LNCS}, volume = {6942}, isbn = {978-3-642-23718-8} }

Graph Format

The graph format used is the same as used by Metis, Chaco and the graph format that has been used during the 10th DIMACS Implementation Challenge on Graph Clustering and Partitioning. The input graph has to be undirected, without self-loops and without parallel edges.

To give a description of the graph format, we follow the description of the Metis 4.0 user guide very closely. A graph G=(V,E) with n vertices and m edges is stored in a plain text file that contains n+1 lines (excluding comment lines). The first line contains information about the size and the type of the graph, while the remaining n lines contain information for each vertex of G. Any line that starts with % is a comment line and is skipped.

The first line in the file contains either two integers, n m, or three integers, n m f. The first two integers are the number of vertices n and the number of undirected edges of the graph, respectively. Note that in determining the number of edges m, an edge between any pair of vertices v and u is counted only once and not twice, i.e. we do not count the edge (v,u) from (u,v) separately. The third integer f is used to specify whether or not the graph has weights associated with its vertices, its edges or both. If the graph is unweighted then this parameter can be omitted. It should be set to 1 if the graph has edge weights, 10 if the graph has node weights and 11 if the graph has edge and node weights.

The remaining n lines of the file store information about the actual structure of the graph. In particular, the ith line (again excluding comment lines) contains information about the ith vertex. Depending on the value of f, the information stored in each line is somewhat different. In the most general form (when f=11, i.e. we have node and edge weights) each line has the following structure:

   c, v_1, w_1, v_2, w_2 .. v_k, w_k 

where c is the vertex weight associated with this vertex, v_1, ..., v_k are the vertices adjacent to this vertex, and w_1, ..., w_k are the weights of the edges. Note that the vertices are numbered starting from 1 (not from 0). Furthermore, the vertex-weights must be integers greater or equal to 0, whereas the edge-weights must be strictly greater than 0.

Output Format

After the algorithms computed a matching the output matching of the graph will be written in a file called matching. Each line of the file contains a matching edge (node ids start from 0).

gpamatching's People

Contributors

schulzchristian avatar

Watchers

James Cloos avatar

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.