Skip to main content

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)

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.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for dict_lookup_mpnn_problem-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e25d65edd768341afc70b029d33ae8f422d4d5418618f445b28cfa3ed2cea10e
MD5 9ee122756274c30f6294f0000eba819f
BLAKE2b-256 cdf7f0777cef1af5fd05ea4abe687e6aff801f90a625316425626df2f81023dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82cd2cad09993ff0a55020934f6d984dc866474e60bef3f07526ee0e2efbcdf8
MD5 0b25456453bebac6f426d470478a47d3
BLAKE2b-256 2574435c9883a574e1685b6fa3b0a2511bffe15cecf08b7232aa2caa54d9b810

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page