0.3.5 • Published 1 month ago

@tbui17/graph-functions v0.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Overview

Utility functions for traversing or querying the Graphology graph data structure.

See typedocs and tests folder for details of available utilities.


Repository Structure

└── graph-functions/
    ├── .changeset
    │   └── config.json
    ├── .eslintrc.cjs
    ├── .github
    │   └── workflows
    │       ├── main.yml
    │       └── publish.yml
    ├── index.ts
    ├── package.json
    ├── pnpm-lock.yaml
    ├── prettier.config.mjs
    ├── src
    │   ├── edges
    │   │   ├── filterEdgeEntries.ts
    │   │   ├── getEdgeEntry.ts
    │   │   ├── getGraphEdgesOfType.ts
    │   │   ├── getParallelEdgeEntries.ts
    │   │   ├── index.ts
    │   │   ├── mapFilterEdges.ts
    │   │   ├── mappers.ts
    │   │   ├── realignGraphEdges.ts
    │   │   └── types.ts
    │   ├── index.ts
    │   ├── nodes
    │   │   ├── filterNodeEntries.ts
    │   │   ├── getGraphNodesOfType.ts
    │   │   ├── getNodeEntry.ts
    │   │   ├── index.ts
    │   │   ├── mapFilterNodes.ts
    │   │   └── types.ts
    │   ├── recursors
    │   │   ├── bfs.ts
    │   │   ├── index.ts
    │   │   ├── RecursorContext.ts
    │   │   └── TraversalStateManager.ts
    │   ├── toUndirectedKeepEdgeNames.ts
    │   ├── types.ts
    │   └── unweightedSteinerSubgraph.ts
    └── tsconfig.json

Modules

FileSummary
.eslintrc.cjsThe code snippet configures eslint for TypeScript enforcement in a library focused on graph data structure manipulation.
index.tsThe index.ts file acts as an entry point, re-exporting functionalities from the source internals, aligning with the repository's focus on graph data structure manipulations.
package.jsonThis codebase provides graph manipulation and traversal utilities as a library, with functions focusing on nodes, edges, and recursive searches within graph data structures. It's built in TypeScript, follows modern JS ecosystem practices, and includes automated workflows for testing and release.
pnpm-lock.yamlThis code snippet is part of a graph-related utilities library, managing configurations for changesets, linting, and continuous integration workflows, focusing on automated code quality and publishing processes.
prettier.config.mjsThe prettier.config.mjs configures code formatting for the graph-related function library, ensuring consistent styling across the repository.
tsconfig.jsonThe tsconfig.json sets TypeScript compiler options for strict type-checking and ESNext features, optimizing the graph library for robust development.
FileSummary
config.jsonThe code manages a graph utility library within a Node.js ecosystem, automating changelog generation and enforcing consistent code style and CI workflows.
FileSummary
main.ymlContinuous Integration setup for graph-functions repo, automating tests, linting, and build on push to any branch.
publish.ymlThe publish.yml workflow automates package deployment when the main branch updates or CI succeeds, using concurrency to manage simultaneous runs.
FileSummary
index.tsThe src/index.ts serves as the central export hub for the graph-functions library, consolidating utilities for graph edges, nodes, traversal algorithms, and specific graph operations.
toUndirectedKeepEdgeNames.tsThis snippet provides a utility within the graph-functions module to convert directed graphs to undirected while preserving edge key names.
types.tsTypes module for a graph-oriented library, provides type inference for nodes, edges, and graph attributes based on the Graphology library's types.
unweightedSteinerSubgraph.tsThis code provides a function to compute the unweighted Steiner subgraph in a graph architecture, ensuring it contains specified nodes and handles disconnections with a custom error.
FileSummary
filterEdgeEntries.tsThe filterEdgeEntries.ts file provides a utility to filter edges in a graph based on specified criteria, crucial for graph traversal and manipulation within the graph-functions library.
getEdgeEntry.tsThe getEdgeEntry function retrieves detailed data for a graph edge, integral to edge-related operations in the graph-processing library.
getGraphEdgesOfType.tsThe getGraphEdgesOfType.ts module provides utilities to filter and retrieve edges from a graph data structure based on type specifications, integral to the graph-functions library's edge manipulation capabilities.
getParallelEdgeEntries.tsThis module identifies and groups parallel edges within a graph data structure, utilizing the graphology library and lodash for processing.
index.tsThe file serves as a central export hub for edge-related utilities in a graph manipulation library.
mapFilterEdges.tsThe snippet provides utility functions for mapping and filtering a graph's edges based on custom criteria, crucial for graph manipulation within the architecture.
mappers.tsThe code provides edge transformation utilities within a graph manipulation library, aligning edges and mapping iteration parameters to standardized structures.
realignGraphEdges.tsThe code provides functionality to realign graph edges within a graph data structure, based on node types or custom filters, altering the graph's edge directionality.
types.tsDefines edge-related TypeScript types for graph manipulation functions, integral to enforcing type safety and facilitating edge operations within the graph library.
FileSummary
filterNodeEntries.tsThis code provides a utility to filter nodes in a graph, returning nodes that meet criteria defined by a provided filter function. It's part of a graph manipulation library.
getGraphNodesOfType.tsThe getGraphNodesOfType.ts provides functionality for retrieving nodes by type from a graph, supporting both individual and multiple type queries.
getNodeEntry.tsThis snippet defines getNodeEntry, a utility fetching node details from a graph, pivotal for node data retrieval within the graph library.
index.tsThis code serves as an export hub for node-related functionalities within a graph manipulation library, streamlining the repository's module structure.
mapFilterNodes.tsThe mapFilterNodes.ts module provides a utility for transforming and selectively including nodes from a graph based on custom logic defined in a mapper function, within a graph manipulation library.
types.tsDefines types for node-related operations in a graph architecture, focusing on type-based filtering and retrieval.
FileSummary
bfs.tsThis code provides a breadth-first search (BFS) utility for traversing graphs, handling directed/undirected and partial traversals with customizable neighbor iteration strategies within the graph-functions library.
index.tsThe src/recursors/index.ts centralizes exports of graph traversal functionalities for the graph utility library.
RecursorContext.tsThe RecursorContext class provides a context for graph traversal operations within the graph-functions library, managing node and edge data access and manipulation for specific graph recursion scenarios.
TraversalStateManager.tsThe TraversalStateManager manages state for graph traversal algorithms, tracking visited nodes, paths, and handling cycles within the graph-functions library.

NPM Installation

npm install @tbui17/graph-functions

Installation

  1. Clone the graph-functions repository:
git clone https://github.com/tbui17/graph-functions
  1. Change to the project directory:
cd graph-functions
  1. Install the dependencies:
npm install

Tests

To execute tests, run:

npm test

License

MIT