igraph / rigraph

igraph R package
https://r.igraph.org
567 stars 204 forks source link

layout_with_kk #342

Closed iaconogi closed 3 years ago

iaconogi commented 5 years ago

Layout_with_kk does not work properly anymore. Even when setting weights=NULL or weights=NA the layout is completely messed up I am the developer of bigSCale2 and the pseudotime plot was based on igraph .... Thanks for the help

szhorvat commented 5 years ago

Can you show a short self-contained example that illustrates the problem?

szhorvat commented 5 years ago

I'm afraid we would not be able to help unless you provide precise and concrete steps to reproduce the problem (including the igraph version you are using).

iaconogi commented 5 years ago

Dear Szabolcs, I have the graph saved as R object, I have the command line I used to make the plot in attachment (do not look the colors, just the layout)

Il giorno gio 20 giu 2019 alle ore 13:06 Szabolcs Horvát < notifications@github.com> ha scritto:

I'm afraid we would not be able to help unless you provide precise and concrete steps to reproduce the problem (including the igraph version you are using).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/igraph/rigraph/issues/342?email_source=notifications&email_token=AHNQKZUAJ5MQEW6GAQSO3WTP3NQEBA5CNFSM4HXIW7LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYFCZTI#issuecomment-503983309, or mute the thread https://github.com/notifications/unsubscribe-auth/AHNQKZUA5NYRBKTZPFUWHSTP3NQEBANCNFSM4HXIW7LA .

szhorvat commented 5 years ago

I'm afraid the attachment is not present. You need to upload it directly on GitHub, not send it by email.

iaconogi commented 5 years ago

Dear Szabolcs, I really appreciate your help and sorry for the time I wasted with my previous mails. Here's a self contained example. I have a graph in the R object (named minST, in minST.rds in attachment). This is the same graph which, in the past, was producing the nice layout1 (layout1.png) with kamda kawaii layout, which was used inside the bigSCale2 package of which I am the developer (https://github.com/iaconogi/bigSCale2).

layout=layout_with_kk(graph = minST,weights = E(minST)$weight)

Now, with the same command, I get the ugly layout2.png. It seemed to me the kk force/repulsion did not work well anymore. I spent days trying to fix it, using all sorts of combinations with the edge weights (no weights, weights to 1, inverted and so on ...). I was never able to reproduce the initial layout. I tried using older version of the package and weirdly enough that did not help too :-/ Eventually, I was able to make something similar to layout1 (layout3, altought not as good as) by running a two step layout with:

layout=layout_with_fr(minST,weights = 1/ E(minST)$weight ,niter = 50000) layout=layout_with_kk(minST,weights = NA,coords = layout)

So first I do FR to kind of "unfold" the graph, then I separate the nodes with KK. Still the result is not as good as the old, single KK layout. Any idea?

P.S. Do not pay attention to node colouring of the plots, just the layout

Thank you very much for your time, Best Giovanni


sessionInfo() R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 [4] LC_NUMERIC=C LC_TIME=Spanish_Spain.1252

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] igraph_1.2.4.1 bigSCale_1.5 SingleCellExperiment_1.6.0 [4] SummarizedExperiment_1.14.0 DelayedArray_0.10.0 BiocParallel_1.17.18 [7] matrixStats_0.54.0 Biobase_2.44.0 GenomicRanges_1.36.0 [10] GenomeInfoDb_1.20.0 IRanges_2.18.0 S4Vectors_0.22.0 [13] BiocGenerics_0.30.0

loaded via a namespace (and not attached): [1] progress_1.2.2 zoo_1.8-6 tidyselect_0.2.5 purrr_0.3.2 [5] lattice_0.20-38 V8_2.2 colorspace_1.4-1 viridisLite_0.3.0 [9] yaml_2.2.0 rlang_0.3.4 pillar_1.4.1 glue_1.3.1 [13] RcppZiggurat_0.1.5 randomcoloR_1.1.0 GenomeInfoDbData_1.2.1 plyr_1.8.4 [17] stringr_1.4.0 zlibbioc_1.30.0 munsell_0.5.0 gtable_0.3.0 [21] curl_3.3 BioQC_1.12.0 Rfast_1.9.4 Rcpp_1.0.1 [25] scales_1.0.0 jsonlite_1.6 XVector_0.24.0 gridExtra_2.3 [29] ggplot2_3.1.1 hms_0.4.2 stringi_1.4.3 Rtsne_0.15 [33] dplyr_0.8.1 grid_3.6.0 tools_3.6.0 bitops_1.0-6 [37] magrittr_1.5 RCurl_1.95-4.12 lazyeval_0.2.2 tibble_2.1.3 [41] cluster_2.0.8 crayon_1.3.4 pkgconfig_2.0.2 dendextend_1.12.0 [45] Matrix_1.2-17 prettyunits_1.0.2 assertthat_0.2.1 rstudioapi_0.10 [49] viridis_0.5.1 R6_2.4.0

Il giorno ven 28 giu 2019 alle ore 11:01 ns ct gio.iacono.work@gmail.com ha scritto:

Dear Szabolcs, I have the graph saved as R object, I have the command line I used to make the plot in attachment (do not look the colors, just the layout)

Il giorno gio 20 giu 2019 alle ore 13:06 Szabolcs Horvát < notifications@github.com> ha scritto:

I'm afraid we would not be able to help unless you provide precise and concrete steps to reproduce the problem (including the igraph version you are using).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/igraph/rigraph/issues/342?email_source=notifications&email_token=AHNQKZUAJ5MQEW6GAQSO3WTP3NQEBA5CNFSM4HXIW7LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYFCZTI#issuecomment-503983309, or mute the thread https://github.com/notifications/unsubscribe-auth/AHNQKZUA5NYRBKTZPFUWHSTP3NQEBANCNFSM4HXIW7LA .

szhorvat commented 5 years ago

I have a graph in the R object (named minST, in minST.rds in attachment).

What I was trying to say is that there is no attachment. Don't send emails. Use the GitHub interface. Otherwise, all attachments will be lost.

ntamas commented 3 years ago

The Kamada-Kawai layout implementation was changed somewhere between igraph 0.6 and 0.7 (if I remember correctly) because the original implementation did not follow the original Kamada-Kawai paper correctly. The new one is closer to what has been published.

Since this issue has been inactive for more than two years now, I'm closing it to clean up the issue tracker a bit.