
Security News
Node.js Homepage Adds Paid Support Link, Prompting Contributor Pushback
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
graphology-components
Advanced tools
Connected components for graphology
.
npm install graphology-components
Iterates over the connected components of the given graph using a callback.
import {forEachConnectedComponent} from 'graphology-components';
forEachConnectedComponent(graph, component => {
console.log(component);
});
Specialized version of forEachConnectedComponent that iterates over the connected component orders, i.e. the number of nodes they contain.
It consumes less memory than a naive approach mapping the component lengths using forEachConnectedComponent
.
import {forEachConnectedComponentOrder} from 'graphology-components';
forEachConnectedComponentOrder(graph, order => {
console.log(order);
});
Returns the number of connected components of the given graph.
import {countConnectedComponents} from 'graphology-components';
const count = countConnectedComponents(graph);
Returns the list of connected components of the given graph.
import {connectedComponents} from 'graphology-components';
const components = connectedComponents(graph);
If your graph is mixed or directed, the result will be what are usually called weakly connected components.
Returns the largest connected component of the given graph.
import {largestConnectedComponent} from 'graphology-components';
const largest = largestConnectedComponent(graph);
Returns a subgraph of the largest connected component of the given graph.
import {largestConnectedComponentSubgraph} from 'graphology-components';
const subgraph = largestConnectedComponentSubgraph(graph);
Mutates the given graph to remove nodes and edges that are not part of its largest connected component.
import {cropToLargestConnectedComponent} from 'graphology-components';
cropToLargestConnectedComponent(graph);
Returns the list of strongly connected components of the given graph. (mixed or directed)
import {stronglyConnectedComponents} from 'graphology-components';
const components = stronglyConnectedComponents(graph);
FAQs
Connected components for graphology.
The npm package graphology-components receives a total of 19,404 weekly downloads. As such, graphology-components popularity was classified as popular.
We found that graphology-components 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
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.
Research
Security News
The Socket Research Team investigates a malicious Python typosquat of a popular password library that forces Windows shutdowns when input is incorrect.