-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for 'remove.duplicate.edges'
Works towards #138. Signed-off-by: Maximilian Löffler <[email protected]>
- Loading branch information
1 parent
9f95d05
commit e777c93
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,6 +317,47 @@ test_that("Remove isolated authors given a specific edge type", { | |
|
||
}) | ||
|
||
test_that("Remove duplicate edges", { | ||
|
||
## configurations | ||
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT) | ||
net.conf = NetworkConf$new() | ||
net.conf$update.value("author.respect.temporal.order", TRUE) | ||
proj.data = ProjectData$new(project.conf = proj.conf) | ||
network.builder = NetworkBuilder$new(project.data = proj.data, network.conf = net.conf) | ||
network.builder$update.network.conf(updated.values = list(author.relation = "mail")) | ||
|
||
## construct data for expected network | ||
edges = data.frame(comb.1. = c("Björn", "Olaf", rep("Hans", 5)), | ||
comb.2. = c("Olaf", "Thomas", rep("Hans", 5)), | ||
date = get.date.from.string(c("2016-07-12 15:58:50", "2016-07-12 16:05:37", | ||
"2010-07-12 12:05:41", "2010-07-12 12:05:42", | ||
"2010-07-12 12:05:43", "2010-07-12 12:05:44", | ||
"2010-07-12 12:05:45")), | ||
artifact.type = rep("Mail", 7), | ||
message.id = c("<[email protected]>", | ||
"<[email protected]>", | ||
"<[email protected]>", "<[email protected]>", | ||
"<[email protected]>", "<[email protected]>", | ||
"<[email protected]>"), | ||
thread = c("<thread-13#8>", "<thread-13#9>", rep("<thread-42#6>", 5)), | ||
weight = rep(1, 7), | ||
type = rep(TYPE.EDGES.INTRA, 7), | ||
relation = rep("mail", 7)) | ||
vertices = data.frame(name = c("Björn", "udo", "Olaf", "Thomas", "Fritz [email protected]", "georg", "Hans"), | ||
kind = rep("Author", 7), | ||
type = rep("Author", 7)) | ||
|
||
## build expected network | ||
network.expected = igraph::graph_from_data_frame(edges, directed = FALSE, vertices = vertices) | ||
|
||
## build network with unique edges | ||
network = network.builder$get.author.network() | ||
network.built = remove.duplicate.edges(network) | ||
|
||
assert.networks.equal(network.expected, network.built) | ||
}) | ||
|
||
|
||
## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / | ||
## Merge ------------------------------------------------------------------- | ||
|