@@ -292,98 +292,6 @@ function openPositions(){
292
292
//***************************************************************************
293
293
//OPEN GRAPHS
294
294
//***************************************************************************
295
- function enumEdges ( ) {
296
- /*
297
- Goes through and enumerates the number the number undirected edges between
298
- each pairs of vertices that have edges between them.
299
-
300
- OUTPUT
301
- edgeCount: An object of the form {source: {target: {count: 1, ids: [edgeIdHere]}}}
302
- */
303
- var edges = cy . edges ( ) ;
304
- var edgeCount = { } ;
305
-
306
- //Enumerate each type of edge
307
- for ( var i = 0 ; i < edges . length ; i ++ ) {
308
- var source = edges [ i ] . data ( 'source' ) ,
309
- target = edges [ i ] . data ( 'target' ) ,
310
- id = edges [ i ] . data ( 'id' ) ;
311
-
312
- //Check if our edgeCount dict has an entry for the source or target
313
- var sourceEntry = source in edgeCount ,
314
- targetEntry = target in edgeCount ;
315
-
316
- //If neither entries exist make one
317
- if ( ! sourceEntry && ! targetEntry ) {
318
- edgeCount [ source ] = { } ;
319
- edgeCount [ source ] [ target ] = { count : 1 , ids : [ id ] } ;
320
- }
321
- //Otherwise use the existing one already
322
- else if ( sourceEntry && ! targetEntry ) {
323
- //Check if our target is in the sourceEntry
324
- var targetInner = target in edgeCount [ source ] ;
325
-
326
- if ( ! targetInner ) {
327
- edgeCount [ source ] [ target ] = { count : 0 , ids : [ ] } ;
328
- }
329
-
330
- edgeCount [ source ] [ target ] . count ++ ;
331
- edgeCount [ source ] [ target ] . ids . push ( id ) ;
332
- }
333
- else if ( targetEntry && ! sourceEntry ) {
334
- //Check if our source is in the targetEntry
335
- var sourceInner = source in edgeCount [ target ] ;
336
-
337
- if ( ! sourceInner ) {
338
- edgeCount [ target ] [ source ] = { count : 0 , ids : [ ] } ;
339
- }
340
-
341
- edgeCount [ target ] [ source ] . count ++ ;
342
- edgeCount [ target ] [ source ] . ids . push ( id ) ;
343
- }
344
- else if ( targetEntry && sourceEntry ) {
345
- //Check if one already has a entry
346
- var targetInner = target in edgeCount [ source ] ,
347
- sourceInner = source in edgeCount [ target ] ;
348
-
349
- if ( targetInner ) {
350
- edgeCount [ source ] [ target ] . count ++ ;
351
- edgeCount [ source ] [ target ] . ids . push ( id ) ;
352
- }
353
- else if ( sourceInner ) {
354
- edgeCount [ target ] [ source ] . count ++ ;
355
- edgeCount [ target ] [ source ] . ids . push ( id ) ;
356
- }
357
- else {
358
- edgeCount [ source ] [ target ] = { count : 1 , ids : [ id ] } ;
359
- }
360
- }
361
- }
362
-
363
- return edgeCount ;
364
- }
365
-
366
- function removeDuplicateEdges ( ) {
367
- /*
368
- Counts the number of undirected edges of each type and removes half of them.
369
- */
370
-
371
- var edgeCount = enumEdges ( ) ;
372
-
373
- //When the number of a type of edge is divisible by two, we have duplicates
374
- for ( var source in edgeCount ) {
375
- for ( var target in edgeCount [ source ] ) {
376
-
377
- //Check for duplicates and remove
378
- if ( edgeCount [ source ] [ target ] . count % 2 === 0 ) {
379
- for ( var i = 0 ; i < edgeCount [ source ] [ target ] . ids . length / 2 ; i ++ ) {
380
- cy . remove ( cy . $id ( edgeCount [ source ] [ target ] . ids [ i ] ) )
381
- }
382
- }
383
- }
384
- }
385
- }
386
-
387
295
function parseGraph ( graph ) {
388
296
/*
389
297
Given input of a multiline adjlist as a string,
@@ -472,10 +380,7 @@ function parseGraph(graph){
472
380
}
473
381
474
382
currentLine += degree ;
475
- }
476
-
477
- //The way in which we add adds each edge twice
478
- removeDuplicateEdges ( ) ;
383
+ }
479
384
}
480
385
481
386
function openGraph ( ) {
0 commit comments