Skip to content

Commit

Permalink
Patch steinertree, final before 3.0.1: name attr. issue
Browse files Browse the repository at this point in the history
  • Loading branch information
krashkov committed Aug 19, 2018
1 parent ef136a7 commit 963926b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/steinertree.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ asp_steiner <- function (optimize, terminals, glist, color) {
# Randomized all shortest paths approximation (RSP)
appr_steiner <- function (repeattimes, optimize, terminals, glist, color) {
set <- c()
g <- glist[[1]]
g <- glist[[1]]

# Start with the sub-graph G* consisting of all nodes and edges appearing on shortest paths between terminals
paths <- lapply(terminals, function (x) get.all.shortest.paths(g, x, terminals)$res)
Expand Down Expand Up @@ -122,7 +122,7 @@ steinertree2 <- function (optimize, terminals, glist, color) {
subtree <- terminals[[prob]]
nsubtree <- setdiff(terminals, subtree)

# Proceed until all terminals not in G
# Proceed until all terminals not in G'
while ( !all(is.element(terminals, intersect(subtree, terminals))) ) {
# Compute shortest paths and their lengths between each node in subtree (G') and the remaining nodes
paths <- lapply(subtree, function (x) get.all.shortest.paths(g, x, nsubtree))
Expand Down Expand Up @@ -569,7 +569,7 @@ check_input <- function (type, terminals, glist) {



restore_name_attribute <- function (attr_flag, numVertices, type, result, color) {
restore_name_attribute <- function (attr_flag, type, result, color) {

if (color) {
if (attr_flag) {
Expand All @@ -580,7 +580,7 @@ restore_name_attribute <- function (attr_flag, numVertices, type, result, color)

if (type == "EXA" | type == "SPM") {
if (attr_flag) {
numSteiner = length(result[[length(result)]])
numSteiner <- length(result[[length(result)]])

for (i in 1:numSteiner) {
V(result[[length(result)]][[i]])$name <- V(result[[length(result)]][[i]])$realname
Expand Down Expand Up @@ -683,7 +683,7 @@ steinertree <- function (type, repeattimes = 70, optimize = TRUE, terminals, gra
if (type == "ASP")
result <- asp_steiner(optimize = optimize, terminals = terminals, glist = glist, color = color)

result <- restore_name_attribute(attr_flag, numVertices = length(V(g)), type, result, color)
result <- restore_name_attribute(attr_flag, type, result, color)

if (merge & (type == "EXA" | type == "SPM")) {
if (color) {
Expand Down

0 comments on commit 963926b

Please sign in to comment.