Skip to content

Commit 87ef6e2

Browse files
committedApr 11, 2018
Fix JSDoc.
1 parent 67cdad8 commit 87ef6e2

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed
 

‎src/data-structures/graph/Graph.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
export default class Graph {
22
/**
3-
* @param isDirected {boolean}
3+
* @param {boolean} isDirected
44
*/
55
constructor(isDirected = false) {
66
this.vertices = {};
77
this.isDirected = isDirected;
88
}
99

1010
/**
11-
* @param newVertex {GraphVertex}
11+
* @param {GraphVertex} newVertex
1212
* @returns {Graph}
1313
*/
1414
addVertex(newVertex) {
@@ -18,15 +18,15 @@ export default class Graph {
1818
}
1919

2020
/**
21-
* @param vertexKey {string}
21+
* @param {string} vertexKey
2222
* @returns GraphVertex
2323
*/
2424
getVertexByKey(vertexKey) {
2525
return this.vertices[vertexKey];
2626
}
2727

2828
/**
29-
* @param edge {GraphEdge}
29+
* @param {GraphEdge} edge
3030
* @returns {Graph}
3131
*/
3232
addEdge(edge) {
@@ -62,16 +62,16 @@ export default class Graph {
6262
}
6363

6464
/**
65-
* @param startVertex {GraphVertex}
66-
* @param endVertex {GraphVertex}
65+
* @param {GraphVertex} startVertex
66+
* @param {GraphVertex} endVertex
6767
*/
6868
findEdge(startVertex, endVertex) {
6969
const vertex = this.getVertexByKey(startVertex.getKey());
7070
return vertex.findEdge(endVertex);
7171
}
7272

7373
/**
74-
* @param vertexKey {string}
74+
* @param {string} vertexKey
7575
* @returns {GraphVertex}
7676
*/
7777
findVertexByKey(vertexKey) {

‎src/data-structures/graph/GraphEdge.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export default class GraphEdge {
22
/**
3-
* @param startVertex {GraphVertex}
4-
* @param endVertex {GraphVertex}
5-
* @param weight {number}
3+
* @param {GraphVertex} startVertex
4+
* @param {GraphVertex} endVertex
5+
* @param {number} [weight=1]
66
*/
77
constructor(startVertex, endVertex, weight = 1) {
88
this.startVertex = startVertex;

‎src/data-structures/graph/GraphVertex.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class GraphVertex {
1313
}
1414

1515
/**
16-
* @param edge {GraphEdge}
16+
* @param {GraphEdge} edge
1717
* @returns {GraphVertex}
1818
*/
1919
addEdge(edge) {
@@ -22,6 +22,9 @@ export default class GraphVertex {
2222
return this;
2323
}
2424

25+
/**
26+
* @returns {GraphVertex[]}
27+
*/
2528
getNeighbors() {
2629
const edges = this.edges.toArray();
2730

@@ -35,7 +38,7 @@ export default class GraphVertex {
3538
}
3639

3740
/**
38-
* @param requiredEdge {GraphEdge}
41+
* @param {GraphEdge} requiredEdge
3942
* @returns {boolean}
4043
*/
4144
hasEdge(requiredEdge) {
@@ -47,7 +50,7 @@ export default class GraphVertex {
4750
}
4851

4952
/**
50-
* @param vertex {GraphVertex}
53+
* @param {GraphVertex} vertex
5154
* @returns {boolean}
5255
*/
5356
hasNeighbor(vertex) {
@@ -58,6 +61,10 @@ export default class GraphVertex {
5861
return !!vertexNode;
5962
}
6063

64+
/**
65+
* @param {GraphVertex} vertex
66+
* @returns {(GraphEdge|null)}
67+
*/
6168
findEdge(vertex) {
6269
const edgeFinder = (edge) => {
6370
return edge.startVertex === vertex || edge.endVertex === vertex;
@@ -76,7 +83,7 @@ export default class GraphVertex {
7683
}
7784

7885
/**
79-
* @param callback {function}
86+
* @param {function} [callback]
8087
* @returns {string}
8188
*/
8289
toString(callback) {

0 commit comments

Comments
 (0)
Please sign in to comment.