Skip to content

Commit

Permalink
Include and wrap Glasgow Subgraph Solver (#221)
Browse files Browse the repository at this point in the history
Add subgraph package to find subgraph isomorphisms (a.k.a. native embeddings)
  * added portable-snippets submodule
  * added glasgow subgraph solver submodule (temporarily using @boothby's fork)
  * added fake boost library
  * added note about submodules in python installation instructions
  • Loading branch information
boothby authored Jan 23, 2023
1 parent 76d7b45 commit 72c4d15
Show file tree
Hide file tree
Showing 20 changed files with 765 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ jobs:

steps:
- checkout
- run: &initialize-submodules
name: get submodules
command: |
git submodule init
git submodule update
- setup_remote_docker
- run-cibuildwheel

Expand All @@ -167,6 +172,7 @@ jobs:

steps:
- checkout
- run: *initialize-submodules
- run-cibuildwheel

build-and-test-osx:
Expand All @@ -186,6 +192,7 @@ jobs:

steps:
- checkout
- run: *initialize-submodules
- run-cibuildwheel

build-and-test-windows:
Expand All @@ -203,6 +210,7 @@ jobs:

steps:
- checkout
- run: *initialize-submodules
- run-cibuildwheel

deploy-all:
Expand Down Expand Up @@ -230,6 +238,7 @@ jobs:

steps:
- checkout
- run: *initialize-submodules
- run:
name: build sdist
command: |
Expand All @@ -247,6 +256,7 @@ jobs:

steps:
- checkout
- run: *initialize-submodules
- attach_workspace:
at: dist
- run:
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "external/portable-snippets"]
path = external/portable-snippets
url = [email protected]:nemequ/portable-snippets.git
[submodule "external/glasgow-subgraph-solver"]
path = external/glasgow-subgraph-solver
url = [email protected]:boothby/glasgow-subgraph-solver.git
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
global-include *.hpp
include rectangle-packer/*/*
recursive-include external/glasgow-subgraph-solver *.hh LICENSE
recursive-include external/portable-snippets builtin.h COPYING.md
recursive-include external/boost BOOST_LICENSE
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ pypi. Source distributions are provided as well.
pip install minorminer
To install from this repository, run the `setuptools` script.
To install from this repository, you will need to first fetch the submodules

git submodule init
git submodule update

and then run the `setuptools` script.

.. code-block:: bash
pip install -r requirements.txt
python setup.py install
# optionally, run the tests to check your build
Expand Down
23 changes: 23 additions & 0 deletions external/boost/BOOST_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
44 changes: 44 additions & 0 deletions external/boost/bimap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

#include <boost/bimap/unordered_set_of.hpp>
#include <unordered_map>
#include <tuple>

namespace boost {

template<typename L, typename R, typename Alloc>
class bimap;

template<typename L, typename R, typename Alloc>
class bimap<boost::bimaps::unordered_set_of<L>, boost::bimaps::unordered_set_of<R>, Alloc> {
public:
std::unordered_map<L, R> left;
std::unordered_map<R, L> right;
typedef typename std::pair<L, R> value_type;

void insert(const value_type v) {
left.insert(std::make_pair(v.first, v.second));
right.insert(std::make_pair(v.second, v.first));
}

bimap() {}
};

}
27 changes: 27 additions & 0 deletions external/boost/bimap/unordered_set_of.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

namespace boost::bimaps {

template<typename T>
class unordered_set_of {
typedef T value_type;
};

}
25 changes: 25 additions & 0 deletions external/boost/container/allocator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

namespace boost::container {

template<typename T> class allocator {};

}

33 changes: 33 additions & 0 deletions external/boost/functional/hash.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

namespace boost {

template <typename T>
inline void hash_combine(std::size_t & seed, const T value) {
std::hash<T> h;
hash_combine(seed, h(value));
}

template <>
inline void hash_combine(std::size_t & seed, const std::size_t value) {
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}

}
32 changes: 32 additions & 0 deletions external/boost/iostreams/device/file.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

#include <fstream>
#include <iostream>
#include <string>

namespace boost::iostreams {

std::ofstream file_sink(const std::string &fn) {
std::ofstream outfile;
outfile.open(fn);
return outfile;
}

}
29 changes: 29 additions & 0 deletions external/boost/iostreams/filter/bzip2.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

#include <stdexcept>

namespace boost::iostreams {

bool bzip2_compressor() {
throw std::runtime_error("filtering_ostream is not implemented");
return false;
}

}
36 changes: 36 additions & 0 deletions external/boost/iostreams/filtering_stream.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

#include <iostream>
#include <streambuf>
namespace boost::iostreams {

class filtering_ostream: public std::basic_ostream<char> {
class fake_streambuf: public std::basic_streambuf<char> {
public:
fake_streambuf() : std::basic_streambuf<char>() {}
};
fake_streambuf sb;
public:
filtering_ostream() : sb(), basic_ostream(&sb) {}
template<typename T>
void push(T) { throw std::runtime_error("filtering_ostream is not implemented"); }
};

}
18 changes: 18 additions & 0 deletions external/boost/iostreams/stream.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once
24 changes: 24 additions & 0 deletions external/boost/multiprecision/cpp_int.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2022-2023 D-Wave Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Excerpted from and/or inspired by implementations found in the Boost Library
// see external/boost/BOOST_LICENSE or https://www.boost.org/LICENSE_1_0.txt

#pragma once

namespace boost::multiprecision {

typedef long long int cpp_int;

}
Loading

0 comments on commit 72c4d15

Please sign in to comment.