Skip to main content

edgelist-mapper

Build status Build status
Code style Linter Test runner Build tool
Project license

📊 Maps nodes and edges of a multi-relational graph to integer

Synopsis

edgelist-mapper is a simple tool that reads an edge-list file representing a graph and maps each node and relation to integer. The mapping assigned is such that entities and relations that appear more frequently in the graph are mapped to smaller numerical values.

This tool is particularly useful to pre-process some of the publicly available knowledge graph datasets that are often used for the machine learning task of relation prediction.

Input format

The tool takes as input a file (edgelist.tsv) that represents a graph as tab-separated triples of the form (head, relation, tail) and generates three new files, namely mapped_edgelist.tsv, entities_map.tsv, and relations_map.tsv.

san_marino	locatedin	europe
belgium	locatedin	europe
russia	locatedin	europe
monaco	locatedin	europe
croatia	locatedin	europe
poland	locatedin	europe

Example content of the edgelist.tsv file.

0	europe
1	san_marino
2	russia
3	poland
4	monaco
5	croatia
6	belgium

Content of the entities_map.tsv generated from the edgelist.tsv file.

0	locatedin

Content of the relations_map.tsv generated from the edgelist.tsv file.

1	0	0
6	0	0
2	0	0
4	0	0
5	0	0
3	0	0

Content of the mapped_edgelist.tsv generated from the edgelist.tsv file.

CLI Usage

The CLI takes the following positional arguments:

  edgelist    Path of the edgelist file
  output      Path of the output directory

Example usage:

pip install edgelist-mapper
python -m edgelist_mapper.bin.run \
    edgelist.tsv \
    .

NB: You need Python 3 to run the CLI.

Showcase

This tool has been used to create this collection of datasets.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the license file for details.

Metadata

Release files for edgelist-mapper 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edgelist-mapper 0.1.2
File Size Uploaded Provenance
edgelist-mapper-0.1.2.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for edgelist-mapper 0.1.2
File Interpreter ABI Platform
edgelist_mapper-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / edgelist-mapper-0.1.2.tar.gz

Download URL edgelist-mapper-0.1.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dbb574a3d9417f120f9c1cd95e6d39693f4e4aaffe56fa7484b322f5151d3392
BLAKE2b-256 checksum
How to use checksums
b061de618953ec047c81c62419d0764c266d836928afd826a16e578979acc785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.7 Darwin/19.3.0

Release files / edgelist_mapper-0.1.2-py3-none-any.whl

Download URL edgelist_mapper-0.1.2-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64370b2d79a36c36e303b26525c763175bf19a6c06e2423c72a79a3a6a2e375f
BLAKE2b-256 checksum
How to use checksums
2ce75304c892ef0ff8225ad9bd7f705a56e16768a3955d5724eea21419ea34e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.7 Darwin/19.3.0

Security for edgelist-mapper 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page