Translated neighbors()
This commit is contained in:
parent
eabfd2efea
commit
d4c11a89af
2 changed files with 7 additions and 8 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
neighbors <- function(add_mat, i) {
|
neighbors <- function(adj_mat, i) {
|
||||||
stop("needs translation")
|
# NEIGHBORS Find the parents and children of a node in a graph.
|
||||||
# function ns = neighbors(adj_mat, i)
|
# ns <- neighbors(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 <- myunion(children(adj_mat, i), parents(adj_mat, i))
|
||||||
# ns = find(adj_mat(i,:));
|
ns <- find(adj_mat[i, ])
|
||||||
|
return(ns)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ triangulate <- function(G, order) {
|
||||||
for (i in 1:n) {
|
for (i in 1:n) {
|
||||||
u <- order[i]
|
u <- order[i]
|
||||||
U <- find(!eliminated)# uneliminated
|
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
|
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[nodes, nodes] <- 1# make them all connected to each other
|
||||||
G <- setdiag(G, 0) # TODO: translate setdiag
|
G <- setdiag(G, 0) # TODO: translate setdiag
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue