@tbui17/graph-functions

GRAPH-FUNCTIONS

Visualize Math, Master Graphs โ€“ Effortlessly.

license last-commit repo-top-language repo-language-count


Quick Links


Overview

Utility library for operating on the Graphology graph data structure.

  • Notable features
    • getGraphEdgesOfType / getGraphNodesOfType - Presumes that the graph is typed and has a a discriminant field type on both node and edge attributes. Returns all node or edge entries containing that type in its attributes, automatically narrowing down the range of possible types.
    • bfsGraph - Iterator for breadth-first search on a graph, provides a context with convenience properties (eg. path) and methods for contextualized graph query methods (e.g filterEdgeEntries automatically provides the previous and current node as arguments to the method.)
    • unweightedSteinerSubgraph - Retrieves smallest subgraph containing all specified terminal nodes, disregarding weight.
    • InferGraph - Utility type extracting the node, edge, or graph attribute type from a base generic graph type.

Note: The remaining content is autogenerated by https://github.com/eli64s/readme-ai, some information may be inaccurate. See typedocs or tests folder for up to date information.

The Graph-Functions repository is a TypeScript-based library focused on providing a suite of utilities for graph data structure management and analysis. It simplifies complex operations such as traversal, search, and pathfinding within graphs for developers. The project's main value lies in its ability to offer ready-to-use, efficient algorithms that cater to common graph-related tasks, potentially saving time and reducing errors in applications like network analysis, route optimization, and social network dynamics.


Features

Feature Description
โš™๏ธ Architecture The project seems to be a TypeScript library related to graph data structure handling.
๐Ÿ”ฉ Code Quality Code style is maintained with eslint and formatted with prettier-plugin-jsdoc.
๐Ÿ“„ Documentation Documentation is generated via typedoc, indicating a focus on API docs.
๐Ÿ”Œ Integrations The project likely integrates with other TypeScript projects or libraries.
๐Ÿงฉ Modularity Presence of multiple TypeScript files suggests modular design.
๐Ÿงช Testing Uses Vitest framework.
โšก๏ธ Performance No specific performance metrics provided, efficiency unknown.
๐Ÿ›ก๏ธ Security No explicit security measures mentioned in the provided details.
๐Ÿ“ฆ Dependencies Depends on libraries like lodash, ts-toolbelt, and @tbui17/iteration-utilities.
๐Ÿš€ Scalability Scalability potential is not clear without further information on load handling.

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

.
File Summary
.eslintrc.cjs The code snippet configures eslint for TypeScript enforcement in a library focused on graph data structure manipulation.
index.ts The 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.json This 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.yaml This 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.mjs The prettier.config.mjs configures code formatting for the graph-related function library, ensuring consistent styling across the repository.
tsconfig.json The tsconfig.json sets TypeScript compiler options for strict type-checking and ESNext features, optimizing the graph library for robust development.
.changeset
File Summary
config.json The code manages a graph utility library within a Node.js ecosystem, automating changelog generation and enforcing consistent code style and CI workflows.
.github.workflows
File Summary
main.yml Continuous Integration setup for graph-functions repo, automating tests, linting, and build on push to any branch.
publish.yml The publish.yml workflow automates package deployment when the main branch updates or CI succeeds, using concurrency to manage simultaneous runs.
src
File Summary
index.ts The 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.ts This snippet provides a utility within the graph-functions module to convert directed graphs to undirected while preserving edge key names.
types.ts Types module for a graph-oriented library, provides type inference for nodes, edges, and graph attributes based on the Graphology library's types.
unweightedSteinerSubgraph.ts This 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.
src.edges
File Summary
filterEdgeEntries.ts The 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.ts The getEdgeEntry function retrieves detailed data for a graph edge, integral to edge-related operations in the graph-processing library.
getGraphEdgesOfType.ts The 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.ts This module identifies and groups parallel edges within a graph data structure, utilizing the graphology library and lodash for processing.
index.ts The file serves as a central export hub for edge-related utilities in a graph manipulation library.
mapFilterEdges.ts The snippet provides utility functions for mapping and filtering a graph's edges based on custom criteria, crucial for graph manipulation within the architecture.
mappers.ts The code provides edge transformation utilities within a graph manipulation library, aligning edges and mapping iteration parameters to standardized structures.
realignGraphEdges.ts The 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.ts Defines edge-related TypeScript types for graph manipulation functions, integral to enforcing type safety and facilitating edge operations within the graph library.
src.nodes
File Summary
filterNodeEntries.ts This 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.ts The getGraphNodesOfType.ts provides functionality for retrieving nodes by type from a graph, supporting both individual and multiple type queries.
getNodeEntry.ts This snippet defines getNodeEntry, a utility fetching node details from a graph, pivotal for node data retrieval within the graph library.
index.ts This code serves as an export hub for node-related functionalities within a graph manipulation library, streamlining the repository's module structure.
mapFilterNodes.ts The 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.ts Defines types for node-related operations in a graph architecture, focusing on type-based filtering and retrieval.
src.recursors
File Summary
bfs.ts This 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.ts The src/recursors/index.ts centralizes exports of graph traversal functionalities for the graph utility library.
RecursorContext.ts The 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.ts The TraversalStateManager manages state for graph traversal algorithms, tracking visited nodes, paths, and handling cycles within the graph-functions library.

Getting Started

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

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone https://github.com/tbui17/graph-functions
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


License

This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return


Generated using TypeDoc