logo Netzschleuder network catalog, repository, and centrifuge

History of rcdd_alibaba

The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.

[entries] Add the date when each entry was added, and remove icon_hash by Tiago de Paula Peixoto beff7c9
The dates are those of the commits that first added the entries' files
(2020-08-11 for the entries of the initial commit); renamed entries keep
the date of their first name.

Changed: none
diff --git a/entries/rcdd_alibaba/__init__.py b/entries/rcdd_alibaba/__init__.py
index d676042..3610a94 100644
--- a/entries/rcdd_alibaba/__init__.py
+++ b/entries/rcdd_alibaba/__init__.py
@@ -38,7 +38,7 @@ citation = [('T. Xiang, A. Li, Y. Ji, D. Li, "Knowledge Based Prohibited Item De
              'https://doi.org/10.1145/3459637.3481945')]
 upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)',
                     'https://creativecommons.org/licenses/by/4.0/')
-icon_hash = None
+date_added = '2026-10-31'
 
 # Huge: the 256-dimensional node features of the 13.8 million nodes take
 # about 29 GB in memory (vector<double>; graph-tool has no vector<float>:
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto bc3dbbd
The lists of properties at the end of the descriptions marked edge
properties with "Edge" but left node properties unmarked, or grouped
them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property
was often unclear. Every item now starts with (Node), (Edge) or (Graph),
followed by the property names, a colon and the explanation, one item
per property or group of properties; qualifications (kinds of nodes,
networks) follow the names in parentheses. Properties that were only
named got a short explanation, and a few items that named the wrong
kind of property were corrected.
diff --git a/entries/rcdd_alibaba/__init__.py b/entries/rcdd_alibaba/__init__.py
index 62f49ee..d676042 100644
--- a/entries/rcdd_alibaba/__init__.py
+++ b/entries/rcdd_alibaba/__init__.py
@@ -25,8 +25,11 @@ The graph has 13,806,619 nodes (11,933,366 items, 204,128 of type `a`, 45,602 of
 
 The network has the following properties:
 
-- Nodes: `node_type`, `item` or `a` to `f` (empty if unknown); `features`, the 256-dimensional feature vector of the node (empty if none); `label`, the risk label of the item, 1 (risky) or 0 (not), -1 if unknown; `split`, `train` or `test` for the labeled items (the split of the competition; empty otherwise).
-- Edges: `edge_type`, `A` to `H`."""
+- (Node) `node_type`: `item` or `a` to `f` (empty if unknown).
+- (Node) `features`: the 256-dimensional feature vector of the node (empty if none).
+- (Node) `label`: the risk label of the item, 1 (risky) or 0 (not), -1 if unknown.
+- (Node) `split`: `train` or `test` for the labeled items (the split of the competition; empty otherwise).
+- (Edge) `edge_type`: `A` to `H`."""
 tags = ['Economic', 'Commerce', 'Online', 'Multilayer', 'Unweighted', 'Metadata']
 url = 'https://doi.org/10.5281/zenodo.8100246'
 citation = [('T. Xiang, A. Li, Y. Ji, D. Li, "Knowledge Based Prohibited Item Detection on Heterogeneous Risk Graphs." Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, 5260-5269 (2023)',
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 2c69f19
Unneeded "global files" statements, unused imports and variables,
f-strings without placeholders, duplicate keys in foodweb_little_rock
(keeping the order and the values used), and the second definition of
get_lines() in twitter_higgs. Nothing changes in the networks or
descriptions.

Changed: none
diff --git a/entries/rcdd_alibaba/__init__.py b/entries/rcdd_alibaba/__init__.py
index a3e5eb5..62f49ee 100644
--- a/entries/rcdd_alibaba/__init__.py
+++ b/entries/rcdd_alibaba/__init__.py
@@ -66,7 +66,6 @@ EDGE_TYPES = ["A", "B", "C", "D", "F", "G", "H"]
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     import pyarrow, pyarrow.csv, pyarrow.compute as pc
     name = __name__.split(".")[-1]
     fedges, ftrain, ftest, fnodes = files[0][0]
[entries] New entry: rcdd_alibaba by Tiago de Paula Peixoto 6df86ff
diff --git a/entries/rcdd_alibaba/__init__.py b/entries/rcdd_alibaba/__init__.py
new file mode 100644
index 0000000..a3e5eb5
--- /dev/null
+++ b/entries/rcdd_alibaba/__init__.py
@@ -0,0 +1,174 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Alibaba risk commodity detection graph (RCDD)"
+description = """A heterogeneous graph from the risk detection of Alibaba's e-commerce platform (AliExpress), the Risk Commodity Detection Dataset (RCDD), released for the ICDM 2022 competition on risk commodity detection and by Xiang et al. Its nodes are items (commodities) and entities of six other, anonymized types (`a` to `f`; e.g. buyers, sellers, devices or addresses, which the authors do not reveal for confidentiality), and its directed edges are relations of seven anonymized types (`A` to `H`, without `E`; e.g. buying or selling): `A` from items to `b`, `B` from `f` to items, `C` from `f` to `d`, `D` from `f` to `c`, `F` from `f` to `e`, `G` from `f` to `a`, and `H` from `e` to `a`. Some items are labeled as risky (prohibited) or not, by the platform's risk control, for the training and testing of node classification.
+
+The graph has 13,806,619 nodes (11,933,366 items, 204,128 of type `a`, 45,602 of `b`, 178,777 of `c`, 1,687 of `d`, 379,320 of `e` and 1,063,739 of `f`) and 78,907,432 edges. The edge file of the dataset also contains every edge in the reverse direction (types `A_1` to `H_1`, for the graph neural networks), which are left out. The nodes have 256-dimensional feature vectors: for the items, the concatenation of embeddings of their images and texts by pre-trained models (BERT and BYOL); for the other nodes, features that the dataset does not explain.
+
+The network has the following properties:
+
+- Nodes: `node_type`, `item` or `a` to `f` (empty if unknown); `features`, the 256-dimensional feature vector of the node (empty if none); `label`, the risk label of the item, 1 (risky) or 0 (not), -1 if unknown; `split`, `train` or `test` for the labeled items (the split of the competition; empty otherwise).
+- Edges: `edge_type`, `A` to `H`."""
+tags = ['Economic', 'Commerce', 'Online', 'Multilayer', 'Unweighted', 'Metadata']
+url = 'https://doi.org/10.5281/zenodo.8100246'
+citation = [('T. Xiang, A. Li, Y. Ji, D. Li, "Knowledge Based Prohibited Item Detection on Heterogeneous Risk Graphs." Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, 5260-5269 (2023)',
+             'https://doi.org/10.1145/3580305.3599852'),
+            ('Y. Ji, C. Shi, X. Wang, "Prohibited Item Detection on Heterogeneous Risk Graphs." Proceedings of the 30th ACM International Conference on Information & Knowledge Management, 3867-3877 (2021)',
+             'https://doi.org/10.1145/3459637.3481945')]
+upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)',
+                    'https://creativecommons.org/licenses/by/4.0/')
+icon_hash = None
+
+# Huge: the 256-dimensional node features of the 13.8 million nodes take
+# about 29 GB in memory (vector<double>; graph-tool has no vector<float>:
+# the name is an alias of vector<double>); parsing needs an estimated 65 GB
+# (the features, their copy in coerce_props, and the graph), and loading the
+# network about 36 GB
+huge = True
+
+# Zenodo record of version 1.0, the version with the test labels (version
+# 1.1, 8103003, has the same files, without the test labels and with a DGL
+# graph); RCDD_nodes.csv (22 GB) holds the node features
+upstream_prefix = 'https://zenodo.org/records/8100246/files'
+files = [(('RCDD_edges.csv', 'RCDD_train_labels.csv', 'RCDD_test_labels.csv',
+           'RCDD_nodes.csv'), None, None)]
+
+# Number of edge rows and of node rows read (None for all; set only for
+# checks)
+_check_rows = None
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+NODE_TYPES = ["item", "a", "b", "c", "d", "e", "f"]
+EDGE_TYPES = ["A", "B", "C", "D", "F", "G", "H"]
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    import pyarrow, pyarrow.csv, pyarrow.compute as pc
+    name = __name__.split(".")[-1]
+    fedges, ftrain, ftest, fnodes = files[0][0]
+    ntype = numpy.full(0, -1, dtype="int8")
+    chunks = []
+    n = 0
+    with open_upstream_file(name, fedges, "rb") as f:
+        r = pyarrow.csv.open_csv(
+            f, read_options=pyarrow.csv.ReadOptions(
+                use_threads=False, block_size=1 << 26,
+                column_names=["source", "target", "source_type",
+                              "target_type", "edge_type"]),
+            convert_options=pyarrow.csv.ConvertOptions(
+                column_types={"source": pyarrow.int64(),
+                              "target": pyarrow.int64(),
+                              "source_type": pyarrow.dictionary(pyarrow.int32(), pyarrow.string()),
+                              "target_type": pyarrow.dictionary(pyarrow.int32(), pyarrow.string()),
+                              "edge_type": pyarrow.dictionary(pyarrow.int32(), pyarrow.string())}))
+        for b in r:
+            if _check_rows is not None and n >= _check_rows:
+                break
+            n += b.num_rows
+            et = pc.index_in(pc.cast(b.column("edge_type"), pyarrow.string()),
+                             value_set=pyarrow.array(EDGE_TYPES)).to_numpy(zero_copy_only=False)
+            keep = ~numpy.isnan(et.astype("float64"))   # reverse edges are left out
+            s = b.column("source").to_numpy()[keep]
+            t = b.column("target").to_numpy()[keep]
+            m = max(s.max(initial=-1), t.max(initial=-1)) + 1
+            if m > len(ntype):
+                ntype = numpy.concatenate((ntype, numpy.full(m - len(ntype), -1, dtype="int8")))
+            for col, ids in [("source_type", s), ("target_type", t)]:
+                ty = pc.index_in(pc.cast(b.column(col), pyarrow.string()),
+                                 value_set=pyarrow.array(NODE_TYPES)).to_numpy(zero_copy_only=False)
+                ntype[ids] = ty[keep]
+            chunks.append(numpy.column_stack((s, t, et[keep].astype("int64"))))
+    labels = []
+    for fname, split in [(ftrain, "train"), (ftest, "test")]:
+        with open_upstream_file(name, fname, "r") as f:
+            for line in f:
+                x = re.split(r"[,\t]", line.strip())
+                if len(x) == 2:
+                    labels.append((int(x[0]), int(float(x[1])), split))
+    nv = max(len(ntype), max(i for i, l, s in labels) + 1)
+    g = Graph(directed=True)
+    g.add_vertex(nv)
+    g.vp.node_type = g.new_vp("string")
+    tnames = numpy.array(NODE_TYPES + [""], dtype="object")
+    ntype = numpy.concatenate((ntype, numpy.full(nv - len(ntype), -1, dtype="int8")))
+    for v, ty in zip(g.vertices(), tnames[ntype]):
+        g.vp.node_type[v] = ty
+    del ntype
+    g.vp.label = g.new_vp("int16_t", val=-1)
+    g.vp.split = g.new_vp("string")
+    for i, l, s in labels:
+        g.vp.label[i] = l
+        g.vp.split[i] = s
+    g.ep.edge_type = g.new_ep("string")
+    g.ep.type_index = g.new_ep("int16_t")
+    for c in chunks:
+        g.add_edge_list(c, eprops=[g.ep.type_index])
+    del chunks
+    # string edge types, by edge index (the edges are indexed in the order
+    # of insertion)
+    eidx = g.edge_index
+    tidx = g.ep.type_index.a
+    for e in g.edges():
+        g.ep.edge_type[e] = EDGE_TYPES[tidx[eidx[e]]]
+    del g.ep["type_index"]
+
+    # node features (one row per node, in no particular order; the types
+    # also cover the nodes without edges)
+    g.vp.features = g.new_vp("vector<double>")
+    feat = g.vp.features
+    ntypes = g.vp.node_type
+    n = 0
+    with open_upstream_file(name, fnodes, "rb") as f:
+        r = pyarrow.csv.open_csv(
+            f, read_options=pyarrow.csv.ReadOptions(
+                use_threads=False, block_size=1 << 26,
+                column_names=["node_id", "node_type", "features"]),
+            convert_options=pyarrow.csv.ConvertOptions(
+                column_types={"node_id": pyarrow.int64(),
+                              "node_type": pyarrow.string(),
+                              "features": pyarrow.string()}))
+        for b in r:
+            if _check_rows is not None and n >= _check_rows:
+                break
+            n += b.num_rows
+            ids = b.column("node_id").to_numpy()
+            k = g.num_vertices()
+            if ids.max(initial=-1) >= k:
+                g.add_vertex(ids.max() + 1 - k)
+                g.vp.label.a[k:] = -1
+            for v, ty in zip(ids, b.column("node_type").to_pylist()):
+                if ntypes[v] == "":
+                    ntypes[v] = ty
+            x = pc.split_pattern(b.column("features"), ":")
+            lens = pc.list_value_length(x).to_numpy(zero_copy_only=False)
+            vals = pc.cast(pc.list_flatten(x), pyarrow.float64()).to_numpy()
+            del x
+            offs = numpy.concatenate(([0], numpy.cumsum(lens)))
+            for i, v in enumerate(ids):
+                feat[v] = vals[offs[i]:offs[i + 1]]
+            del vals
+    yield None, g