Closed ulgenklc closed 3 years ago
Yes, you can do this using the general function slices_to_layers
, in which you can specify a coupling graph, indicating (the nodes of) which graph should be connected to (the nodes of) which other graph. See https://leidenalg.readthedocs.io/en/stable/multiplex.html#slices-to-layers for a more detailed explanation. If anything remains unclear, or if you have any other questions, let me know!
Hello again
I still am not sure how slices_to_layers
would help. I get that it would help if I wanted to couple the snapshots(just to not get confused with the slice&layer terminology, I'm going to use snapshots) without any chronological order but that's not what I want to do. I still want to keep the consecutive ordering of the coupling graph the same G_coupling = ig.Graph.Formula('1 -- 2 -- 3')
which yields me the diagonal coupling.
However, I want to add interlayer edges between node x in time layer 1(snapshot 1) and node y in time layer 2(snapshot 2) as well as the interlayer edges between node x in time layer 1 and node x in time layer 2, non-diagonal coupling i.e. I want to gain full control over the interlayer edges between consecutive snapshots so that the picture in the documentation looks something like this for example-- on top of the dashed edges in the original picture, I want to add red ones too into the graph.
In other words, I want to be able to pass a 2d-matrix for every interlayer edge instead of a constant, and a list(two cases which I know how to handle as I explained in the above two bullet points). This is probably possible via igraph
(by passing one big supra-adjacency matrix), but I don't know how it would translate into your package.
Sorry to bug you over and over again!
Thank you
Ülgen
Sorry, I think I may have misunderstood your original question!
This is unfortunately not possible using any of the implemented methods. That is, you should construct all the appropriate graphs (i.e. intercoupling and other layers graphs) yourself. The methods of optimization will work correctly regardless.
You might want to explore the source code of slices_to_layers
for some inspiration how to generate the appropriate layers graphs for your usecase.
Hi
I'm trying out different configurations for interlayer edges using leidenalg, on k layers and n nodes let's say.
When the interslice_weight is a constant c in the input for time_slices_to_layers function, all interlayer edges gets coupled diagonally, i.e. every node gets connected to their future self with an edge weight c.
If the interslice_weight is a list (of length k-1) of lists (of length n), i.e. intersliceweight = [[C(1,1),..,C(1,n)],..,[C(k-1,1),..,C(k-1,n)]] all interlayer edges gets coupled diagonally_ again but with the option of varying interlayer edge weights C(i,j) where i in k-1 and j in n.
My question is, is there a way to add interlayer edges to the slice graph such that nodes are not only coupled with their future and past selves but also other node's future and/or past selves i.e. non-diagonal coupling?
Thank you
Ülgen