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)

Metadata

Release files for dict-lookup-mpnn-problem 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dict-lookup-mpnn-problem 0.1.1
File Size Uploaded
dict_lookup_mpnn_problem-0.1.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dict-lookup-mpnn-problem 0.1.1
File Interpreter ABI Platform
dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / dict_lookup_mpnn_problem-0.1.1.tar.gz

Download URL dict_lookup_mpnn_problem-0.1.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e25d65edd768341afc70b029d33ae8f422d4d5418618f445b28cfa3ed2cea10e
BLAKE2b-256 checksum
How to use checksums
cdf7f0777cef1af5fd05ea4abe687e6aff801f90a625316425626df2f81023dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl

Download URL dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82cd2cad09993ff0a55020934f6d984dc866474e60bef3f07526ee0e2efbcdf8
BLAKE2b-256 checksum
How to use checksums
2574435c9883a574e1685b6fa3b0a2511bffe15cecf08b7232aa2caa54d9b810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page