File size: 4,441 Bytes
4d43114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b016c0
4d43114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b016c0
 
 
 
 
 
4d43114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
license: cc-by-nc-sa-4.0
task_categories:
  - graph-ml
tags:
  - histopathology
  - graph-classification
  - breast-cancer
  - pytorch-geometric
pretty_name: Graph-BreakHis
size_categories:
  - n<1K
---

# Graph-BreakHis: A Cell-Graph Dataset for Breast Cancer from BreakHis

<p align="center">
  <img src="animation.gif" alt="Graph-BreakHis teaser – cell-graph construction from a histopathology image" width="600"/>
</p>

**Graph-BreakHis** is a graph-level classification dataset derived from the [BreakHis (Breast Cancer Histopathological Image Classification)](https://web.inf.ufpr.br/vri/databases/breast-cancer-histopathological-database-breakhis/) dataset. Each microscopy image is converted into a **cell-graph** where nodes represent detected cell nuclei and edges encode spatial proximity, enabling graph-based binary classification of benign vs. malignant breast tumours. Note that node features describe cell morphology, texture, and color intensity whereas edge features are Euclidean distance in micrometers.


This dataset is part of the paper [GrapHist: Graph Self-Supervised Learning for Histopathology](https://arxiv.org/pdf/2603.00143).

> ⚠️ **Edge Weight Note**: While the architecture in GrapHist supports both positive and negative edge weights, by default edge features represent Euclidean distances—meaning farther nodes have larger, positive values. This can be counterintuitive for many graph neural network models. We recommend experimenting with edge weights, such as using their inverse (e.g., `1/distance`) or negative distance (e.g., `-distance`), to better capture proximity and benefit learning.

## Dataset Summary

| Property | Value |
|---|---|
| **Total graphs** | 522 |
| **Classes** | 2 |
| **Train / Test split** | 417 / 105 |
| **Node feature dim** | 96 |
| **Edge feature dim** | 1 |

## Classes

| Label | Full Name | Count |
|---|---|---|
| `B` | Benign | 233 |
| `M` | Malignant | 289 |

## Data Structure

```
graph-breakhis/
├── README.md
├── metadata.csv                                  # sample_id, label, split, graph_path
├── animation.gif                                 
└── data/
    ├── SOB_B_A-14-22549AB-40-001.pt
    ├── SOB_M_DC-14-12312-40-012.pt
    └── ...                                       
```

Each `.pt` file is a PyTorch Geometric `Data` object with the following attributes:

| Attribute | Shape | Description |
|---|---|---|
| `x` | `[num_nodes, 96]` | Node feature matrix |
| `edge_index` | `[2, num_edges]` | Graph connectivity in COO format |
| `edge_attr` | `[num_edges, 1]` | Edge features |
| `label` | `str` | Class label |
| `sample_id` | `str` | Unique sample identifier |

### `metadata.csv`

A CSV file mapping each sample to its label, train/test split, and file path:

```
sample_id,label,split,graph_path
SOB_B_A-14-22549AB-40-001,B,train,graph-breakhis/data/SOB_B_A-14-22549AB-40-001.pt
SOB_B_A-14-22549AB-40-006,B,train,graph-breakhis/data/SOB_B_A-14-22549AB-40-006.pt
...
```

---

## Quick Start

```python
import torch
from torch_geometric.data import Data

# Load a single graph
graph = torch.load("data/SOB_B_A-14-22549AB-40-001.pt", weights_only=False)

print(graph)
# Data(x=[26, 96], edge_index=[2, 61], edge_attr=[61, 1], label='B', sample_id='SOB_B_A-14-22549AB-40-001')

print(f"Nodes: {graph.x.shape[0]}, Edges: {graph.edge_index.shape[1]}")
```

---

## Citation

If you use this dataset, please cite both our work, and the original BreakHis dataset:

**GrapHist (this dataset):**
```bibtex
@misc{ogut2026graphist,
    title={GrapHist: Graph Self-Supervised Learning for Histopathology}, 
    author={Sevda Öğüt and Cédric Vincent-Cuaz and Natalia Dubljevic and Carlos Hurtado and Vaishnavi Subramanian and Pascal Frossard and Dorina Thanou},
    year={2026},
    eprint={2603.00143},
    url={https://arxiv.org/abs/2603.00143}, 
}
```

**BreakHis (source images):**
```bibtex
@article{spanhol2015dataset,
  title={A dataset for breast cancer histopathological image classification},
  author={Spanhol, Fabio A and Oliveira, Luiz S and Petitjean, Caroline and Heutte, Laurent},
  journal   = {IEEE Transactions on Biomedical Engineering},
  volume    = {63},
  number    = {7},
  pages     = {1455--1462},
  year={2015},
  publisher={IEEE}
}
```

---

## License

This dataset is released under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.