@@ -572,7 +572,7 @@ level-1, with valid internal fields `e.inte1` (to track which cycle
572
572
function deleteEdge! (net:: HybridNetwork , e:: Edge ; part:: Bool = true )
573
573
if part
574
574
if e. inte1 == - 1 && ! e. hybrid && ! isempty (net. partition) && ! isTree (net)
575
- ind = whichPartition (net,e)
575
+ ind = whichpartition (net,e)
576
576
indE = getIndex (e,net. partition[ind]. edges)
577
577
deleteat! (net. partition[ind]. edges,indE)
578
578
end
@@ -1460,50 +1460,50 @@ end
1460
1460
# better to return the index than the partition itself, because we need the index
1461
1461
# to use splice and delete it from net.partition later on
1462
1462
# cycle: is the number to look for partition on that cycle only
1463
- function whichPartition (net:: HybridNetwork ,edge:: Edge ,cycle:: Integer )
1463
+ function whichpartition (net:: HybridNetwork , edge:: Edge , cycle:: Integer )
1464
1464
! edge. hybrid || error (" edge $(edge. number) is hybrid so it cannot be in any partition" )
1465
1465
edge. inte1 == - 1 || error (" edge $(edge. number) is in cycle $(edge. inte1) so it cannot be in any partition" )
1466
1466
@debug " search partition for edge $(edge. number) in cycle $(cycle) "
1467
1467
in (edge,net. edge) || error (" edge $(edge. number) is not in net.edge" )
1468
1468
for i in 1 : length (net. partition)
1469
1469
@debug " looking for edge $(edge. number) in partition $(i) : $([e. number for e in net. partition[i]. edges]) "
1470
- if ( in (cycle,net. partition[i]. cycle) )
1470
+ if in (cycle, net. partition[i]. cycle)
1471
1471
@debug " looking for edge $(edge. number) in partition $(i) , with cycle $(cycle) : $([e. number for e in net. partition[i]. edges]) "
1472
1472
if in (edge,net. partition[i]. edges)
1473
1473
@debug " partition for edge $(edge. number) is $([e. number for e in net. partition[i]. edges]) "
1474
1474
return i
1475
1475
end
1476
1476
end
1477
1477
end
1478
- @debug begin ; printPartitions (net); " " end
1478
+ @debug begin ; printpartitions (net); " " end
1479
1479
error (" edge $(edge. number) is not hybrid, nor part of any cycle, and it is not in any partition" )
1480
1480
end
1481
1481
1482
1482
# function to get the partition where an edge is
1483
1483
# returns the index of the partition, or error if not found
1484
1484
# better to return the index than the partition itself, because we need the index
1485
1485
# to use splice and delete it from net.partition later on
1486
- function whichPartition (net:: HybridNetwork ,edge:: Edge )
1486
+ function whichpartition (net:: HybridNetwork , edge:: Edge )
1487
1487
! edge. hybrid || error (" edge $(edge. number) is hybrid so it cannot be in any partition" )
1488
1488
edge. inte1 == - 1 || error (" edge $(edge. number) is in cycle $(edge. inte1) so it cannot be in any partition" )
1489
1489
@debug " search partition for edge $(edge. number) without knowing its cycle"
1490
1490
in (edge,net. edge) || error (" edge $(edge. number) is not in net.edge" )
1491
1491
for i in 1 : length (net. partition)
1492
1492
@debug " looking for edge $(edge. number) in partition $(i) : $([e. number for e in net. partition[i]. edges]) "
1493
- if ( in (edge,net. partition[i]. edges) )
1493
+ if in (edge,net. partition[i]. edges)
1494
1494
@debug " partition for edge $(edge. number) is $([e. number for e in net. partition[i]. edges]) "
1495
1495
return i
1496
1496
end
1497
1497
end
1498
- @debug begin printPartitions (net); " printed partitions" end
1498
+ @debug begin printpartitions (net); " printed partitions" end
1499
1499
error (" edge $(edge. number) is not hybrid, nor part of any cycle, and it is not in any partition" )
1500
1500
end
1501
1501
1502
- # function that will print the partition of net
1503
- function printPartitions ( net:: HybridNetwork )
1504
- println (" partition.cycle\t partition.edges" )
1502
+ printpartitions (x) = printpartitions ( stdout :: IO , x)
1503
+ function printpartitions (io :: IO , net:: HybridNetwork )
1504
+ println (io, " partition.cycle\t partition.edges" )
1505
1505
for p in net. partition
1506
- println (" $(p. cycle) \t\t $([e. number for e in p. edges]) " )
1506
+ println (io, " $(p. cycle) \t\t $([e. number for e in p. edges]) " )
1507
1507
end
1508
1508
end
1509
1509
0 commit comments