Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devinivy/gert-spanning-tree
Finds rooted spanning trees of undirected Gert graphs
https://github.com/devinivy/gert-spanning-tree
Last synced: 26 days ago
JSON representation
Finds rooted spanning trees of undirected Gert graphs
- Host: GitHub
- URL: https://github.com/devinivy/gert-spanning-tree
- Owner: devinivy
- License: mit
- Created: 2015-11-28T20:52:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-28T21:00:22.000Z (almost 9 years ago)
- Last Synced: 2024-10-03T07:45:23.343Z (about 1 month ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gert-spanning-tree
Finds rooted spanning trees of undirected [Gert](https://github.com/devinivy/gert) graphs
[![Build Status](https://travis-ci.org/devinivy/gert-spanning-tree.svg?branch=master)](https://travis-ci.org/devinivy/gert-spanning-tree) [![Coverage Status](https://coveralls.io/repos/devinivy/gert-spanning-tree/badge.svg?branch=master&service=github)](https://coveralls.io/github/devinivy/gert-spanning-tree?branch=master)
## Usage
```js
var Graph = require('gert').Graph;
var Spanning = require('gert-spanning-tree');var graph = new Graph({
directed: false,
vertices: ['a', 'b', 'c', 'd'],
edges: [
['a', 'b'], ['b', 'c'],
['c', 'a'], ['c', 'd']
]
});var spanningTree = Spanning(graph, 'a');
spanningTree.getEdges(null, true); // [['a', 'b'], ['a', 'c'], ['c', 'd']]
```## API
### `Spanning(graph, root, [depthFirst])`
Returns a spanning tree of undirected Gert graph `graph` rooted at vertex `root`. If `depthFirst` is `true` then the vertices will be traversed depth-first rather than breadth-first.