@graph-data-structure/specification Home Manual Reference Source

src/implementation/DirectedGraph.js

  1. import AbstractDirectedGraph from './AbstractDirectedGraph.js';
  2.  
  3. const isEdge =
  4. (u, v) =>
  5. ([x, y]) =>
  6. u === x && v === y;
  7.  
  8. export default class DirectedGraph extends AbstractDirectedGraph {
  9. eadd(u, v) {
  10. const existingEdge = this.E.find(isEdge(u, v));
  11. if (existingEdge !== undefined) return existingEdge;
  12. return super.eadd(u, v);
  13. }
  14. }