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

find_partition_multiplex #181

Closed
elisabettabiondi opened this issue May 28, 2024 · 4 comments
Closed

find_partition_multiplex #181

elisabettabiondi opened this issue May 28, 2024 · 4 comments

Comments

@elisabettabiondi
Copy link

elisabettabiondi commented May 28, 2024

Thank you, @vtraag. Since I am not able to reopen the issue, I open a new one here.
A simple question:
Once I run:

optimiser = la.Optimiser()
diff = optimiser.optimise_partition_multiplex([part_pos, part_neg], layer_weights=[1, -1])

how do I get the vertices belonging to each partition?

Hi @elisabettabiondi, you are calling find_partition_multiplex which is expecting to be passed igraph.Graphs, not leidenalg.VertexPartitions. If you look at the example in the documentation at https://leidenalg.readthedocs.io/en/stable/multiplex.html#negative-links, you can see that it uses optimise_partition_multiplex, not find_partition_multiplex.

This should solve your problem. If it doesn't, feel free to re-open the issue!

Originally posted by @vtraag in #179 (comment)

@vtraag
Copy link
Owner

vtraag commented May 28, 2024

Since I am not able to reopen the issue, I open a new one here.

Sorry, my bad. Indeed, you can't re-open it, but I could after commenting. Anyway, doesn't matter, we can continue the discussion here.

Once I run:

optimiser = la.Optimiser()
diff = optimiser.optimise_partition_multiplex([part_pos, part_neg], layer_weights=[1, -1])

You can retrieve the membership from part_pos and part_neg (both contain the same partitioning information). These are objects that are derived from igraph.VertexClustering, see that documentation for more information.

@elisabettabiondi
Copy link
Author

Perfect, thank you!
Is there a way to force the partition to be of length 2?

@elisabettabiondi
Copy link
Author

I found the answer by myself in this previous issue:
#89 (comment)

@vtraag
Copy link
Owner

vtraag commented May 31, 2024

Great you found the answer!

One additional tip by the way, as explained in the documentation on optimise_partition_multiplex, it might be better to set consider_comms to leidenalg.ALL_COMMS when dealing with negative links.

This issue was closed.
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