Skip to content

Commit

Permalink
Release 1.0.2, fixing and improving Hsu's transformation.
Browse files Browse the repository at this point in the history
  • Loading branch information
melvidoni committed Oct 8, 2018
1 parent 200058c commit 637c7bf
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 42 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rsppfp
Title: R's Shortest Path Problem with Forbidden Subpaths
Version: 1.0.0.0
Version: 1.0.2
Authors@R: c(person("Melina", "Vidoni", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-4099-1430")),
person("Aldo", "Vecchietti", email = "[email protected]", role = "aut"))
Maintainer: Melina Vidoni <[email protected]>
Expand Down
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
## RSPPFP 1.0.0.0
## RSPPFP 1.0.2
Stable release of advanced implementation of R-SPPFP, with minor bug fixes. Released October 2018.

### Minor Bug Fixes and Improvements
- Fixed Hsu's transformation: when having more than three columns (`from` and `to`, and an undefined number of attributes) the resulting `gStar` has the attributes in the correct order.
- Improved Hsu's transformation: previous to working, it deletes empty rows from the set of forbidden paths. Empty rows are those in which all of the cells contain either only blank spaces or `NA` values.


## RSPPFP 1.0.0
First stable release of advanced implementation of R-SPPFP, released on June 2018.

### Major Changes
Expand Down
17 changes: 10 additions & 7 deletions R/hsu.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ modify_graph_hsu <- function(g, f, cores = 1L) {
# Transform the graph
g$from <- as.character(g$from)
g$to <- as.character(g$to)
f[f == ""] <- NA

# Clean the forbidden paths
f <- as.data.frame( apply(f, 2, function(x) gsub("^$|^ $", NA, x)) )
f <- f[apply(f,1,function(x)any(!is.na(x))),]

# Get the number of columns
ncol <- ncol(g)
Expand Down Expand Up @@ -123,7 +126,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {

# Add the link to the predecesor, with all the attributes
if(ncol > 2) {
tempNewArcs[nrow(tempNewArcs) + 1,] <- list(preNode, nodeName, .get_arc_attributes(g, fps[i, j-1], fps[i, j]))
tempNewArcs[nrow(tempNewArcs) + 1,] <- c(preNode, nodeName, .get_arc_attributes(g, fps[i, j-1], fps[i, j]))
}
# Or without the attributes
else tempNewArcs[nrow(tempNewArcs) + 1,] <- list(preNode, nodeName)
Expand All @@ -145,7 +148,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {
if(!identical(newTo, character(0))) {
# Write that arc as well, with its attributes
if(ncol > 2) {
tempNewArcs[nrow(tempNewArcs) + 1,] <- list(nodeName, newTo,
tempNewArcs[nrow(tempNewArcs) + 1,] <- c(nodeName, newTo,
.get_arc_attributes(g, fps[i,j-1], fps[i,j]))
}
# Or without them
Expand Down Expand Up @@ -215,7 +218,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {
if(l == 2) {
# Add the link to the predecesor with its attributes
if(ncol > 2) {
tempNewArcs[nrow(tempNewArcs) + 1,] <- list(preNode, nodeName,
tempNewArcs[nrow(tempNewArcs) + 1,] <- c(preNode, nodeName,
.get_arc_attributes(g, f[k,l-1], f[k,l]))
}
# Or without them
Expand Down Expand Up @@ -250,7 +253,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {
else {
# Add the link to the predecesor, with its attributes
if(ncol > 2) {
tempNewArcs[nrow(tempNewArcs) + 1,] <- list(preNode, nodeName,
tempNewArcs[nrow(tempNewArcs) + 1,] <- c(preNode, nodeName,
.get_arc_attributes(g, f[k,l-1], f[k,l]))
}
# Or without them
Expand Down Expand Up @@ -328,7 +331,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {
if( !any(c(nsName, toNode) %in% secondOutput[[2]]) )
# Add it with its attributes
if(ncol > 2) {
newArcs[nrow(newArcs) + 1, ] <- list(nn, newTo, .get_arc_attributes(g, nsName, toNode))
newArcs[nrow(newArcs) + 1, ] <- c(nn, newTo, .get_arc_attributes(g, nsName, toNode))
}
# Or without them
else newArcs[nrow(newArcs) + 1, ] <- list(nn, newTo)
Expand All @@ -340,7 +343,7 @@ modify_graph_hsu <- function(g, f, cores = 1L) {

# Add the new link, but with the original node and its attributes
if(ncol > 2) {
newArcs[nrow(newArcs) + 1, ] <- list(nn, toNode, .get_arc_attributes(g, nsName, toNode)) }
newArcs[nrow(newArcs) + 1, ] <- c(nn, toNode, .get_arc_attributes(g, nsName, toNode)) }
# Or without them
else newArcs[nrow(newArcs) + 1, ] <- list(nn, toNode)

Expand Down
2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/benchmark.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/articles/igraph.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/igraph_files/figure-html/unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/references.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/rsppfp.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/direct_graph.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/dot-comb.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/dot-get_arc_attributes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/get_all_nodes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/get_shortest_path.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions docs/reference/modify_graph_hsu.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/modify_graph_vd.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/parse_vpath.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/rsppfp.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 637c7bf

Please sign in to comment.