
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
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 0 weekly downloads. As such, graphology-components popularity was classified as not 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.