erdos / README.md
vstenby's picture
Upload README.md with huggingface_hub
e8669ce verified
---
license: mit
task_categories:
- graph-ml
language:
- en
tags:
- graphs
- synthetic
- benchmark
size_categories:
- 10K<n<100K
---
# Erdős Graph Dataset with Task Labels
A graph dataset derived from [PKU-ML/Erdos](https://huggingface.co/datasets/PKU-ML/Erdos),
containing undirected graphs with pre-computed answers for 9 graph reasoning tasks.
This dataset follows the same format as [vstenby/random-graphs](https://huggingface.co/datasets/vstenby/random-graphs).
## Dataset Description
This dataset contains graphs from the PKU-ML/Erdos benchmark, filtered to include only
undirected graphs. Each graph has been processed to:
- Convert edges to 0-indexed (for PyTorch Geometric compatibility)
- Add pre-computed task columns matching the random-graphs format
## Dataset Structure
### Data Fields
| Field | Type | Description |
|-------|------|-------------|
| algorithm | string | Always "erdos" |
| edge_list | string | Edge list in format [(u, v), (x, y), ...] |
#### Task Columns
| Task | Columns | Description |
|------|---------|-------------|
| node_count | node_count (int) | Number of nodes in the graph |
| edge_count | edge_count (int) | Number of edges in the graph |
| node_degree | node_degree_node (int), node_degree (int) | Sampled node and its degree |
| edge_existence | edge_existence_src (int), edge_existence_dst (int), edge_existence (bool) | Two sampled nodes and whether an edge exists between them |
| cycle_check | cycle_check (bool) | Whether the graph contains a cycle |
| triangle_counting | triangle_count (int) | Number of triangles in the graph |
| connected_nodes | connected_nodes_node (int), connected_nodes (string) | Sampled node and comma-separated list of its neighbors |
| reachability | reachability_src (int), reachability_dst (int), reachability (bool) | Two sampled nodes and whether a path exists between them |
| shortest_path | shortest_path_src (int), shortest_path_dst (int), shortest_path (int) | Two sampled nodes and shortest path length (-1 if no path exists) |
### Data Splits
| Split | Examples |
|-------|----------|
| train | ~82,000 |
| test | ~4,000 |
## Usage
```python
from datasets import load_dataset
dataset = load_dataset("vstenby/erdos")
# Access a sample
sample = dataset["train"][0]
print(f"Algorithm: {sample['algorithm']}")
print(f"Node count: {sample['node_count']}")
print(f"Edge count: {sample['edge_count']}")
print(f"Has cycle: {sample['cycle_check']}")
print(f"Triangle count: {sample['triangle_count']}")
# Node-specific tasks
print(f"Node {sample['node_degree_node']} has degree {sample['node_degree']}")
print(f"Node {sample['connected_nodes_node']} is connected to: {sample['connected_nodes']}")
# Edge/path tasks
print(f"Edge between {sample['edge_existence_src']} and {sample['edge_existence_dst']}: {sample['edge_existence']}")
print(f"Path from {sample['reachability_src']} to {sample['reachability_dst']}: {sample['reachability']}")
print(f"Shortest path from {sample['shortest_path_src']} to {sample['shortest_path_dst']}: {sample['shortest_path']}")
```
## Generation Details
- **Source**: [PKU-ML/Erdos](https://huggingface.co/datasets/PKU-ML/Erdos)
- **Filtering**: Only undirected graphs included; isomorphic_mapping task excluded
- **Random seed**: 42 (train), 44 (test) for reproducible node/edge sampling
- **Edge indexing**: Converted from 1-indexed to 0-indexed
## License
MIT License