File tree Expand file tree Collapse file tree 4 files changed +40
-40
lines changed
Expand file tree Collapse file tree 4 files changed +40
-40
lines changed Original file line number Diff line number Diff line change 1+ ( function ( exports ) {
2+ 'use strict' ;
3+
4+ /**
5+ * Graph edge.
6+ *
7+ * @constructor
8+ * @public
9+ * @param {Vertex } e Vertex which this edge connects.
10+ * @param {Vertex } v Vertex which this edge connects.
11+ * @param {Number } distance Weight of the edge.
12+ * @module data-structures/edge
13+ */
14+ exports . Edge = function ( e , v , distance ) {
15+ this . e = e ;
16+ this . v = v ;
17+ this . distance = distance ;
18+ } ;
19+
20+ } ) ( typeof window === 'undefined' ? module . exports : window ) ;
Original file line number Diff line number Diff line change 1+ ( function ( exports ) {
2+ 'use strict' ;
3+
4+ /**
5+ * Graph vertex.
6+ *
7+ * @constructor
8+ * @public
9+ * @param {Number } id Id of the vertex.
10+ * @module data-structures/vertex
11+ */
12+ exports . Vertex = function ( id ) {
13+ this . id = id ;
14+ } ;
15+
16+ } ) ( typeof window === 'undefined' ? module . exports : window ) ;
Original file line number Diff line number Diff line change 3535
3636 'use strict' ;
3737
38- /**
39- * Graph edge.
40- *
41- * @constructor
42- * @public
43- * @param {Vertex } u Start vertex.
44- * @param {Vertex } v End vertex.
45- * @param {Number } weight Weight of the edge.
46- */
47- exports . Edge = function ( u , v , weight ) {
48- this . from = u ;
49- this . to = v ;
50- this . weight = weight ;
51- } ;
38+ exports . Vertex = require ( '../../data-structures/vertex' ) . Vertex ;
39+ exports . Edge = require ( '../../data-structures/edge' ) . Edge ;
5240
5341 /**
5442 * Computes shortest paths from a single source
Original file line number Diff line number Diff line change 4545 'use strict' ;
4646
4747 var Heap = require ( '../../data-structures/heap' ) . Heap ;
48-
49- /**
50- * Graph vertex.
51- *
52- * @constructor
53- * @public
54- * @param {Number } id Id of the vertex.
55- */
56- exports . Vertex = function ( id ) {
57- this . id = id ;
58- } ;
59-
60- /**
61- * Graph edge.
62- *
63- * @constructor
64- * @public
65- * @param {Vertex } e Vertex which this edge connects.
66- * @param {Vertex } v Vertex which this edge connects.
67- * @param {Number } distance Weight of the edge.
68- */
69- exports . Edge = function ( e , v , distance ) {
70- this . e = e ;
71- this . v = v ;
72- this . distance = distance ;
73- } ;
48+ exports . Vertex = require ( '../../data-structures/vertex' ) . Vertex ;
49+ exports . Edge = require ( '../../data-structures/edge' ) . Edge ;
7450
7551 /**
7652 * Graph.
You can’t perform that action at this time.
0 commit comments