Skip to content

Commit

Permalink
tweak typescript integration (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbo47 authored Nov 17, 2023
1 parent e3bd51e commit 65a8801
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/dagre/position/bk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function findType1Conflicts(g, layering) {
k0 = 0,
// Tracks the last node in this layer scanned for crossings with a type-1
// segment.
scanPos = 0 as number | string,
scanPos: number | string = 0,
prevLayerLength = prevLayer.length,
lastNode = _.last(layer);

Expand Down
47 changes: 24 additions & 23 deletions src/graphlib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,30 @@ var EDGE_KEY_DELIM = '\x01';
// edges up and, object properties, which have string keys, are the closest
// we're going to get to a performant hashtable in JavaScript.
export class Graph {
_isDirected: boolean;
_isMultigraph: boolean;
_isCompound: boolean;
_label: any;
_defaultNodeLabelFn: () => any;
_defaultEdgeLabelFn: () => any;
_nodes: {};
_parent: {};
_children: {};
_in: {};
_preds: {};
_out: {};
_sucs: {};
_edgeObjs: {};
_edgeLabels: {};
_nodeCount = 0;
_edgeCount = 0;
protected _isDirected: boolean;
protected _isMultigraph: boolean;
protected _isCompound: boolean;
protected _label: any;
protected _defaultNodeLabelFn: () => any;
protected _defaultEdgeLabelFn: () => any;
protected _nodes: {};
protected _parent: {};
protected _children: {};
protected _in: {};
protected _preds: {};
protected _out: {};
protected _sucs: {};
protected _edgeObjs: {};
protected _edgeLabels: {};
/**
* Number of nodes in the graph. Should only be changed by the implementation.
*/
protected _nodeCount = 0;
/**
* Number of edges in the graph. Should only be changed by the implementation.
*/
protected _edgeCount = 0;

constructor(opts = {} as { directed?: boolean, multigraph?: boolean, compound?: boolean }) {
this._isDirected = _.has(opts, 'directed') ? opts.directed : true;
this._isMultigraph = _.has(opts, 'multigraph') ? opts.multigraph : false;
Expand Down Expand Up @@ -475,12 +482,6 @@ export class Graph {
}
}

/* Number of nodes in the graph. Should only be changed by the implementation. */
Graph.prototype._nodeCount = 0;

/* Number of edges in the graph. Should only be changed by the implementation. */
Graph.prototype._edgeCount = 0;

function incrementOrInitEntry(map, k) {
if (map[k]) {
map[k]++;
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ES6",
"outDir": "dist_tmp/",
"types": [],
"module": "node16",
},
"exclude": [
"src/**/*.test.ts",
Expand Down

0 comments on commit 65a8801

Please sign in to comment.