GithubHelp home page GithubHelp logo

timtadh / goiso Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 163 KB

A wrapper around libbliss for graph isomorphism testing and canonical labeling.

License: GNU General Public License v3.0

C++ 84.46% Go 13.41% C 2.05% Makefile 0.08%

goiso's Introduction

goiso - Graph Isomorphism Testing

A wrapper around bliss for graph isomorphism testing and canonical labeling. Bliss is the work Tommi Junttila and Petteri Kaski. You should cite their papers:

  • Tommi Junttila and Petteri Kaski. Engineering an efficient canonical labeling tool for large and sparse graphs. In: Proceedings of the Ninth Workshop on Algorithm Engineering and Experiments (ALENEX07), pages 135-149, SIAM, 2007.

  • Tommi Junttila and Petteri Kaski. Conflict Propagation and Component Recursion for Canonical Labeling. In: Proceedings of the 1st International ICST Conference on Theory and Practice of Algorithms (TAPAS 2011), Springer, 2011

I have made a few modifications to their library mainly in the C interface side so I can interface more easily with Go.

Licensing

All work is licensed under the GPL Version 3. Please respect the license.

Copyright Holders:

  Copyright (c) 2006-2011 Tommi Junttila (C++ Bliss Code)
  Copyright (c) 2014-2016 Tim Henderson (Go Wrapper)

Usage

So far there is just a low level interface on top the C interface to bliss. Eventually, I am hoping to build a more goish interface in the goiso package that lets you extract the canonical labeling. This interface will likely remain the most efficient.

You can read the docs over at godoc: documentation

import

import "github.com/timtadh/goiso/bliss"

api example

bliss.Do(0, func(g1 *Graph) {
	a := g1.AddVertex(1)
	b := g1.AddVertex(1)
	c := g1.AddVertex(2)
	d := g1.AddVertex(2)
	g1.AddEdge(a, b)
	g1.AddEdge(c, d)
	g1.AddEdge(a, c)
	g1.AddEdge(b, d)
	bliss.Do(0, func(g2 *Graph) {
		a := g2.AddVertex(1)
		b := g2.AddVertex(1)
		c := g2.AddVertex(2)
		d := g2.AddVertex(2)
		g2.AddEdge(b, a)
		g2.AddEdge(d, c)
		g2.AddEdge(a, c)
		g2.AddEdge(b, d)
		if g1.Cmp(g2) != -1 {
			t.Error("unexpected compare result")
		}
		if !g1.Iso(g2) {
			t.Error("should have been isomorphic")
		}
	})
})

Or with manual memory management:

g1 := bliss.NewGraph(0)
defer g1.Release()
a := g1.AddVertex(1)
b := g1.AddVertex(1)
c := g1.AddVertex(2)
d := g1.AddVertex(2)
g1.AddEdge(a, b)
g1.AddEdge(c, d)
g1.AddEdge(a, c)
g1.AddEdge(b, d)

// do stuff with g1

goiso's People

Contributors

timtadh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mewbak

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.