Skip to content

Commit

Permalink
Change vertex kind for artifact networks
Browse files Browse the repository at this point in the history
vertices now have the correct 'kind' attribute
also restructured if statements in artifact network construction

Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
  • Loading branch information
Leo-Send committed Mar 8, 2024
1 parent 0b59620 commit d96b10b
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions util-networks.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ NetworkBuilder = R6::R6Class("NetworkBuilder",
callgraph = private$proj.data$get.project.conf.entry("artifact.codeface"),
mail = "MailThread",
issue = "Issue",
interaction = "Interaction"
interaction = private$proj.data$get.project.conf.entry("artifact.codeface")
)

return(vertex.kind)
Expand Down Expand Up @@ -388,8 +388,8 @@ NetworkBuilder = R6::R6Class("NetworkBuilder",

## set 'to' and 'from' of the network according to the config
## and order the dataframe accordingly
proj.conf = private$proj.data$get.project.conf()
if (proj.conf$get.value("artifact") == "file") {
proj.conf.artifact = private$proj.data$get.project.conf.entry("artifact")
if (proj.conf.artifact == "file") {
## change the vertices to the functions from the commit-interaction data
vertices = unique(c(private$proj.data$get.commit.interactions()[["base.file"]],
private$proj.data$get.commit.interactions()[["file"]]))
Expand All @@ -398,23 +398,21 @@ NetworkBuilder = R6::R6Class("NetworkBuilder",
edges = edges[, c("file", "base.file", "func", "commit.hash",
"base.hash", "base.func", "base.author", "interacting.author")]
colnames(edges)[4] = "hash"
} else if (proj.conf.artifact == "function") {
## change the vertices to the functions from the commit-interaction data
vertices = unique(c(private$proj.data$get.commit.interactions()[["base.func"]],
private$proj.data$get.commit.interactions()[["func"]]))
vertices = data.frame(name = vertices)

edges = edges[, c("func", "base.func", "commit.hash", "file", "base.hash",
"base.file", "base.author", "interacting.author")]
colnames(edges)[3] = "hash"
} else {
if (proj.conf$get.value("artifact") == "function") {
## change the vertices to the functions from the commit-interaction data
vertices = unique(c(private$proj.data$get.commit.interactions()[["base.func"]],
private$proj.data$get.commit.interactions()[["func"]]))
vertices = data.frame(name = vertices)

edges = edges[, c("func", "base.func", "commit.hash", "file", "base.hash",
"base.file", "base.author", "interacting.author")]
colnames(edges)[3] = "hash"
} else {
## if neither 'function' nor 'file' was configured, send a warning
## and return an empty network
logging::logwarn("when creating a commit-interaction artifact network,
the artifact relation should be either 'file' or 'function'!")
return(create.empty.network(directed = private$network.conf$get.value("artifact.directed")))
}
## if neither 'function' nor 'file' was configured, send a warning
## and return an empty network
logging::logwarn("when creating a commit-interaction artifact network,
the artifact relation should be either 'file' or 'function'!")
return(create.empty.network(directed = private$network.conf$get.value("artifact.directed")))
}
colnames(edges)[1] = "to"
colnames(edges)[2] = "from"
Expand Down

0 comments on commit d96b10b

Please sign in to comment.