Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cycle 2 vertex mapping #2

Open
raghavsi opened this issue Aug 27, 2018 · 2 comments
Open

cycle 2 vertex mapping #2

raghavsi opened this issue Aug 27, 2018 · 2 comments

Comments

@raghavsi
Copy link

Hi
Is there a way to get the cycle 2 vertex mapping.
I can get cycles in terms of edge_numb but this is numbered with relation to the spanning tree. I was wondering if there is a simple way to print cycle_1: vertex_i, vertex_j, .. vertex_i ?

Thanks again for your time!!!!
raghav

@d-michail
Copy link
Owner

You should change method print_cycle_basis in file GW_MCB_DEMO.c. Class edge_num contains method operator()(int i) which can be used to get the actual LEDA edge. From the LEDA edge you can access both source and target vertices. Something like the following should work:

int j = 0;
forall(j, cycle) {
    e = enumb(j);
    source = g.source(e);
    target = g.target(e);
}

or

leda::list_item it = cycle.first();
while( it != nil ) {
    index = cycle.index( it );
    e = enumb( index );
    source = g.source(e);
    target = g.target(e);
    it = cycle.succ( it );
}

@raghavsi
Copy link
Author

This is working. Thanks again for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants