Find and list all possible paths of heat carrier flow (water) in the given topology of district heating system.
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 link{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,
m325nxdata
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 m325nxdata
.
See also
m325nxdata
for example of topology of district heating
system
Examples
library(pipenostics)
# Find path from A to B in trivial line topology:
flowls("A", "B")
#> $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
#>
# All possible flow paths in test bench illustrated in `?m325nxdata`:
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:
with(m325nxdata, flowls(sender, acceptor))
#> $`1`
#> [1] 12 13 11 8 4 1
#>
#> $`2`
#> [1] 12 13 11 8 4 2
#>
#> $`3`
#> [1] 12 13 11 8 6 5 3
#>
#> $`7`
#> [1] 12 13 11 8 6 7
#>
#> $`9`
#> [1] 12 13 11 8 6 9
#>
#> $`10`
#> [1] 12 13 11 10
#>
#> $`15`
#> [1] 12 13 14 15
#>
#> $`17`
#> [1] 12 13 16 17
#>
#> $`19`
#> [1] 12 13 16 18 20 19
#>
#> $`21`
#> [1] 12 13 16 18 20 21
#>
#> $`24`
#> [1] 12 13 16 18 22 24
#>
#> $`25`
#> [1] 12 13 16 18 22 25
#>
#> $`26`
#> [1] 12 13 16 18 20 23 26
#>