Skip to content

Commit 3686ba8

Browse files
committed
Matching notation
1 parent 4322d03 commit 3686ba8

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

algorithms/matching/bfs_matching.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ void BFSMatching::swapEdgesDirection(const Set& E)
5757

5858
PWMap temp_mapB = mapB.restrict(E);
5959
mapB = mapD.restrict(E).combine(std::move(mapB));
60-
mapB.compact();
6160
mapD = temp_mapB.restrict(E).combine(std::move(mapD));
62-
mapD.compact();
6361

6462
_dsbg = DirectedSBG{_dsbg.V(), _dsbg.Vmap(), mapB, mapD, _dsbg.Emap()};
6563
}

algorithms/matching/bfs_paths.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ BFSPaths::BFSPaths() {}
3636

3737
PWMap BFSPaths::calculate(const DirectedSBG& dsbg, const Set& endings)
3838
{
39-
Set dsbgV = dsbg.V();
40-
PWMap dsbgB = dsbg.mapB();
41-
PWMap dsbgD = dsbg.mapD();
39+
Set V = dsbg.V();
40+
PWMap mapB = dsbg.mapB();
41+
PWMap mapD = dsbg.mapD();
4242
PWMap Emap = dsbg.Emap();
4343

4444
// Successor map to unmatched vertices
@@ -47,44 +47,44 @@ PWMap BFSPaths::calculate(const DirectedSBG& dsbg, const Set& endings)
4747
// A record of allowed edges to keep out cycle edges
4848
Set allowed_edges = dsbg.E();
4949
// Ingoing edges to vertices that reach endings
50-
Set ingoing = dsbgD.preImage(endings);
50+
Set ingoing = mapD.preImage(endings);
5151
// A record of visited set-edges
5252
Set visitedE = SET_FACT.createSet();
5353
do {
5454
// Calculate successor for ith vertices
55-
PWMap ingoingB = dsbgB.restrict(ingoing);
56-
PWMap ingoingD = dsbgD.restrict(ingoing);
55+
PWMap ingoingB = mapB.restrict(ingoing);
56+
PWMap ingoingD = mapD.restrict(ingoing);
5757
PWMap ith_smap = ingoingB.minAdj(ingoingD);
5858

5959
Util::DEBUG_LOG << "ith_smap: " << ith_smap << "\n";
6060

6161
// Edges that lead to a successor
62-
Set Eith = dsbgD.equalImage(ith_smap.composition(dsbgB));
62+
Set Eith = mapD.equalImage(ith_smap.composition(mapB));
6363
// Visited set-edges
6464
Set Erec = visitedE.intersection(Emap.image(Eith));
6565
// Handle recursion
6666
if (!Erec.isEmpty()) {
6767
Set Eplus = Emap.preImage(Erec);
68-
PWMap rec_smap = dsbgB.restrict(Eplus).minAdj(dsbgD.restrict(Eplus));
68+
PWMap rec_smap = mapB.restrict(Eplus).minAdj(mapD.restrict(Eplus));
6969
Util::DEBUG_LOG << "rec_smap: " << rec_smap << "\n";
7070
ith_smap = ith_smap.combine(rec_smap);
7171
}
7272
result = ith_smap.combine(result);
73-
73+
7474
// Take out other outgoing edges to avoid cycles
75-
allowed_edges = allowed_edges.difference(dsbgB.preImage(result.domain()));
76-
dsbgD = dsbgD.restrict(allowed_edges);
77-
dsbgB = dsbgB.restrict(allowed_edges);
75+
allowed_edges = allowed_edges.difference(mapB.preImage(result.domain()));
76+
mapD = mapD.restrict(allowed_edges);
77+
mapB = mapB.restrict(allowed_edges);
7878

7979
// Edges that reach vertices with a successor
80-
ingoing = dsbgD.preImage(result.domain()).intersection(allowed_edges);
80+
ingoing = mapD.preImage(result.domain()).intersection(allowed_edges);
8181

8282
visitedE = visitedE.cup(Emap.image(Eith));
8383

8484
Util::DEBUG_LOG << "Eith: " << Eith << "\n";
8585
Util::DEBUG_LOG << "Erec: " << Erec << "\n";
8686
Util::DEBUG_LOG << "visitedE: " << visitedE << "\n";
87-
Util::DEBUG_LOG << "res: " << result << "\n\n";
87+
Util::DEBUG_LOG << "result: " << result << "\n\n";
8888
} while (!ingoing.isEmpty());
8989

9090
return result;

0 commit comments

Comments
 (0)