Wrapping around the graph-data-structure library to work with graphs
rodzic
5f9e1d74ba
commit
48e8cdf4ae
|
@ -0,0 +1,25 @@
|
|||
const Graph = require("graph-data-structure");
|
||||
|
||||
|
||||
class GraphIndex {
|
||||
/**
|
||||
* Wrapper around the graph-data-structure
|
||||
* that parses the oplog to create a corresponding
|
||||
* Graph.
|
||||
*/
|
||||
constructor() {
|
||||
this._graph = Graph();
|
||||
}
|
||||
|
||||
addProject(cid) {
|
||||
this._graph.addNode(cid)
|
||||
}
|
||||
|
||||
addDependency(dependent, dependency, weight) {
|
||||
this._graph.addEdge(dependent, depedency, weight)
|
||||
}
|
||||
|
||||
get projects() {
|
||||
return this._graph.nodes()
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue