Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
graphology-operators
Advanced tools
Miscellaneous operators to be used with graphology
.
npm install graphology-operators
Unary
Binary
Cast
Reverse the given graph's directed edges.
import {reverse} from 'graphology-operators';
// Alternatively, to load only the relevant code:
import reverse from 'graphology-operators/reverse';
const reversedGraph = reverse(graph);
Arguments
Returns the union of the given graphs. Nodes & edges present in both graph will have their attributes merges with precedence given to the second graph.
import {union} from 'graphology-operators';
// Alternatively, to load only the relevant code:
import union from 'graphology-operators/union';
const R = union(G, H);
Arguments
Returns the simple version of the given multigraph where we only keep a single edge of each type between nodes.
If an already simple graph is passed, the function will only return a copy of it.
import {toSimple} from 'graphology-operators';
// Alternatively, to load only the relevant code:
import toSimple from 'graphology-operators/to-simple';
const simpleGraph = toSimple(multiGraph);
Returns the undirected version of the given graph where any directed edge will be considered as now undirected.
Note that you can pass a function to merge edge attributes in case of mutual edges or mixed edges conflicts. This can be useful to sum weights and so on...
If an already undirected graph is passed, the function will only return a copy of it.
import {toUndirected} from 'graphology-operators';
// Alternatively, to load only the relevant code:
import toUndirected from 'graphology-operators/to-undirected';
const undirectedGraph = toUndirected(graph);
// Using a merging function
const undirectedGraph = toUndirected(graph, (currentAttr, nextAttr) => {
return {
...currentAttr,
weight: currentAttr.weight + nextAttr.weight
};
});
Arguments
FAQs
Miscellaneous operators for graphology.
The npm package graphology-operators receives a total of 16,726 weekly downloads. As such, graphology-operators popularity was classified as popular.
We found that graphology-operators 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.