Skip to content

Commit

Permalink
Add implemention of multi-edge-networks for author and artifact networks
Browse files Browse the repository at this point in the history
Now, it is possible to construct networks which include more than one
artifact and author relation.

To provide this functionality, the allowed number of the
'author.relation' and the 'artifact.relation'
is changed to Inf instead of 1.
A further edge attribute 'relation' is added to describe the relation
type. The functions 'get.artifact.network' and 'get.author.network' are
changed to handle more than one relation. Therefore, the functions
'get.bipartite.network' and 'get.multi.network' are adjusted, too. The
functions use the 'add.edges.for.bipartite.relations' function which can
handle more than one relation now.
To merge the networks of all relations, we add the functions
'merge.network.data' and 'merge.networks'. The function
'construct.network.from.list' is split into to functions
'construct.edge.list.from.key.value.list' and
'construct.network.from.edge.list'.

Solves the second part of se-sic#98.

Signed-off-by: Barbara Eckl <[email protected]>
Signed-off-by: Claus Hunsen <[email protected]>
  • Loading branch information
ecklbarb authored and fehnkera committed Sep 23, 2020
1 parent bf2806a commit 6226cbb
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 340 deletions.
1 change: 1 addition & 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", {
artifact.type = c("Feature", "Feature"),
artifact = c("Base_Feature", "foo"),
weight = c(1, 1),
relation = c("cochange", "cochange"),
type = TYPE.EDGES.INTRA)

## build expected network
Expand Down
24 changes: 19 additions & 5 deletions tests/test-networks-author.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ test_that("Network construction of the undirected author-cochange network", {
artifact.type = c("Feature", "Feature", "Feature", "Feature", "Feature", "Feature", "Feature", "Feature"),
artifact = c("A", "A", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature", "Base_Feature"),
weight = c(1, 1, 1, 1, 1, 1, 1, 1),
type = TYPE.EDGES.INTRA
type = TYPE.EDGES.INTRA,
relation = c("cochange", "cochange", "cochange", "cochange", "cochange", "cochange", "cochange", "cochange")
)

## build expected network
Expand Down Expand Up @@ -262,7 +263,8 @@ test_that("Network construction of the directed author-cochange network", {
artifact.type = c("Feature", "Feature", "Feature", "Feature"),
artifact = c("A", "Base_Feature", "Base_Feature", "Base_Feature"),
weight = c(1, 1, 1, 1),
type = TYPE.EDGES.INTRA
type = TYPE.EDGES.INTRA,
relation = c("cochange", "cochange", "cochange", "cochange")
)

## build expected network
Expand Down Expand Up @@ -302,7 +304,8 @@ test_that("Network construction of the undirected simplified author-cochange net
artifact.type = I(list(c("Feature", "Feature"), c("Feature", "Feature"), c("Feature", "Feature"), c("Feature", "Feature"))),
artifact = I(list(c("A", "A"), c("Base_Feature", "Base_Feature"), c("Base_Feature", "Base_Feature"), c("Base_Feature", "Base_Feature"))),
weight = c(2, 2, 2, 2),
type = TYPE.EDGES.INTRA
type = TYPE.EDGES.INTRA,
relation = c("cochange", "cochange", "cochange", "cochange")
)

## build expected network
Expand Down Expand Up @@ -399,7 +402,17 @@ test_that("Network construction of the undirected author-issue network with all
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1 ),
type = TYPE.EDGES.INTRA)
type = TYPE.EDGES.INTRA,
relation = c("issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue", "issue",
"issue", "issue", "issue", "issue")
)

network.expected = igraph::graph.data.frame(edges, directed = FALSE, vertices = vertices)

Expand Down Expand Up @@ -442,7 +455,8 @@ test_that("Network construction of the undirected author-issue network with just
"commented", "commented", "commented", "commented", "commented", "commented",
"commented", "commented", "commented", "commented", "commented", "commented" ),
weight = c(1),
type = TYPE.EDGES.INTRA)
type = TYPE.EDGES.INTRA,
relation = c("issue"))

network.expected = igraph::graph.data.frame(edges, directed = FALSE, vertices = vertices)

Expand Down
Loading

0 comments on commit 6226cbb

Please sign in to comment.