forked from se-sic/coronet
-
Notifications
You must be signed in to change notification settings - Fork 0
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 se-sic#138. Signed-off-by: Maximilian Löffler <[email protected]>
- Loading branch information
1 parent
d9a4be4
commit 0c2f47c
Showing
1 changed file
with
52 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,58 @@ test_that("Remove isolated authors given a specific edge type", { | |
|
||
}) | ||
|
||
test_that("Remove duplicate edges", { | ||
|
||
## | ||
## Remove duplicate edges from a network | ||
## | ||
|
||
## configurations | ||
proj.conf = ProjectConf$new(CF.DATA, CF.SELECTION.PROCESS, CASESTUDY, ARTIFACT) | ||
net.conf = NetworkConf$new() | ||
net.conf$update.values(list("author.respect.temporal.order" = TRUE, author.directed = FALSE)) | ||
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) | ||
|
||
## | ||
## Attempt to remove non-existent duplicate edges should not change anything | ||
## | ||
|
||
assert.networks.equal(network.built, remove.duplicate.edges(network.built)) | ||
|
||
}) | ||
|
||
|
||
## / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / | ||
## Merge ------------------------------------------------------------------- | ||
|