jugalgajjar commited on
Commit
e0ba65e
·
verified ·
1 Parent(s): 7c191d2

Add files using upload-large-folder tool

Browse files
100k/edges.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0740c670efa3f11a642629e0ac3c85ac3204cde972e49c2752babc731db4d1a
3
+ size 9119596
100k/nodes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dacfcc78d920f57fc696ac640d46376efff1adccbc70e14bd5ed1759ba8f87af
3
+ size 7303881
10k/edges.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:784dc14d8438bce445dd9781685d3f3ad778f71db21622238e12644e583154b2
3
+ size 1037355
10k/nodes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0f08f89ad8bbef42db0da6be232a952b0a94d688d782c22b7d2ce8ebfae05d8
3
+ size 1015153
10m/edges.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43bd01d1c20cf899e6aff953521b6ae73065e8b91e25b69e0bb40b56396835e2
3
+ size 221497372
10m/nodes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d315f599af10a4bf165275b5c8fd6859ca21bccedb9177a5f9d22a0c12f7570
3
+ size 180847994
1k/edges.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03617d08c52ed81014ed3f447270fdc6e883d7dacf114ca8331a23a5546a1c26
3
+ size 152977
1k/nodes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f6a8ea5ebbc68ab15e888ce9231a3f06cee0b253292b2f84a31703d6bedb88e
3
+ size 130638
1m/edges.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c7d7f0c82b07fee2fffbe15149bd4c10efb1b56bd0c8adf53583a5b52504db4
3
+ size 66819646
1m/nodes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fc41907d277f025595ffcab9f139645e5f272130153a20e6cc113df31758b3b
3
+ size 54733023
README.md CHANGED
@@ -1,3 +1,231 @@
1
- ---
2
- license: cc-by-sa-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ language:
4
+ - en
5
+ pretty_name: CS Knowledge Graph (OpenAlex)
6
+ size_categories:
7
+ - 10M<n<100M
8
+ task_categories:
9
+ - graph-ml
10
+ - feature-extraction
11
+ tags:
12
+ - knowledge-graph
13
+ - openalex
14
+ - computer-science
15
+ - bibliographic
16
+ - citation-network
17
+ - co-authorship
18
+ - scholarly
19
+ - link-prediction
20
+ - node-classification
21
+ configs:
22
+ - config_name: 1k
23
+ data_files:
24
+ - split: nodes
25
+ path: 1k/nodes.parquet
26
+ - split: edges
27
+ path: 1k/edges.parquet
28
+ - config_name: 10k
29
+ data_files:
30
+ - split: nodes
31
+ path: 10k/nodes.parquet
32
+ - split: edges
33
+ path: 10k/edges.parquet
34
+ - config_name: 100k
35
+ data_files:
36
+ - split: nodes
37
+ path: 100k/nodes.parquet
38
+ - split: edges
39
+ path: 100k/edges.parquet
40
+ - config_name: 1m
41
+ data_files:
42
+ - split: nodes
43
+ path: 1m/nodes.parquet
44
+ - split: edges
45
+ path: 1m/edges.parquet
46
+ - config_name: 10m
47
+ data_files:
48
+ - split: nodes
49
+ path: 10m/nodes.parquet
50
+ - split: edges
51
+ path: 10m/edges.parquet
52
+ ---
53
+
54
+ # CS Knowledge Graph Dataset (OpenAlex)
55
+
56
+ A multi-scale heterogeneous knowledge graph of Computer Science scholarly data,
57
+ built from [OpenAlex](https://openalex.org). Each scale is an independent,
58
+ self-contained subgraph centered on Computer Science papers, their authors,
59
+ publication venues, and concept tags, plus the relationships between them.
60
+
61
+ The dataset is intended for research on knowledge graph embeddings, link
62
+ prediction, node classification, scholarly recommendation, and graph neural
63
+ networks at varying scales of compute.
64
+
65
+ ## Scales
66
+
67
+ Five scales are provided so the same pipeline can be benchmarked from quick
68
+ prototyping (1k) to large-scale training (10m). Each scale is a strict superset
69
+ of the smaller ones in spirit, but is sampled independently — treat them as
70
+ five separate graphs rather than nested cuts.
71
+
72
+ | Config | Nodes | Edges | Parquet size | Raw SQLite (zip) |
73
+ |--------|-----------:|------------:|-------------:|-----------------:|
74
+ | `1k` | 5,237 | 32,655 | 277 KB | 961 KB |
75
+ | `10k` | 44,933 | 252,631 | 2.0 MB | 7.7 MB |
76
+ | `100k` | 348,983 | 2,162,386 | 16 MB | 68 MB |
77
+ | `1m` | 2,384,896 | 13,530,177 | 117 MB | 597 MB |
78
+ | `10m` | 7,210,506 | 44,631,484 | 384 MB | 2.1 GB |
79
+
80
+ ## Schema
81
+
82
+ Each config has two splits, named `nodes` and `edges` (rather than the usual
83
+ train/test/validation, since this is a graph dataset).
84
+
85
+ ### `nodes` split
86
+
87
+ | Column | Type | Description |
88
+ |--------------|--------|-----------------------------------------------------------------------|
89
+ | `node_id` | string | Unique node identifier, prefixed by type (e.g. `paper_W2604738573`). |
90
+ | `node_name` | string | Human-readable name (paper title, author display name, venue, etc.). |
91
+ | `node_type` | string | One of `Paper`, `Author`, `Venue`, `Concept`. |
92
+ | `attributes` | string | Type-specific attributes encoded as a JSON string (see below). |
93
+
94
+ The `attributes` JSON object has different keys depending on `node_type`:
95
+
96
+ - **Paper**: `year` (int), `citation_count` (int), `venue` (string), `type` (string, e.g. `article`)
97
+ - **Author**: `h_index` (int or null), `citation_count` (int or null), `works_count` (int or null), `institution` (string)
98
+ - **Venue**: `type` (string, e.g. `journal`, `conference`), `publisher` (string)
99
+ - **Concept**: `domain` (string, e.g. `CS`)
100
+
101
+ ### `edges` split
102
+
103
+ | Column | Type | Description |
104
+ |------------|--------|--------------------------------------------------------------------------------------------|
105
+ | `source` | string | `node_id` of the source node. |
106
+ | `relation` | string | One of `AUTHORED`, `CITES`, `PUBLISHED_IN`, `BELONGS_TO`, `COLLABORATES_WITH`. |
107
+ | `target` | string | `node_id` of the target node. |
108
+ | `year` | float | Year associated with the edge when applicable (e.g. publication year); `null` otherwise. |
109
+
110
+ Relation semantics:
111
+
112
+ - `AUTHORED` — `Author → Paper`
113
+ - `CITES` — `Paper → Paper`
114
+ - `PUBLISHED_IN` — `Paper → Venue`
115
+ - `BELONGS_TO` — `Paper → Concept`
116
+ - `COLLABORATES_WITH` — `Author → Author` (co-authorship; symmetric, may appear in both directions)
117
+
118
+ ## Usage
119
+
120
+ ### Load with the `datasets` library
121
+
122
+ ```python
123
+ from datasets import load_dataset
124
+
125
+ # Pick a scale: "1k", "10k", "100k", "1m", or "10m"
126
+ nodes = load_dataset("jugalgajjar/CS-Knowledge-Graph-Dataset", "10k", split="nodes")
127
+ edges = load_dataset("jugalgajjar/CS-Knowledge-Graph-Dataset", "10k", split="edges")
128
+
129
+ print(nodes[0])
130
+ # {'node_id': 'paper_W...', 'node_name': '...', 'node_type': 'Paper',
131
+ # 'attributes': '{"year": 2016, "citation_count": 1816, ...}'}
132
+
133
+ import json
134
+ attrs = json.loads(nodes[0]["attributes"])
135
+ ```
136
+
137
+ ### Load directly with pandas / pyarrow
138
+
139
+ ```python
140
+ import pandas as pd
141
+ nodes = pd.read_parquet("hf://datasets/jugalgajjar/CS-Knowledge-Graph-Dataset/100k/nodes.parquet")
142
+ edges = pd.read_parquet("hf://datasets/jugalgajjar/CS-Knowledge-Graph-Dataset/100k/edges.parquet")
143
+ ```
144
+
145
+ ### Build a PyTorch Geometric graph
146
+
147
+ ```python
148
+ import json
149
+ import torch
150
+ from torch_geometric.data import HeteroData
151
+ from datasets import load_dataset
152
+
153
+ scale = "10k"
154
+ nodes = load_dataset("jugalgajjar/CS-Knowledge-Graph-Dataset", scale, split="nodes").to_pandas()
155
+ edges = load_dataset("jugalgajjar/CS-Knowledge-Graph-Dataset", scale, split="edges").to_pandas()
156
+
157
+ data = HeteroData()
158
+ id_maps = {}
159
+ for ntype, group in nodes.groupby("node_type"):
160
+ ids = group["node_id"].tolist()
161
+ id_maps[ntype] = {nid: i for i, nid in enumerate(ids)}
162
+ data[ntype].num_nodes = len(ids)
163
+
164
+ # infer source/target type from the node_id prefix
165
+ type_from_prefix = {"paper": "Paper", "author": "Author", "venue": "Venue", "concept": "Concept"}
166
+ def ntype_of(nid: str) -> str:
167
+ return type_from_prefix[nid.split("_", 1)[0]]
168
+
169
+ for relation, group in edges.groupby("relation"):
170
+ src_type = ntype_of(group["source"].iloc[0])
171
+ dst_type = ntype_of(group["target"].iloc[0])
172
+ src = group["source"].map(id_maps[src_type]).to_numpy()
173
+ dst = group["target"].map(id_maps[dst_type]).to_numpy()
174
+ data[src_type, relation, dst_type].edge_index = torch.tensor([src, dst], dtype=torch.long)
175
+ ```
176
+
177
+ ## Raw SQLite databases
178
+
179
+ In addition to the Parquet files, the original SQLite databases used to build
180
+ each scale are available under `raw/`:
181
+
182
+ ```
183
+ raw/cs1k_openalex.db.zip
184
+ raw/cs10k_openalex.db.zip
185
+ raw/cs100k_openalex.db.zip
186
+ raw/cs1m_openalex.db.zip
187
+ raw/cs10m_openalex.db.zip
188
+ ```
189
+
190
+ These are useful if you want to run SQL queries over the source records
191
+ directly. Download with `huggingface_hub`:
192
+
193
+ ```python
194
+ from huggingface_hub import hf_hub_download
195
+ path = hf_hub_download(
196
+ repo_id="jugalgajjar/CS-Knowledge-Graph-Dataset",
197
+ repo_type="dataset",
198
+ filename="raw/cs10k_openalex.db.zip",
199
+ )
200
+ ```
201
+
202
+ ## Source and licensing
203
+
204
+ - **Source data:** [OpenAlex](https://openalex.org), released into the public
205
+ domain under [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
206
+ - **This derived dataset:** licensed under
207
+ [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). You may use,
208
+ modify, and redistribute it, including commercially, provided you give
209
+ attribution and license your derivative works under the same terms.
210
+ - Please also cite OpenAlex when using this dataset; see their
211
+ [citation guidance](https://docs.openalex.org).
212
+
213
+ ## Repository layout
214
+
215
+ ```
216
+ .
217
+ ├── README.md
218
+ ├── 1k/
219
+ │ ├── nodes.parquet
220
+ │ └── edges.parquet
221
+ ├── 10k/ (same layout)
222
+ ├── 100k/ (same layout)
223
+ ├── 1m/ (same layout)
224
+ ├── 10m/ (same layout)
225
+ └── raw/
226
+ ├── cs1k_openalex.db.zip
227
+ ├── cs10k_openalex.db.zip
228
+ ├── cs100k_openalex.db.zip
229
+ ├── cs1m_openalex.db.zip
230
+ └── cs10m_openalex.db.zip
231
+ ```
raw/cs100k_openalex.db.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8515539cde1286136adfe7aebf3276fb4bb9b759095a1b90352e382a2ff3362
3
+ size 70912197
raw/cs10k_openalex.db.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d17a2d479cfc7bda5b85b0c6de59c52e31728bbccca94a26170873380d6e9285
3
+ size 8028870
raw/cs10m_openalex.db.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfb809befe708f3d2ad484ad0df7726890ec775b5485620ab21c0cc84576fc2d
3
+ size 2241407116
raw/cs1k_openalex.db.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ec923599cd0f550b2f363d687095b5790c4aeaaac9229950bb54a6af4782cfe
3
+ size 984101
raw/cs1m_openalex.db.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:591753a02f368d0502e379369493982383dab256559f4712d35641dc5075a5d0
3
+ size 626268613