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

feat: adds @cosmograph-org/cosmo GPU layout #9

Merged
merged 24 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e20d251
docs: removes solved todo
daniloimparato Oct 2, 2024
34085f9
Merge branch 'main' of https://github.com/daniloimparato/easylayout
daniloimparato Oct 2, 2024
3f8379a
chore: ignoring .vscode
daniloimparato Oct 3, 2024
a9001bd
wip: implements simulation wrapper to include cosmo
daniloimparato Oct 3, 2024
8b77516
feat: introduces cosmo through unified wrapper interface
daniloimparato Oct 4, 2024
eee5a69
docs: adds screenshot to readme
daniloimparato Oct 5, 2024
57a0f90
fix: fixes the worst typo of my life
daniloimparato Oct 5, 2024
967212b
docs: idk where this came from
daniloimparato Oct 5, 2024
dcf7390
refactor: removes logging from editor
daniloimparato Oct 5, 2024
cd5e610
refactor: editor pans instead of zooming when centering canvas
daniloimparato Oct 5, 2024
fbf4af9
refactor: rewrites layout effectors for d3
daniloimparato Oct 5, 2024
1a1d419
refactor: giving up on centering viva for now
daniloimparato Oct 5, 2024
8f8fc6e
refactor: lowers number of iterations for fr precomputation
daniloimparato Oct 5, 2024
ea4c927
refactor: rewrites and reformats settings file
daniloimparato Oct 5, 2024
5804500
feat: overhauls cosmo's size and coordinate system
daniloimparato Oct 5, 2024
78599ae
refactor: gets rid of flowbite-svelte range
daniloimparato Oct 5, 2024
ce5c6ec
fix: allows vertical scrolling for sidebar
daniloimparato Oct 5, 2024
a25979e
fix: slider input was string
daniloimparato Oct 5, 2024
ea17b17
wip: attempting to remove cosmo's labels
daniloimparato Oct 5, 2024
4a7e017
feat: bumps alpha after updating layout parameter
daniloimparato Oct 5, 2024
3c84770
feat: introduces all of d3 and cosmo forces
daniloimparato Oct 5, 2024
4057d91
docs: removes img alt text
daniloimparato Oct 5, 2024
13ba6dc
build: bump dist
daniloimparato Oct 5, 2024
eeee26b
build: usethis::use_package("tidyselect")
daniloimparato Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.vscode

# Temp
inst/temp

Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Imports:
dplyr,
igraph,
jsonlite,
shiny
shiny,
tidyselect
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Expand Down
16 changes: 13 additions & 3 deletions R/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,19 @@ start_app <- function(graph, layout) {

igraph::V(graph)$component <- flag_for_grouping

selected_node_cols <- graph |>
igraph::as_data_frame("vertices") |>
dplyr::select(
id = name,
initialX = x,
initialY = y,
component,
tidyselect::any_of(c("color", "size"))
)

graph_json <- jsonlite::toJSON(list(
nodes = igraph::as_data_frame(graph, "vertices"),
links = igraph::as_data_frame(graph, "edges")
nodes = selected_node_cols,
links = igraph::as_data_frame(graph, "edges")[, 1:2]
))

server <- function(input, output, session) {
Expand Down Expand Up @@ -155,7 +165,7 @@ precompute_layout <- function(graph, cols) {

similarity_layout <- igraph::layout_with_fr(
graph = similarity_graph,
niter = 1000
niter = 500
) * LAYOUT_SIZE_FACTOR

# Centers layout around origin = [0, 0]
Expand Down
29 changes: 16 additions & 13 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/dalmolingroup/easylayout/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dalmolingroup/easylayout/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

easylayout is an R package that seamlessly bridges manipulation and
visualization by leveraging the user's IDE itself (e.g., RStudio, VSCode). It
is **not** yet another visualization library, but instead aims to interconnect
existing libraries and streamline their usage into the R ecosystem. easylayout
takes an igraph object and serializes it into a web application integrated with
the IDE's interface through a Shiny server. The web application lays out the
network by simulating attraction and repulsion forces. Simulation parameters
can be adjusted in real-time. An editing mode allows moving and rotating nodes.
The implementation aims for performance, so that even lower-end devices are
able to work with relatively large networks. Once the user finishes tinkering
the layout, it is sent back to the R session to be plotted through popular
libraries like ggplot2 or even the base package itself.
easylayout is an R package that leverages interactive force simulations within
the IDE itself (e.g., RStudio, VSCode). It is **not** yet another visualization
library, but instead aims to interconnect existing libraries and streamline
their usage into the R ecosystem.

![](https://github.com/user-attachments/assets/1b91cb11-77ef-47a5-b529-3805a9785a76)

easylayout takes an igraph object and serializes it into a web application
integrated with the IDE's interface through a Shiny server. The web application
lays out the network by simulating attraction and repulsion forces. Simulation
parameters can be adjusted in real-time. An editing mode allows moving and
rotating nodes. The implementation aims for performance, so that even lower-end
devices are able to work with relatively large networks. Once the user finishes
tinkering the layout, it is sent back to the R session to be plotted through
popular libraries like ggplot2 or even the base package itself.

## Installation

Expand All @@ -57,7 +60,7 @@ igraph::V(g)$label <- NA
igraph::V(g)$size <- sample(1:5, number_of_vertices, replace = TRUE)
igraph::V(g)$color <- sample(rainbow(5), number_of_vertices, replace = TRUE)

plot(g, layout = easylayout)
plot(g, layout = easylayout, vertex.label = NA, margin = 0)
```

## Future work
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
[![R-CMD-check](https://github.com/dalmolingroup/easylayout/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dalmolingroup/easylayout/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

easylayout is an R package that seamlessly bridges manipulation and
visualization by leveraging the user’s IDE itself (e.g., RStudio,
VSCode). It is **not** yet another visualization library, but instead
aims to interconnect existing libraries and streamline their usage into
the R ecosystem. easylayout takes an igraph object and serializes it
into a web application integrated with the IDE’s interface through a
Shiny server. The web application lays out the network by simulating
attraction and repulsion forces. Simulation parameters can be adjusted
in real-time. An editing mode allows moving and rotating nodes. The
implementation aims for performance, so that even lower-end devices are
able to work with relatively large networks. Once the user finishes
tinkering the layout, it is sent back to the R session to be plotted
through popular libraries like ggplot2 or even the base package itself.
easylayout is an R package that leverages interactive force simulations
within the IDE itself (e.g., RStudio, VSCode). It is **not** yet another
visualization library, but instead aims to interconnect existing
libraries and streamline their usage into the R ecosystem.

![](https://github.com/user-attachments/assets/1b91cb11-77ef-47a5-b529-3805a9785a76)

easylayout takes an igraph object and serializes it into a web
application integrated with the IDE’s interface through a Shiny server.
The web application lays out the network by simulating attraction and
repulsion forces. Simulation parameters can be adjusted in real-time. An
editing mode allows moving and rotating nodes. The implementation aims
for performance, so that even lower-end devices are able to work with
relatively large networks. Once the user finishes tinkering the layout,
it is sent back to the R session to be plotted through popular libraries
like ggplot2 or even the base package itself.

## Installation

Expand Down Expand Up @@ -48,7 +51,7 @@ igraph::V(g)$label <- NA
igraph::V(g)$size <- sample(1:5, number_of_vertices, replace = TRUE)
igraph::V(g)$color <- sample(rainbow(5), number_of_vertices, replace = TRUE)

plot(g, layout = easylayout)
plot(g, layout = easylayout, vertex.label = NA, margin = 0)
```

## Future work
Expand Down
2 changes: 1 addition & 1 deletion inst/www/assets/index.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions inst/www/browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading