Translated neighbors()

This commit is contained in:
Waldir Leoncio 2022-12-22 13:12:40 +01:00
parent eabfd2efea
commit d4c11a89af
2 changed files with 7 additions and 8 deletions

View file

@ -1,9 +1,8 @@
neighbors <- function(add_mat, i) {
stop("needs translation")
# function ns = neighbors(adj_mat, i)
# % NEIGHBORS Find the parents and children of a node in a graph.
# % ns = neighbors(adj_mat, i)
neighbors <- function(adj_mat, i) {
# NEIGHBORS Find the parents and children of a node in a graph.
# ns <- neighbors(adj_mat, i)
# %ns = myunion(children(adj_mat, i), parents(adj_mat, i));
# ns = find(adj_mat(i,:));
# ns <- myunion(children(adj_mat, i), parents(adj_mat, i))
ns <- find(adj_mat[i, ])
return(ns)
}

View file

@ -14,7 +14,7 @@ triangulate <- function(G, order) {
for (i in 1:n) {
u <- order[i]
U <- find(!eliminated)# uneliminated
nodes <- myintersect(neighbors(G, u), U)# look up neighbors in the partially filled - in graph # TODO: translate neighbors
nodes <- myintersect(neighbors(G, u), U)# look up neighbors in the partially filled - in graph
nodes <- myunion(nodes, u)# the clique will always contain at least u # TODO: translate myunion
G[nodes, nodes] <- 1# make them all connected to each other
G <- setdiag(G, 0) # TODO: translate setdiag