
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Graph algorithms implemented in Rust, available as a Python package. >10x faster than networkx
.
So far, there is only one function implemented: all_pairs_dijkstra_path_length
. It's a re-write of the networkx
function with the same name and should return the same results.
pip install rust-graph
from rust_graph import all_pairs_dijkstra_path_length
weighted_edges = [
(0, 1, 1.0),
(1, 2, 2.0),
(2, 3, 3.0),
(3, 0, 4.0),
(0, 3, 5.0),
]
shortest_paths = all_pairs_dijkstra_path_length(weighted_edges, cutoff=3.0)
>>> shortest_paths
{3: {3: 0.0, 2: 3.0}, 2: {2: 0.0, 1: 2.0, 0: 3.0, 3: 3.0}, 1: {0: 1.0, 2: 2.0, 1: 0.0}, 0: {1: 1.0, 0: 0.0, 2: 3.0}}
Tried a couple of options but failed for various reasons. Here are some notes on them:
networkx
for the test data.cutoff
parameter is not implemented.Thus, we compare the performance of networkx
and rust-graph
for the all_pairs_dijkstra_path_length
function.
23x as fast as networkx
:
networkx Dijkstra took 4.45 s
rust-graph Dijkstra took 0.19 s
12x as fast as networkx
:
networkx Dijkstra took 6.83 s
rust-graph Dijkstra took 0.57 s
If not using rayon parallelism, it's twice as slow:
networkx Dijkstra took 7.12 s
rust-graph Dijkstra took 1.04 s
CPU info:
Model name: AMD EPYC 7V13 64-Core Processor
CPU family: 25
Model: 1
Thread(s) per core: 1
Core(s) per socket: 48
15x as fast as networkx
:
networkx Dijkstra took 6.14 s
rust-graph Dijkstra took 0.41 s
Install uv
, rustup
and maturin
. Activate a virtual environment. Then,
bash scripts/install.sh
uv pip install -r deps/requirements_dev.in
python3 scripts/hf_download.py # Download test data
python3 tools/benchmark.py
Use GitHub Actions: apply-pip-compile.yml
. Manually launch the workflow and it will make a commit with the updated lockfiles.
FAQs
Simple and fast graph operations written in Rust
We found that rust-graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.