Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    TypeError
Message:      int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1531, in _prepare_split_single
                  for key, record in generator:
                                     ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 613, in wrapped
                  for item in generator(*args, **kwargs):
                              ~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/webdataset/webdataset.py", line 127, in _generate_examples
                  for example_idx, example in enumerate(self._get_pipeline_from_tar(tar_path, tar_iterator)):
                                              ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/webdataset/webdataset.py", line 32, in _get_pipeline_from_tar
                  for filename, f in tar_iterator:
                                     ^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/track.py", line 49, in __iter__
                  for x in self.generator(*self.args):
                           ~~~~~~~~~~~~~~^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/file_utils.py", line 1405, in _iter_from_urlpath
                  with xopen(urlpath, "rb", download_config=download_config, block_size=0) as f:
                       ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/utils/file_utils.py", line 982, in xopen
                  file_obj = fs.open(paths[0], mode)
                File "<string>", line 3, in open
                File "/usr/local/lib/python3.14/unittest/mock.py", line 1176, in __call__
                  return self._mock_call(*args, **kwargs)
                         ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/unittest/mock.py", line 1180, in _mock_call
                  return self._execute_mock_call(*args, **kwargs)
                         ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/unittest/mock.py", line 1247, in _execute_mock_call
                  result = effect(*args, **kwargs)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 786, in wrapped
                  tracker.files[urlpath] = {"read": 0, "size": int(f.size)}
                                                               ~~~^^^^^^^^
              TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1393, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1571, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

pt
unknown
__key__
string
__url__
string
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAAkAD4Ac3BhcnNlX3N0b2NoYXN0aWNfYmVuY2htYXJrL2RhdGEucGtsRkI6AFpaWlp(...TRUNCATED)
./stochastic_evaluation/sparse_stochastic_benchmark
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfNDExMi9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_4112
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMTY2OC9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_1668
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMjQ1My9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_2453
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMTYyNS9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_1625
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMjAyOS9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_2029
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfNDAyOC9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_4028
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMDE1Mi9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_0152
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfMDc2Mi9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_0762
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
"UEsDBAAACAgAAAAAAAAAAAAAAAAAAAAAAAATAA8AZ3JhcGhfNDEwNi9kYXRhLnBrbEZCCwBaWlpaWlpaWlpaWoACKGN0b3JjaC5(...TRUNCATED)
./metric_dimension_dataset_v2/graph_4106
"hf://datasets/muradulislam/Exact-NP-Hard-Graphs-5500@1eb3ce2f76b66002734d52c4f2ad138fac1f5bb3/metri(...TRUNCATED)
End of preview.

license: mit task_categories: - graph-machine-learning - combinatorial-optimization - node-classification tags: - graph-neural-networks - np-hard - metric-dimension - vertex-cover - maximum-clique - independent-set - dominating-set - gurobi - integer-linear-programming size_categories: - 1K<n<10K

Exact-NP-Hard-Graphs-5500: A Multi-Task Combinatorial Benchmark

πŸ“– Dataset Overview

This dataset provides a mathematically exact, rigorously verifiable combinatorial benchmark for Neural Combinatorial Optimization (NCO) and Graph Neural Networks (GNNs). Computing dense graph invariants such as the Metric Dimension, Vertex Cover, or Maximum Clique is strictly NP-hard. Due to $O(2^{\vert{}V\vert{}})$ combinatorial explosion, mathematically exact multi-task datasets for arbitrary non-canonical graphs are exceedingly rare.

This repository contains 5,500 connected graphs uniquely solved to absolute mathematical optimality using the Gurobi Integer Linear Programming (ILP) solver. It serves as the official training and evaluation environment for the ResolvNet architecture.

The dataset is packaged in a single metric_dimension_dataset.tar.gz archive, containing:

  1. Training & Adversarial Data: 5,500 graphs ($10 \le \vert{}V\vert{} \le 70$), spanning 19 topological families, packed into PyTorch batch files (batch_0001.pt to batch_0110.pt).
  2. Massive Stochastic Benchmark: 40 massive out-of-distribution graphs ($250 \le \vert{}V\vert{} \le 500$) located in stochastic_evaluation/sparse_stochastic_benchmark.pt for zero-shot asymptotic scaling tests.

πŸ“¦ Data Structure and Payload Schema

Each graph in the dataset is stored as a highly detailed tuple containing localized features, distance matrices, multi-task binary masks, and topological invariants.

Payload Elements

  • X (torch.Tensor, float32): Node feature matrix [N, 3]. Size-invariant localized metrics:
    1. Normalized Degree: degree / max(1, N - 1)
    2. Local Clustering Coefficient $\in [0, 1]$
    3. Normalized Coreness (Degeneracy): core_number / max(1, N - 1)
  • D (torch.Tensor, int64): The exact dense shortest-path distance matrix of shape [N, N].
  • y (torch.Tensor or Dict): The exact node-level binary masks [N] corresponding to the exact mathematical basis/subset for five NP-hard problems:
    • Metric Dimension
    • Vertex Cover
    • Maximum Clique
    • Maximum Independent Set
    • Minimum Dominating Set (Values of 1.0 indicate the node belongs to the optimal solution set).
  • G (networkx.Graph): The raw, unadulterated NetworkX graph object.
  • invariants (dict): A comprehensive dictionary containing ~25 scalar metrics characterizing the graph's macro and micro-topology.

The invariants Dictionary (Detailed Keys)

Every graph is accompanied by pre-computed $O(N^3)$ classical invariants to facilitate immediate topological analysis:

  1. NP-Hard Scalars: metric_dimension, domination_number, independence_number, clique_number, vertex_cover_number.
  2. Distance & Path Metrics: diameter, radius, wiener_index (sum of all shortest paths), avg_path_length.
  3. Spectral Metrics: algebraic_connectivity (2nd smallest eigenvalue of the normalized Laplacian), spectral_radius (largest eigenvalue of the adjacency matrix), graph_energy (sum of absolute adjacency eigenvalues).
  4. Density & Clustering: density, transitivity, global_clustering, triangles (total network triangle count).
  5. Degree Metrics: max_degree, min_degree, avg_degree, degree_assortativity (Pearson correlation of connected node degrees).
  6. Centrality & Coreness: degeneracy (max core number), betweenness_max, betweenness_mean.
  7. Matching: matching_number (size of maximum weight matching).
  8. Metadata: topology_family (The exact generation algorithm used).

🧬 Generation Parameters and Topological Distributions

To prevent neural networks from overfitting to specific local structural signatures, the dataset was generated using a diverse mixture of 19 distinct topologies. Disconnected graphs were strictly pruned to their largest connected component.

1. Canonical Families (~10% of dataset)

  • path, cycle, complete, star, wheel, ladder, circular_ladder: Standard deterministic generation up to size $N$.
  • fan: A path graph of size $N-1$ fully connected to a single central hub vertex.
  • grid_2d: Generated using the nearest integer factorization of $N$ ($d_1 \times d_2$), such that $d_1 = \lfloor\sqrt{N}\rfloor$ adjusted downward to the nearest factor.
  • complete_bipartite: Two partitions where $N_1 \sim \mathcal{U}(1, N-1)$ and $N_2 = N - N_1$.

2. Stochastic Families (~80% of dataset)

  • erdos (ErdΕ‘s-RΓ©nyi): Random edges with probability $p \sim \mathcal{U}(0.08, 0.20)$.
  • barabasi (BarabΓ‘si-Albert): Scale-free network grown via preferential attachment with $m$ edges per new node, where $m \sim \mathcal{U}(1, \min(5, N))$.
  • watts (Watts-Strogatz): Small-world ring topology with $k$ nearest neighbors and rewiring probability $p$. $k \sim \mathcal{U}(2, 8)$ (forced to an even integer), and $p \sim \mathcal{U}(0.10, 0.25)$.
  • geometric (Random Geometric): Nodes dropped in a 2D unit cube, connected if distance $\le$ radius, where radius $\sim \mathcal{U}(0.20, 0.45)$.
  • random_tree: Uniformly distributed labeled trees.
  • stochastic_block (SBM): Communities with dense internal edges and sparse external edges. Blocks $k \sim \mathcal{U}(2, 5)$, $p_{in} \sim \mathcal{U}(0.3, 0.4)$, $p_{out} \sim \mathcal{U}(0.02, 0.10)$.
  • random_bipartite: Two partitions with $N_1 \sim \mathcal{U}(N/4, 3N/4)$, edge probability $p \sim \mathcal{U}(0.15, 0.50)$.

3. Adversarial Families (~10% of dataset)

Included specifically to challenge the spatial symmetry-breaking capabilities of Message Passing Neural Networks (MPNNs).

  • random_regular: Graphs where every node has strictly identical degree $d \in {3, 4, 5}$.
  • powerlaw_cluster: Holme and Kim algorithm for scale-free graphs with tunable clustering. $m \sim \mathcal{U}(1, 5)$ random edges per new node, with triangle formation probability $p \sim \mathcal{U}(0.10, 0.40)$.
  • caveman (Connected Caveman): Dense cliques connected in a sparse cycle. Number of cliques $l \sim \mathcal{U}(2, \max(3, N/5))$, clique size $k = \max(2, N/l)$.

βš™οΈ Exact Optimization Constraints (Gurobi ILP)

All NP-hard ground truths (masks and scalars) were established by formulating the invariants as Integer Linear Programming (ILP) problems.

  • Solver Engine: Gurobi Optimizer v11+.
  • Time Limit: A strict computational timeout of 120.0 seconds was enforced per invariant problem.
  • Global Optimality Guarantee: If Gurobi failed to prove the absolute global optimum (i.e., model.Status != GRB.OPTIMAL) within the time limit for any of the 5 invariants, the graph was completely discarded.
  • Rejection Rate: Throughout generation, the dataset maintained an approximate 8% rejection rate (graphs abandoned due to timeout). This threshold was intentionally calibrated to guarantee mathematical perfection while ensuring the dataset is not disproportionately skewed toward computationally trivial geometries.

πŸš€ How to Use the Dataset

Extract the archive and load the PyTorch batches directly.

import tarfile
import torch

# Extract the archive
with tarfile.open("metric_dimension_dataset.tar.gz", "r:gz") as tar:
    tar.extractall("dataset/")

# Load a training batch
batch_data = torch.load("dataset/batch_0001.pt", map_location="cpu", weights_only=False)

# Inspect the first graph payload
X, D, y_masks, invariants, G = batch_data[0]

print(f"Topology: {invariants['topology_family']}")
print(f"Nodes: {G.number_of_nodes()}, Edges: {G.number_of_edges()}")
print(f"Exact Metric Dimension (Scalar): {invariants['metric_dimension']}")
print(f"Graph Energy: {invariants['graph_energy']:.3f}")
Downloads last month
13