{"id":16014412,"url":"https://github.com/drom/digraph","last_synced_at":"2025-03-17T20:31:32.443Z","repository":{"id":9535928,"uuid":"11438816","full_name":"drom/digraph","owner":"drom","description":"Directed graph library","archived":false,"fork":false,"pushed_at":"2020-04-10T02:37:01.000Z","size":72,"stargazers_count":1,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T03:32:54.878Z","etag":null,"topics":["digraph","graph","math"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-16T02:29:15.000Z","updated_at":"2023-04-12T07:11:06.000Z","dependencies_parsed_at":"2022-09-14T07:31:18.123Z","dependency_job_id":null,"html_url":"https://github.com/drom/digraph","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fdigraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fdigraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fdigraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drom%2Fdigraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drom","download_url":"https://codeload.github.com/drom/digraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885855,"owners_count":20363642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["digraph","graph","math"],"created_at":"2024-10-08T15:02:22.869Z","updated_at":"2025-03-17T20:31:32.113Z","avatar_url":"https://github.com/drom.png","language":"JavaScript","readme":"[![NPM version](https://img.shields.io/npm/v/digraph.svg)](https://www.npmjs.org/package/digraph)\n[![Build Status](https://travis-ci.org/drom/digraph.svg?branch=master)](https://travis-ci.org/drom/digraph)\n[![Coverage Status](https://coveralls.io/repos/github/drom/digraph/badge.svg?branch=master)](https://coveralls.io/github/drom/digraph?branch=master)\n\n# digraph\n\nDigraph module provides several functions for working with\n[directed graph](http://en.wikipedia.org/wiki/Directed_graph)s (digraphs)\nin JavaScript.\n\n## node.js\n```js\nnpm i digraph --save\n```\n\n## browser\n\nUse browserify.\n\n## API\n\n```js\nvar digraph = require('digraph');\n```\n\n`digraph` is a factory function creates directed graph object.\n\n```js\nvar g1 = digraph();\n```\n\n### `g.node() -\u003e n`\n\nDigraph object has `node` factory function.\n\n```js\n\u003cNode\u003e = g1.node(\u003cN\u003e)\n```\n\nCreates new node object if needed.\n\n`N: undefined`\n\nConstructs new noname node object.\n\n`N: {String}`\n\nSearch for existing node object with this name.\nConstructs new node object with the name if can`t find existing node.\n\n`N: {Object}`\n\nUses provided `Object` as node object descriptor. Search for existing node object if `name: 'NodeName'` is provided.\n\n#### Examples:\n\n```js\nvar a = g1.node('a');\n\nvar node = g1.node; // can be detached\n\nvar b = node('b');\nvar c = node('c');\n```\n\n### `n.edge(n) -\u003e e`\n\nNode object has `edge` factory that will search for the relevant edge or create one if needed.\n\n#### Examples:\n\n```js\nvar a_b = a.edge(b);\nvar b_e = node('b').edge(node('e'));\n\nvar c_ = c.edge; // can be detached\nvar c_d = c_(d);\nvar c_e = c_(e);\n```\n\n### `g.edges`\n\n```js\n[\u003cEdge\u003e] = g1.edges.from(\u003cNode\u003e)\n```\n\nReturn array of all outgoing edges.\n\n```js\n[\u003cEdge\u003e] = g1.edges.to(\u003cNode\u003e)\n```\n\nReturn array of all incoming edges.\n\n```js\n[\u003cEdge\u003e] = g1.edges.at(\u003cNode\u003e)\n```\n\n### `g.get`\n\n\n```js\n[\u003cNode\u003e] = g.get.nodes\n```\n\nReturn array of nodes in no particular order.\n\n```js\n[\u003cEdge\u003e] = g.get.edges\n```\n\nReturn array of edges in no particular order.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrom%2Fdigraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrom%2Fdigraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrom%2Fdigraph/lists"}