This project implements a graph generator inspired by the DictionaryLookup Benchmark from "How Attentive are Graph Neural Networks".
The problem is described as follows:
-
A bi-partite graph,
G, is provided, with nodes split into two setsTOP,BOT. -
The set
TOPis a subset ofKeys. -
The set
BOTis a bijectionKeys -> Valuesrepresented as a subset ofKeys x Values.
- For example if
("A", 1)is inBOTthen no other element can have"A"for a key or1as a value.
- 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
p1is aProblemobject with three relevant attributes:adj: Adjacency matrix (it's block anti-diagonal).nodes: Array of node features (see below).answers: What value theith 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)
| File | Size | Uploaded | |
|---|---|---|---|
| dict_lookup_mpnn_problem-0.1.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|