Skip to contents

Find and list all possible paths of heat carrier flow (water) in the given topology of district heating system.

Usage

flowls(sender = "A", acceptor = "B", use_cluster = FALSE)

Arguments

sender

identifier of the node which heat carrier flows out. Type: any type that can be painlessly coerced to character by as.character.

acceptor

identifier of the node which heat carrier flows in. According to topology of test bench considered this identifier should be unique. Type: any type that can be painlessly coerced to character by as.character.

use_cluster

utilize functionality of parallel processing on multi-core CPU. Type: assert_flag.

Value

named list that contains integer vectors as its elements. The name of each element in the list is the name of acceptor associated with terminal node of district heating network. Each vector in the

list represents an ordered sequence of indexes in acceptor

that enumerates incoming edges from starting node to terminal one. The length of returned list is equal to number of terminal nodes for topology considered. Type: assert_list.

Details

Only branched topology without cycles is considered where no more than one incoming edge exists for every acceptor node. For instance, m325testbench has permitted topology.

Though input arguments are natively vectorized their individual values all relate to common part of district heating network, i.e. associated with common object. It is due to isomorphism between vector representation and directed graph of this network. For more details of isomorphic topology description see m325testbench.

See also

m325testbench for example of topology of district heating system

Examples

 library(pipenostics)

# \donttest{
# Find path from A to B in trivial line topology:
flowls("A", "B")
#> $B
#> [1] 1
#> 

# $B
# [1] 1

# More complex example with two terminal nodes D and E:
flowls(c("A", "B", "B"), c("B", "D", "E"))
#> $D
#> [1] 1 2
#> 
#> $E
#> [1] 1 3
#> 

#$D
#[1] 1 2
#
#$E
#[1] 1 3

# All possible flow paths in test bench illustrated in `?m325testbench`:
all_paths <- list(
  c(12, 13, 11, 8, 4, 1),  # hereinafter indexes of acceptor nodes
  c(12, 13, 11, 8, 4, 2),
  c(12, 13, 11, 8, 6, 5,  3),
  c(12, 13, 11, 8, 6, 7),
  c(12, 13, 11, 8, 6, 9),
  c(12, 13, 11, 10),
  c(12, 13, 14, 15),
  c(12, 13, 16, 17),
  c(12, 13, 16, 18, 20, 19),
  c(12, 13, 16, 18, 20, 21),
  c(12, 13, 16, 18, 22, 24),
  c(12, 13, 16, 18, 22, 25),
  c(12, 13, 16, 18, 20, 23, 26)
)

# find those paths:
path <- with(pipenostics::m325testbench, {
  flowls(sender, acceptor)
})

path[[4]]
#> [1] 12 13 11  8  6  7
# [1] 12 13 11  8  6  7

# }