
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
kruskal-mst
Advanced tools
Implementation of Kruskal's algorithm for finding a minimum spanning forest of an unidirected edge-weighted graph.
Kruskal's algorithm finds a minimum spanning forest of an undirected edge-weighted graph. If the graph is connected, it finds a minimum spanning tree.
For more information read: https://en.wikipedia.org/wiki/Kruskal%27s_algorithm
k = require('kruskal-mst');
edges = [
{ from: 'A', to: 'B', weight: 1 },
{ from: 'A', to: 'C', weight: 5 },
{ from: 'A', to: 'E', weight: 7 },
{ from: 'B', to: 'C', weight: 2 },
{ from: 'B', to: 'D', weight: 5 },
{ from: 'C', to: 'F', weight: 8 },
{ from: 'D', to: 'E', weight: 3 },
{ from: 'D', to: 'F', weight: 4 },
{ from: 'E', to: 'F', weight: 5 },
];
mst = k.kruskal(edges);
console.log(mst);
[
{ from: 'A', to: 'B', weight: 1 },
{ from: 'B', to: 'C', weight: 2 },
{ from: 'D', to: 'E', weight: 3 },
{ from: 'D', to: 'F', weight: 4 },
{ from: 'B', to: 'D', weight: 5 }
]
import { kruskal, Edge } from 'kruskal-mst';
const edges: Edge<string>[] = [
{ from: 'A', to: 'B', weight: 1 },
{ from: 'A', to: 'C', weight: 5 },
{ from: 'A', to: 'E', weight: 7 },
{ from: 'B', to: 'C', weight: 2 },
{ from: 'B', to: 'D', weight: 5 },
{ from: 'C', to: 'F', weight: 8 },
{ from: 'D', to: 'E', weight: 3 },
{ from: 'D', to: 'F', weight: 4 },
{ from: 'E', to: 'F', weight: 5 },
];
const spanningTree = kruskal(edges);
console.log(spanningTree);
FAQs
Implementation of Kruskal's algorithm for finding a minimum spanning forest of an unidirected edge-weighted graph.
The npm package kruskal-mst receives a total of 2,554 weekly downloads. As such, kruskal-mst popularity was classified as popular.
We found that kruskal-mst demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.