
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
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.
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.
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
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.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.