@@ -542,52 +542,52 @@ PWMap<Set> SBGSCC<Set>::sccMinReach(DSBGraph<Set> dg) const
542
542
if (!vs.isEmpty ()) {
543
543
// Vertices in the set-vertex that share its rep with other vertex
544
544
// in the set-vertex
545
- Set rec_vs = rmap.restrict (vs).sharedImage ();
545
+ Set VR = rmap.restrict (vs).sharedImage ();
546
546
// There is a recursive vertex that changed its rep in the last step
547
547
// (to avoid computing again an already found recursion)
548
- if (!rec_vs.intersection (Vc).isEmpty ()) {
549
- // Vertices that reach the same rep as rec_vs
550
- Set same_rep = rmap.preImage (rmap.image (rec_vs));
551
- Set same_SV = dg.Vmap ().preImage (dg.Vmap ().image (same_rep));
552
- // Edges with both endings in same_rep (path to a minimum rep)
553
- Set esB = mapB.preImage (same_rep), esD = mapD.preImage (same_rep);
554
- Set es = esB.intersection (esD);
548
+ if (!VR.intersection (Vc).isEmpty ()) {
549
+ // Edges with both endings in VR (path to a minimum rep)
550
+ Set ERB = mapB.preImage (VR), ERD = mapD.preImage (VR);
551
+ Set ER = ERB.intersection (ERD);
555
552
556
553
// Distance map
557
554
PW dmap;
558
- Set reps = rmap.image (), ith = reps.intersection (same_rep), visited;
555
+ Set ith = rmap.image (VR), dom_VR;
556
+ // Set visited, dom_vs;
559
557
unsigned int copies = mapB.nmbrDims ();
560
558
Util::NAT dist = 0 ;
561
559
// Calculate distance for vertices in same_rep that reach reps
562
- for (Set ith; !ith. intersection (same_rep ).isEmpty ();) {
560
+ for (; dg. Vmap (). restrict (dom_VR). sharedImage ( ).isEmpty ();) {
563
561
Exp exp (Util::MD_NAT (copies, dist));
564
- dmap.emplaceBack (Map (ith.difference (visited), exp ));
562
+ Set dom = ith.difference (dmap.dom ());
563
+ dmap.emplaceBack (Map (ith.difference (dmap.dom ()), exp ));
564
+ dom_VR = dmap.dom ().intersection (VR);
565
565
// Update ith to vertices that have outgoing edges entering ith
566
- ith = mapB.image (mapD.preImage (ith)).intersection (same_rep);
567
- visited = visited.cup (ith);
566
+ ith = mapB.image (mapD.preImage (ith));
568
567
++dist;
569
568
}
569
+ dmap = dmap.restrict (VR);
570
570
PW dmapB = dmap.composition (mapB), dmapD = dmap.composition (mapD);
571
571
// Get edges where the end is closer to the rep that the beginning
572
572
Set not_cycle_edges = dmapB.gtImage (dmapD);
573
- es = es .intersection (not_cycle_edges);
573
+ ER = ER .intersection (not_cycle_edges);
574
574
575
575
// Extend to subset-edge
576
- Set es_plus = subE_map.preImage (subE_map.image (es ));
577
- PW auxB = mapB.restrict (es_plus ), auxD = mapD.restrict (es_plus );
576
+ Set ER_plus = subE_map.preImage (subE_map.image (ER ));
577
+ PW auxB = mapB.restrict (ER_plus ), auxD = mapD.restrict (ER_plus );
578
578
// Calculate a succesor
579
+ Set same_SV = dg.Vmap ().preImage (dg.Vmap ().image (VR));
579
580
PW rmap_plus = auxB.minAdjMap (auxD).restrict (same_SV);
580
581
581
- // Leave original reps for same_rep and update reps for recursion
582
- rmap_plus = rmap.restrict (same_rep).combine (rmap_plus);
583
582
// Update rmap for recursion, and leave the rest unchanged
584
583
rec_rmap = rmap_plus.combine (rec_rmap).compact ();
585
584
586
585
if (debug ()) {
587
- Util::SBG_LOG << " same_rep: " << same_rep << " \n " ;
588
- Util::SBG_LOG << " es: " << es << " \n " ;
586
+ Util::SBG_LOG << " VR: " << VR << " \n " ;
587
+ Util::SBG_LOG << " ER: " << ER << " \n " ;
588
+ Util::SBG_LOG << " dmap: " << dmap << " \n " ;
589
589
Util::SBG_LOG << " not_cycle_edges: " << not_cycle_edges << " \n " ;
590
- Util::SBG_LOG << " es_plus : " << es_plus << " \n " ;
590
+ Util::SBG_LOG << " ER_plus : " << ER_plus << " \n " ;
591
591
Util::SBG_LOG << " rmap_plus: " << rmap_plus << " \n " ;
592
592
}
593
593
}
0 commit comments