This package contains implementations of exact and approximate algorithms to compute minimum cycle bases for weighted directed and undirected graphs.
algorithm which appeared in the PhD thesis of J.C. de Pina. A description of this algorithm and an even faster one can be found here.
hybrid algorithm, which is a mixture of the above algorithm and an older algorithm due to Horton. For more details see here.
hybrid algorithm, which is a more clever implementation of the last mentioned algorithm. For more details see this paper.
constant factor
-approximate algorithm. For more details see this link.
implementation of an
randomized Monte Carlo algorithm due to T. Kavitha, which appeared in ICALP'05.
constant factor
-approximate algorithm. For more details see this link.but it may work on others too.
This program can be freely used in an academic environment
ONLY for research purposes, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
an acknowledgment in the product documentation is required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Any other use is strictly prohibited by the author, without an explicit
permission.
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Note that this package uses LEDA, which is not free. However, Algorithmic Solutions released a free version of LEDA 6.0 which can be used to build this library.
#include <LEP/mcb/mcb.h> int main() { leda::graph G; // construct undirected, loopfree graph G leda::edge_array<int> len(G, 1); // fill up non-negative edge lengths mcb::edge_num enumb( G ); leda::array< mcb::spvecgf2 > mcb; int weight = mcb::UMCB( G, len, mcb, enumb ); int i,j; leda::edge e; for( i = 0; i < enumb.dim_cycle_space(); ++i ) { forall( j, mcb[i] ) { // traverse edges of i-th cycle e = enumb( j ); // do something with edge e } } }
#include <LEP/mcb/mcb.h> int main() { leda::graph G; // construct simple, loopfree, directed graph G leda::edge_array<int> len(G, 1); // fill up positive edge lengths leda::array< mcb::spvecfp > mcb; int weight = mcb::DMCB( G, len, mcb ); int i; leda::edge e; ptype direction; for( i = 0; i < enumb.dim_cycle_space(); ++i ) { leda::list_item it = mcb[i].first(); while( it != nil ) { e = enumb( mcb[i].index( it ) ); direction = mcb[i].inf( it ); // do something with edge e // direction is -1 or 1 based on traversing the cycle // in some arbitrary direction it = mcb[i].succ( it ); } } }
#include <LEP/mcb/mcb.h> int main() { leda::graph G; // construct loopfree graph G leda::edge_array<int> len(G, 1); // fill up non-negative edge lengths // setup constant for approximation factor 2k-1 int k = 2; mcb::edge_num enumb( G ); leda::array< mcb::spvecgf2 > mcb; int weight = mcb::UMCB_APPROX( G, len, k, mcb, enumb ); int i,j; leda::edge e; for( i = 0; i < enumb.dim_cycle_space(); ++i ) { forall( j, mcb[i] ) { // traverse edges of i-th cycle e = enumb( j ); // do something with edge e } } }
1.4.6