@@ -20,14 +20,6 @@ class GraphData extends Data {
2020 this . logData = null ;
2121 }
2222
23- directed ( isDirected = true ) {
24- this . isDirected = isDirected ;
25- }
26-
27- weighted ( isWeighted = true ) {
28- this . isWeighted = isWeighted ;
29- }
30-
3123 set ( array2d = [ ] ) {
3224 this . nodes = [ ] ;
3325 this . edges = [ ] ;
@@ -44,6 +36,14 @@ class GraphData extends Data {
4436 super . set ( ) ;
4537 }
4638
39+ directed ( isDirected = true ) {
40+ this . isDirected = isDirected ;
41+ }
42+
43+ weighted ( isWeighted = true ) {
44+ this . isWeighted = isWeighted ;
45+ }
46+
4747 addNode ( id , weight = null , visitedCount = 0 , selectedCount = 0 , x = 0 , y = 0 ) {
4848 if ( this . findNode ( id ) ) return ;
4949 this . nodes . push ( { id, weight, visitedCount, selectedCount, x, y } ) ;
@@ -184,14 +184,14 @@ class GraphData extends Data {
184184 }
185185
186186 visit ( target , source , weight ) {
187- this . visitOrLeave ( target , source , weight , true ) ;
187+ this . visitOrLeave ( true , target , source , weight ) ;
188188 }
189189
190190 leave ( target , source , weight ) {
191- this . visitOrLeave ( target , source , weight , false ) ;
191+ this . visitOrLeave ( false , target , source , weight ) ;
192192 }
193193
194- visitOrLeave ( target , source , weight , visit ) {
194+ visitOrLeave ( visit , target , source = null , weight = null ) {
195195 const edge = this . findEdge ( source , target ) ;
196196 if ( edge ) edge . visitedCount += visit ? 1 : - 1 ;
197197 const node = this . findNode ( target ) ;
@@ -203,14 +203,14 @@ class GraphData extends Data {
203203 }
204204
205205 select ( target , source ) {
206- this . selectOrDeselect ( target , source , true ) ;
206+ this . selectOrDeselect ( true , target , source ) ;
207207 }
208208
209209 deselect ( target , source ) {
210- this . selectOrDeselect ( target , source , false ) ;
210+ this . selectOrDeselect ( false , target , source ) ;
211211 }
212212
213- selectOrDeselect ( target , source , select ) {
213+ selectOrDeselect ( select , target , source = null ) {
214214 const edge = this . findEdge ( source , target ) ;
215215 if ( edge ) edge . selectedCount += select ? 1 : - 1 ;
216216 const node = this . findNode ( target ) ;
0 commit comments