Finds rooted spanning trees of undirected Gert graphs
npm install gert-spanning-treeFinds rooted spanning trees of undirected Gert graphs
 
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
$3
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.