Skip to content

DevOps: migrate graph dependencies to igraph#36

Merged
martinctc merged 8 commits into
mainfrom
devops/migrate-graph-dependencies
Dec 18, 2020
Merged

DevOps: migrate graph dependencies to igraph#36
martinctc merged 8 commits into
mainfrom
devops/migrate-graph-dependencies

Conversation

@martinctc

@martinctc martinctc commented Dec 18, 2020

Copy link
Copy Markdown
Member

Summary

This branch migrates graph dependencies to igraph away from network to reduce package dependence risk, load time, and maintenance complexity.

The dstr package was used to help determine which dependencies would have greater 'impact' as the result of being removed.

Changes

The changes made in this PR are:

  1. Migrated network_g2g() and network_p2p() to an igraph implementation.
  2. Removed following package dependencies on:
  • network
  • GGally
  • widyr
  1. Created a custom data.table implementation of pairwise_count() that replaces the previous widyr::pairwise_count() used in tm_cooc().

Check

  • All R CMD checks pass
  • Breaking changes to arguments are properly documented.

Changes in argument

For network_p2p() - old implementation:

network_p2p(
  data,
  hrvar,
  return = "pdf",
  path = "network_p2p",
  bg_fill = "#000000",
  font_col = "#FFFFFF",
  legend_pos = "bottom",
  palette = "rainbow",
  ...
)

New implementation:

network_p2p(
  data,
  hrvar,
  return = "pdf",
  path = "network_p2p",
  bg_fill = "#000000",
  font_col = "#FFFFFF",
  legend_pos = "bottom",
  palette = "rainbow",
  node_alpha = 0.7,
  algorithm = "fr"
)

There are some changes to the range of node placement algorithms, which is now more dependent on igraph rather than sna. See https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html for algorithm options.

Only the ... argument is removed for network_g2g(). For both functions, an igraph graph object is now returned instead of a network object.

Visual contrast

Using network::network() and GGally::ggnet2():
image

Using new igraph implementation:
image

Note

This addresses the load time issue referenced in #16.

@martinctc martinctc added spike enhancements that would take longer to implement refactor Code that neither fixes a bug nor changes feature labels Dec 18, 2020
@martinctc martinctc requested a review from m-m-powers December 18, 2020 11:10
@martinctc martinctc self-assigned this Dec 18, 2020
@martinctc martinctc marked this pull request as ready for review December 18, 2020 14:45
@martinctc martinctc merged commit 95c621a into main Dec 18, 2020
@martinctc martinctc deleted the devops/migrate-graph-dependencies branch December 18, 2020 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code that neither fixes a bug nor changes feature spike enhancements that would take longer to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant