Skip to main content

Add your description here

Project description

This project implements a graph generator inspired by the DictionaryLookup Benchmark from "How Attentive are Graph Neural Networks".

Problem Image

The problem is described as follows:

  1. A bi-partite graph, G, is provided, with nodes split into two sets TOP, BOT.

  2. The set TOP is a subset of Keys.

  3. The set BOT is a bijection Keys -> Values represented as a subset of Keys x Values.

  • For example if ("A", 1) is in BOT then no other element can have "A" for a key or 1 as a value.
  1. The goal is to map each key in TOP to the approriate value via BOT(key).

The encoding provided by this repo is to take: Key = 1..n_keys and Values = 1..n_vals for some integers, n_vals and n_vals. The primary interface to this code is the gen_problems function which takes these in along with a random seed and provides an infinite sequence of dictionary lookup problems.

from dict_lookup_mpnn_problem import gen_problems

problems = gen_problems(n_keys=2, n_vals=3, seed=12)
p1 = next(problems)
  • Here p1 is a Problem object with three relevant attributes:
    1. adj: Adjacency matrix (it's block anti-diagonal).
    2. nodes: Array of node features (see below).
    3. answers: What value the ith node should decode to.
  • The feature encoding is the 1-hot encoding of the key concatenated with the 1-hot encoding of the value. If no value is present, the all zeros vector is used.

An example output for n_keys=2 and n_vals=3 is provided below.

Problem(nodes=array([[1., 0., 0., 0., 0.],
                     [0., 1., 0., 0., 0.],
                     [1., 0., 1., 0., 0.],
                     [0., 1., 0., 0., 1.]]),
        adj=array([[0., 0., 1., 1.], 
                   [0., 0., 1., 1.],
                   [1., 1., 0., 0.],
                   [1., 1., 0., 0.]]),
        answers=array([0, 2]),
        n_keys=2)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dict_lookup_mpnn_problem-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

dict_lookup_mpnn_problem-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file dict_lookup_mpnn_problem-0.1.0.tar.gz.

File metadata

File hashes

Hashes for dict_lookup_mpnn_problem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a5b0d4edfa3161bf39a25b9599a8720302ea931e83c8c4fe05979d35fc5c257a
MD5 1147bdeabfc86653acaf1e3358ace929
BLAKE2b-256 5c64c54838c584c5e62f2ff7f07ea6e7ebb7a7efac0830f8e27a9edb4994f054

See more details on using hashes here.

File details

Details for the file dict_lookup_mpnn_problem-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dict_lookup_mpnn_problem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0df165a143bd874048f9247a6107524493820ccfda0aa76e670b1511a7edc57
MD5 7bf20a922f81379b8216f9fc37c57133
BLAKE2b-256 3bbffe94f108284e3868d4b19471bd894322418d4a4e3beb051aa080ca42da5f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page