Skip to content

Commit

Permalink
Merge pull request #274 from maxloeffler/dev
Browse files Browse the repository at this point in the history
Change default representation of edge attributes from vectors to lists & other miscellaneous adjustments

Reviewed-by: Thomas Bock <bockthom@cs.uni-saarland.de>
  • Loading branch information
bockthom authored Jan 14, 2025
2 parents 751b72f + 0cc59bc commit 58f66cf
Show file tree
Hide file tree
Showing 20 changed files with 646 additions and 414 deletions.
11 changes: 10 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## unversioned

### Announcement

- Coronet is not compatible with `igraph` versions below 2.1.0 anymore. This is due to the simultaneous deprecation of `subgraph.edges` and the introduction of the replacement for it, `subgraph_from_edges`, in igraph version 2.1.0.

### Added

- Add commit-interaction data and add functions `read.commit.interactions` for reading, as well as `get.commit.interactions`, `set.commit.interactions` and utility functions for working with commit-interaction data (PR #252, d82857fbebd1111bb16588a4223bb24a8dcd07de, b4fd2a29c9b5fd561b1106c6febb54a32b0085ab, fd0aa05f824b93545ae8e05833b95b3bd9809286, bca35760eb0aac86c04923f2d534b2d8cece204e, PR #263, 849123a8b7d898fbb1343745ecffc1f6000c9367, 3fb7437b68950303916b62984fa449732c70353e, 170bc66eb779d7cf2ab504db7c3f4ec483103838) as well as tests for these features (PR #252, eeba7e29932bc973513c963fb9e716e9230d570f, 8bb39f4df39b49dfaff8f19feb6db5e5fbd81fac, 54b6f655248720436af116fe72521f9cb0348429, 7a5497aaf9114017d1b3b9b68b6cccd7ca8ac114, 7b8585f87675795822c07230192d6454de31dcc7, ef725407bf8818c8fff96ea6f343338b7162cbe0,)
Expand All @@ -18,16 +22,21 @@

### Changed/Improved

- **Breaking Change**: Change the default representation of edge attributes from vectors to lists. This change is necessary for the interplay of coronet networks with certain `igraph` functionality since igraph version 2.1.0 (PR #274, 1c35d1fa2548deb297dbfa5e2b07fce31962c5b7, eda30b838369ec46376812298a3ea8159eec5789, 0c6b2eba79b37f8ef2af7ffc41d86f1f307581bf, 44c7b72e3234cb332bb2713fb408c124e67255d9, 7303eabef6a78198575fe5bdfc02813fde3d3974, 0c27012641d24e19e5fa037406b480034c93f1aa)
- Change the default value for the `issues.from.source` configuration parameter. Instead of reading JIRA and GitHub issues together, which was the previous default, the new default value causes only GitHub issue data to be read. To restore the previous default behavior and read data from both issue sources, this now needs to be manually configured when needed. (PR #264, 5ff83c364f6bfc1e6ff95e9c5f1087e031c48a5d, 8c8080cb9caf115f19d9f145ad6e6c108b131a67, 8bcbc81db521877908d2e5c2989082ed672f2a3b)
- Replace deprecated `igraph` functions by their preferred alternatives (PR #264, PR #268, 0df9d5bf6bafbb5d440f4c47db4ec901cf11f037, 7ac840d287a862eff61b1a84e194a4cba399f9e5)
- Replace deprecated `igraph` functions by their preferred alternatives (PR #264, PR #268, PR #274, 0df9d5bf6bafbb5d440f4c47db4ec901cf11f037, 7ac840d287a862eff61b1a84e194a4cba399f9e5, e3617b8c6b21fb4242c1d392124813501069ca84, 4b0d5221dd56bb3c9ddf196f67719d4f503d9b61)
- Deprecate support for R version 3.6 (PR #264, c8e6f45111e487fadbe7f0a13c7595eb23f3af6e, fb3f5474259d4a88f4ff545691cca9d1ccde90e3)
- Explicitly add R version 4.4 to the CI test pipeline (c8e6f45111e487fadbe7f0a13c7595eb23f3af6e)
- Refactor function `construct.edge.list.from.key.value.list` to be more readable (PR #263, 05c3bc09cb1d396fd59c34a88030cdca58fd04dd)
- Update necessary `igraph` version to 2.1.0 in `README.md` (PR #274, 6c3bcd1a2366d0d3a176d9fde95b8356b0158da3)

### Fixed

- Fix the creation of edgelists for issue-based artifact-networks by correctly iterating over the issue data (PR #264, 321d85043112971c04998249c14a0677a32c9004)
- Fix a bug in `extract.timestamps` that occurs when the first `data.source` contains empty data and that leads to a return value of type numeric which should be POSIXct (PR #270, 10696e4cf4ae92371917ed8ccaec2b0183da145c, 646c01a42ad8decfbc9040030e790e51cb65cffd)
- Fix `read.commit.interactions` by explicitly considering non-existent commit interactions (PR #274, f591528a0f1f11b1a4390949ab770f3f74a766f9)
- Add range information to network-splits when splitting a network using `split.network.time.based.by.ranges`. This effect also propagates into `split.networks.time.based` (PR #274, 87911ade231c44b93be194a1d6734f7de043a4af)
- Adjust `metrics.scale.freeness` and `metrics.is.scale.free` functions to be compatible with both older and newer igraph versions (PR #274, 4b0d5221dd56bb3c9ddf196f67719d4f503d9b61)

## 4.4

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Alternatively, you can run `Rscript install.R` to install the packages.

- `yaml`: To read YAML configuration files (i.e., Codeface configuration files)
- `R6`: For proper classes
- `igraph`: For the construction of networks (package version `1.3.0` or higher is recommended)
- `igraph`: For the construction of networks (package version `2.1.0` or higher is required)
- `plyr`: For the `dlply` splitting-function and `rbind.fill`
- `parallel`: For parallelization
- `logging`: Logging
Expand Down
2 changes: 1 addition & 1 deletion showcase.R
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ plot.network(g.simplified)

## construct sample network for plotting
g = get.sample.network()
g = igraph::as.directed(g, mode = "arbitrary")
g = igraph::as_directed(g, mode = "arbitrary")
g = g + igraph::edges("A6", "A5", type = TYPE.EDGES.INTRA, weight = 2,
relation = "callgraph", artifact.type = "Feature")
g = simplify.network(g)
Expand Down
5 changes: 5 additions & 0 deletions tests/test-networks-artifact.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ test_that("Network construction of the undirected artifact-cochange network", {
)
## 3) build expected network
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)


##
Expand Down Expand Up @@ -158,6 +159,7 @@ patrick::with_parameters_test_that("Network construction of an issue-based artif

## build expected network
network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

## build network
network.built = network.builder$get.artifact.network()
Expand Down Expand Up @@ -207,6 +209,7 @@ patrick::with_parameters_test_that("Network construction of an empty 'comments-o

## build expected network
network.expected = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

## test
assert.networks.equal(network.built, network.expected)
Expand Down Expand Up @@ -258,6 +261,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)
network = convert.edge.attributes.to.list(network)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
Expand Down Expand Up @@ -308,6 +312,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)
network = convert.edge.attributes.to.list(network)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
Expand Down
35 changes: 22 additions & 13 deletions tests/test-networks-author.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ test_that("Network construction of the undirected author-cochange network", {
)
## 3) build expected network
network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors)
network.expected = convert.edge.attributes.to.list(network.expected)


##
Expand Down Expand Up @@ -316,6 +317,7 @@ test_that("Network construction of the undirected but temorally ordered author-c

## build expected network
network.expected = igraph::graph_from_data_frame(data, directed = FALSE, vertices = authors)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -357,6 +359,7 @@ test_that("Network construction of the directed author-cochange network", {

## build expected network
network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -403,6 +406,7 @@ test_that("Network construction of the directed author-cochange network without

## build expected network
network.expected = igraph::graph_from_data_frame(data, directed = TRUE, vertices = authors)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -431,25 +435,26 @@ test_that("Network construction of the undirected simplified author-cochange net
date.attr = igraph::edge_attr(network.built, "date")
date.conversion.function = ifelse(all(sapply(date.attr, lubridate::is.POSIXct)),
get.date.from.unix.timestamp, identity)
date.conversion.function = get.date.from.unix.timestamp

## edge attributes
data = data.frame(
from = c("Björn", "Olaf", "Olaf", "Karl"),
to = c("Olaf", "Karl", "Thomas", "Thomas"),
date = I(list(date.conversion.function(c(1468339139, 1468339245)),
date.conversion.function(c(1468339541, 1468339570)),
date.conversion.function(c(1468339541, 1468339592)),
date.conversion.function(c(1468339570, 1468339592)))),
artifact.type = I(list(c("Feature", "Feature"), c("Feature", "Feature"), c("Feature", "Feature"),
c("Feature", "Feature"))),
date = I(list(as.list(date.conversion.function(c(1468339139, 1468339245))),
as.list(date.conversion.function(c(1468339541, 1468339570))),
as.list(date.conversion.function(c(1468339541, 1468339592))),
as.list(date.conversion.function(c(1468339570, 1468339592))))),
artifact.type = I(list(list("Feature", "Feature"), list("Feature", "Feature"), list("Feature", "Feature"),
list("Feature", "Feature"))),
hash = I(list(
c("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"),
c("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"),
c("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"),
c("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"))),
file = I(list(c("test.c", "test.c"), c("test2.c", "test3.c"), c("test2.c", "test2.c"), c("test3.c", "test2.c"))),
artifact = I(list(c("A", "A"), c("Base_Feature", "Base_Feature"), c("Base_Feature", "Base_Feature"),
c("Base_Feature", "Base_Feature"))),
list("72c8dd25d3dd6d18f46e2b26a5f5b1e2e8dc28d0", "5a5ec9675e98187e1e92561e1888aa6f04faa338"),
list("3a0ed78458b3976243db6829f63eba3eead26774", "1143db502761379c2bfcecc2007fc34282e7ee61"),
list("3a0ed78458b3976243db6829f63eba3eead26774", "0a1a5c523d835459c42f33e863623138555e2526"),
list("1143db502761379c2bfcecc2007fc34282e7ee61", "0a1a5c523d835459c42f33e863623138555e2526"))),
file = I(list(list("test.c", "test.c"), list("test2.c", "test3.c"), list("test2.c", "test2.c"), list("test3.c", "test2.c"))),
artifact = I(list(list("A", "A"), list("Base_Feature", "Base_Feature"), list("Base_Feature", "Base_Feature"),
list("Base_Feature", "Base_Feature"))),
weight = 2,
type = TYPE.EDGES.INTRA,
relation = "cochange"
Expand Down Expand Up @@ -589,6 +594,7 @@ test_that("Network construction of the undirected author-issue network with all

## build expected network
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -649,6 +655,7 @@ test_that("Network construction of the undirected author-issue network with just

## build expected network
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -677,6 +684,7 @@ test_that("Network construction with only untracked files (no edges expected)",
vertices = list(name = c("Karl", "Thomas"), kind = TYPE.AUTHOR, type = TYPE.AUTHOR)
network.expected = create.empty.network(directed = FALSE, add.attributes = TRUE)
network.expected = igraph::add_vertices(network.expected, nv = max(lengths(vertices)), attr = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

## test
expect_true(igraph::identical_graphs(network.built, network.expected))
Expand Down Expand Up @@ -726,6 +734,7 @@ patrick::with_parameters_test_that("Network construction with commit-interaction
relation = c("commit.interaction", "commit.interaction", "commit.interaction", "commit.interaction")
)
network = igraph::graph_from_data_frame(edges, directed = test.directed, vertices = vertices)
network = convert.edge.attributes.to.list(network)

expect_true(igraph::identical_graphs(network.built, network))
}, patrick::cases(
Expand Down
10 changes: 10 additions & 0 deletions tests/test-networks-bipartite.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ test_that("Construction of the bipartite network for the feature artifact with a
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -137,6 +138,7 @@ test_that("Construction of the bipartite network for the file artifact with auth
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -189,6 +191,7 @@ test_that("Construction of the bipartite network for the function artifact with
)
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, directed = net.conf$get.value("author.directed"), vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -240,6 +243,7 @@ test_that("Construction of the bipartite network for the featureexpression artif
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -309,6 +313,7 @@ test_that("Construction of the bipartite network for the feature artifact with a
)
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, directed = net.conf$get.value("author.directed"), vertices = vertices)
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -362,6 +367,7 @@ test_that("Construction of the directed bipartite network for the feature artifa
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -415,6 +421,7 @@ test_that("Construction of the directed bipartite network for the file artifact
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -469,6 +476,7 @@ test_that("Construction of the directed bipartite network for the function artif
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -521,6 +529,7 @@ test_that("Construction of the directed bipartite network for the featureexpress
## 3) construct expected network
network.expected = igraph::graph_from_data_frame(network.expected.data, vertices = vertices,
directed = net.conf$get.value("author.directed"))
network.expected = convert.edge.attributes.to.list(network.expected)

expect_true(igraph::identical_graphs(network.built, network.expected))
})
Expand Down Expand Up @@ -563,6 +572,7 @@ test_that("Network construction with only untracked files (no edges and artifact
directed = net.conf$get.value("author.directed"))
## 4) remove edge again
network.expected = igraph::delete_edges(network.expected, 1)
network.expected = convert.edge.attributes.to.list(network.expected)

## test
expect_true(igraph::identical_graphs(network.built, network.expected))
Expand Down
Loading

0 comments on commit 58f66cf

Please sign in to comment.