Skip to content

Commit

Permalink
Fix minor issues from review for PR se-sic#140
Browse files Browse the repository at this point in the history
Fix minor documentation issues that have been pointed out by @bockthom
in his review on PR se-sic#140.

Additionally, rename function 'delete.authors.without.bipartite.edges'
to 'delete.authors.without.specific.edges' and allow both types of edges
via an argument.

Signed-off-by: Claus Hunsen <[email protected]>
  • Loading branch information
clhunsen authored and fehnkera committed Sep 23, 2020
1 parent b9a8edc commit 0327285
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

### Changed/Improved
- Add possibility to add multiple first activities for different activity types in one vertex attribute (#92, 04f18b3097d17fe6b3486c656a807133e0ac0a42)
- Add possibility to decide whether first activity should be computed per activity type oder over all activity types when added as vertex attribute (#92, , 86962a313ceeb09c0e0675dc509d91e10647d6b6)
- Add possibility to decide whether first activity should be computed per activity type or over all activity types when added as vertex attribute (#92, , 86962a313ceeb09c0e0675dc509d91e10647d6b6)
- Refactor computation of vertex attribute 'first.activity' for better performance (40b7d879e323275d308c408cca4913b805ddacf8, f5188904e51ddc08558842f6e357f8fa8edbb105)
- Move 'RELATION.TO.DATASOURCE' to module 'networks' (1ac09f64d202ba4279d05a9765bbbefdc57d4e1b)
- Determine list of artifacts more reasonably in ProjectData (#97, 23a8aa3e8b20cd0d735cb4987e4a397b922e01ad)
Expand Down
4 changes: 2 additions & 2 deletions util-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ ProjectData = R6::R6Class("ProjectData",

#' Get the list of artifacts from the given \code{data.source} of the project.
#'
#' @param data.source The specified data sources. One of \code{"commits"},
#' @param data.source The specified data source. One of \code{"commits"},
#' \code{"mails"}, and \code{"issues"}. [default: "commits"]
#'
#' @return the character vector of unique artifacts (can be empty)
Expand Down Expand Up @@ -866,7 +866,7 @@ ProjectData = R6::R6Class("ProjectData",

#' Map the authors corresponding to the given \code{data.source} to their touched artifacts.
#'
#' @param data.source The specified data sources. One of \code{"commits"},
#' @param data.source The specified data source. One of \code{"commits"},
#' \code{"mails"}, and \code{"issues"}. [default: "commits"]
#'
#' @return the list of authors for each artifact (with additional data)
Expand Down
2 changes: 1 addition & 1 deletion util-networks-covariates.R
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ add.vertex.attribute.artifact.first.occurrence = function(list.of.networks, proj
#'
#' @return A list with authors as keys and a POSIXct list in the following format as value:
#' - if \code{take.first.over.all.activity.types}, a one-element list named 'all.activities'
#' - otherwise, a list with length \code{length(acitivity.types)} and corresponding names
#' - otherwise, a list with length \code{length(activity.types)} and corresponding names
get.first.activity.data = function(range.data, activity.types = c("commits", "mails", "issues"),
take.first.over.all.activity.types = FALSE) {

Expand Down
25 changes: 21 additions & 4 deletions util-networks.R
Original file line number Diff line number Diff line change
Expand Up @@ -1324,16 +1324,33 @@ extract.bipartite.network.from.network = function(network) {
return(bip.network)
}

#' Delete author vertices from the given network that do not have bipartite edges.
#' Delete author vertices from the given network that do not have adjacent edges of a specific type,
#' i.e., bipartite and/or unipartite edges.
#'
#' *Use case*:
#' When building multi-networks, we can make use of the configuration option \code{author.only.committers}.
#' However, when we split a project-level multi-network into range-level networks, we can obtain authors
#' in a certain time-range, that are only active on the mailing list in this range, but appear in the
#' range-level multi-network as they appear in the project-level network since they are committer in,
#' at least, one range. This function is able to remove the then-isolated author vertices from the
#' range-level networks.
#'
#' @param network the network from which the author vertices are to be removed
#' @param specific.edge.types the type of edges an author vertex needs to have to retain in the network;
#' one or more of \code{TYPE.EDGES.INTER} and \code{TYPE.EDGES.INTRA}
#' [default: TYPE.EDGES.INTER]
#'
#' @return the network without author vertices lacking bipartite edges
delete.authors.without.bipartite.edges = function(network) {
#' @return the network without author vertices lacking edges of the specified
delete.authors.without.specific.edges = function(network, specific.edge.types =
c(TYPE.EDGES.INTER, TYPE.EDGES.INTRA)) {

## obtain the edge type to consider
edge.types = match.arg.or.default(specific.edge.types, several.ok = TRUE)

## get all authors
vertex.ids.author = as.numeric(igraph::V(network)[type == TYPE.AUTHOR])
## get vertex IDs of all vertices with bipartite edges
vertex.ids.bip = as.vector(igraph::get.edges(network, igraph::E(network)[type == TYPE.EDGES.INTER]))
vertex.ids.bip = as.vector(igraph::get.edges(network, igraph::E(network)[type %in% edge.types]))

## compute all authors without bipartite edges as vertex IDs
vertex.ids.author.no.bip = setdiff(vertex.ids.author, vertex.ids.bip)
Expand Down
4 changes: 2 additions & 2 deletions util-split.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ requireNamespace("lubridate") # for date conversion
#' @param time.period the time period describing the length of the ranges, a character string,
#' e.g., "3 mins" or "15 days"
#' @param bins the date objects defining the start of ranges (the last date defines the end of the last range, in an
#' *exclusive* manner). If set, the 'time.period' and 'bins' parameters is ignored; consequently, 'split.basis' and
#' *exclusive* manner). If set, the 'time.period' parameter is ignored; consequently, 'split.basis' and
#' 'sliding.window' do not make sense then either. [default: NULL]
#' @param number.windows the number of consecutive data objects to get from this function, implying an equally
#' @param number.windows the number of consecutive data objects to get from this function, implying equally
#' time-sized windows for all ranges. If set, the 'time.period' and 'bins' parameters are ignored;
#' consequently, 'split.basis' and 'sliding.window' do not make sense then either.
#' [default: NULL]
Expand Down

0 comments on commit 0327285

Please sign in to comment.