All Projects → ageneau → blossom

ageneau / blossom

Licence: other
Edmonds's blossom algorithm for maximum weight matching in undirected graphs

Programming Languages

clojure
4091 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to blossom

Algorithms
A collection of common algorithms and data structures implemented in java, c++, and python.
Stars: ✭ 142 (+787.5%)
Mutual labels:  graph-algorithms
Quiver
A reasonable library for modeling multi-graphs in Scala
Stars: ✭ 195 (+1118.75%)
Mutual labels:  graph-algorithms
Pygraphblas
GraphBLAS for Python
Stars: ✭ 252 (+1475%)
Mutual labels:  graph-algorithms
Hgp Sl
Hierarchical Graph Pooling with Structure Learning
Stars: ✭ 159 (+893.75%)
Mutual labels:  graph-algorithms
Ppnp
PPNP & APPNP models from "Predict then Propagate: Graph Neural Networks meet Personalized PageRank" (ICLR 2019)
Stars: ✭ 177 (+1006.25%)
Mutual labels:  graph-algorithms
Pathfinding Visualizer Threejs
A visualizer for pathfinding algorithms in 3D with maze generation, first-person view and device camera input.
Stars: ✭ 209 (+1206.25%)
Mutual labels:  graph-algorithms
Data Structures
Common data structures and algorithms implemented in JavaScript
Stars: ✭ 139 (+768.75%)
Mutual labels:  graph-algorithms
InterviewPrep
A repository containing link of good interview questions
Stars: ✭ 54 (+237.5%)
Mutual labels:  graph-algorithms
Midas
Go implementation of MIDAS: Microcluster-Based Detector of Anomalies in Edge Streams
Stars: ✭ 180 (+1025%)
Mutual labels:  graph-algorithms
Graph Data Science
Source code for the Neo4j Graph Data Science library of graph algorithms.
Stars: ✭ 251 (+1468.75%)
Mutual labels:  graph-algorithms
Gapbs
GAP Benchmark Suite
Stars: ✭ 165 (+931.25%)
Mutual labels:  graph-algorithms
Graphlayouts
new layout algorithms for network visualizations in R
Stars: ✭ 176 (+1000%)
Mutual labels:  graph-algorithms
Mug
A small Java 8 util library, complementary to Guava (BiStream, Substring, MoreStreams, Parallelizer).
Stars: ✭ 236 (+1375%)
Mutual labels:  graph-algorithms
Classiccomputerscienceproblemsinswift
Source Code for the Book Classic Computer Science Problems in Swift
Stars: ✭ 142 (+787.5%)
Mutual labels:  graph-algorithms
spotify-song-recommender
A Spotify song recommendation engine built with the power of graph analytics.
Stars: ✭ 34 (+112.5%)
Mutual labels:  graph-algorithms
Sparkling Graph
SparklingGraph provides easy to use set of features that will give you ability to proces large scala graphs using Spark and GraphX.
Stars: ✭ 139 (+768.75%)
Mutual labels:  graph-algorithms
Yfiles For Html Demos
Contains demo sources for the JavaScript diagramming library yFiles for HTML
Stars: ✭ 202 (+1162.5%)
Mutual labels:  graph-algorithms
RioGNN
Reinforced Neighborhood Selection Guided Multi-Relational Graph Neural Networks
Stars: ✭ 46 (+187.5%)
Mutual labels:  graph-algorithms
nodegraph
NodeGraph - A simple directed graph with visualization UI.
Stars: ✭ 21 (+31.25%)
Mutual labels:  graph-algorithms
Link Prediction
Representation learning for link prediction within social networks
Stars: ✭ 245 (+1431.25%)
Mutual labels:  graph-algorithms

Edmonds's blossom algorithm for maximum weight matching in undirected graphs

This library implements the Blossom algorithm that computes a maximum weighted matching of an undirected graph in O(number of nodes ** 3).

It was ported from the python code authored by Joris van Rantwijk included in the NetworkX graph library and modified.

Getting started

Add the necessary dependencies to your project:

[ageneau/blossom "0.1.4"]
[aysylu/loom "1.0.2"]

Usage

(ns test.blossom
  (:require [blossom.max-weight-matching :as mwm]
            [blossom.matching :as m]
            [loom.graph :as lg]))
 
(def edges [[1 2 2][1 3 -2][2 3 1][2 4 -1][3 4 -6]])
(def g (-> (lg/weighted-graph) (lg/add-edges* edges)))

;; Compute a maximum weigted matching
(def maxw-matching (mwm/max-weight-matching edges))
;; => #{#{1 2}}

;; Compute the maximum-cardinality matching with maximum weight among all
;; maximum-cardinality matchings.
(def maxc-matching (mwm/max-weight-matching edges {:max-cardinality true}))
;; => #{#{4 2} #{1 3}}

;; Compute a maximal matching (not necessarily max weight)
(def max-matching (m/maximal-matching g))
;; => #{#{4 3} #{1 2}}

(m/is-matching? g maxw-matching)
;; => true

(m/is-maximal-matching? g maxw-matching)
;; => false

(m/is-maximal-matching? g maxc-matching)
;; => true

(m/is-maximal-matching? g max-matching)
;; => true

Unit tests

Some unit tests are auto-generated by instrumenting the python code which this project is based on running the python unit tests and outputting internal data to JSON which is then compared to the equivalent Clojure data structures.

The JSON data for these unit tests can be generated doing:

make -C python

To run the Clojure unit tests:

lein do clean, test

To run the Clojurescript unit tests:

lein do clean, doo node node-test once

License

Copyright © NetworkX developers. Copyright (C) 2004-2018 by Aric Hagberg [email protected] Dan Schult [email protected] Pieter Swart [email protected]

Copyright © 2008 by Joris van Rantwijk.

Copyright © 2011 by Nicholas Mancuso [email protected]

Copyright © 2018 Sylvain Ageneau

All rights reserved.

This project is licensed under the BSD 3-Clause "New" or "Revised" License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].