diff --git a/src/Decompositions.jl b/src/Decompositions.jl index e611ec2..a822164 100644 --- a/src/Decompositions.jl +++ b/src/Decompositions.jl @@ -236,12 +236,12 @@ function Decompositions.StrDecomp(sgraph::AbstractSymmetricGraph, stree::Superno for i in 1:n snd = supernode(stree, i) sep = seperator[i] - objects[i] = induced_subgraph(sgraph, order(stree.ograph, [snd; sep])) + objects[i] = induced_subgraph(sgraph, order(stree.graph, [snd; sep])) end for i in 1:n - 1 sep = seperator[i] - objects[n + i] = induced_subgraph(sgraph, order(stree.ograph, sep)) + objects[n + i] = induced_subgraph(sgraph, order(stree.graph, sep)) end for i in 1:n - 1 diff --git a/src/junction_trees/elimination_trees.jl b/src/junction_trees/elimination_trees.jl index f6cbe18..1a87c9a 100644 --- a/src/junction_trees/elimination_trees.jl +++ b/src/junction_trees/elimination_trees.jl @@ -2,7 +2,7 @@ # Nodes i in T correspond to vertices σ(i) in G. struct EliminationTree{T <: Union{Tree, PostorderTree}} tree::T # elimination tree - ograph::OrderedGraph # ordered graph + graph::OrderedGraph # ordered graph end @@ -15,27 +15,27 @@ end # Construct the elimination tree of an ordered graph. -function EliminationTree(ograph::OrderedGraph) - EliminationTree(Tree(etree(ograph)), ograph) +function EliminationTree(graph::OrderedGraph) + EliminationTree(Tree(etree(graph)), graph) end # Postorder an elimination tree. function EliminationTree{PostorderTree}(etree::EliminationTree, order::Order) - EliminationTree(PostorderTree(etree.tree, order), OrderedGraph(etree.ograph, order)) + EliminationTree(PostorderTree(etree.tree, order), OrderedGraph(etree.graph, order)) end # A Compact Row Storage Scheme for Cholesky Factors Using Elimination Trees # Liu # Algorithm 4.2: Elimination Tree by Path Compression. -function etree(ograph::OrderedGraph) - n = nv(ograph) +function etree(graph::OrderedGraph) + n = nv(graph) parent = collect(1:n) ancestor = collect(1:n) for i in 1:n - for k in inneighbors(ograph, i) + for k in inneighbors(graph, i) r = k while ancestor[r] != r && ancestor[r] != i @@ -102,7 +102,7 @@ function supcnt(etree::EliminationTree{PostorderTree}) for p in 1:n - 1 wt[parentindex(etree.tree, p)] -= 1 - for u in outneighbors(etree.ograph, p) + for u in outneighbors(etree.graph, p) if firstdescendant(etree.tree, p) > prev_nbr[u] wt[p] += 1 pp = prev_p[u] diff --git a/src/junction_trees/supernode_trees.jl b/src/junction_trees/supernode_trees.jl index 2402b54..24dbc43 100644 --- a/src/junction_trees/supernode_trees.jl +++ b/src/junction_trees/supernode_trees.jl @@ -1,7 +1,7 @@ # An ordered graph (G, σ) equipped with a supernodal elimination tree T. struct SupernodeTree tree::PostorderTree # supernodal elimination tree - ograph::OrderedGraph # ordered graph + graph::OrderedGraph # ordered graph representative::Vector{Int} # representative vertex cardinality::Vector{Int} # supernode cardinality ancestor::Vector{Int} # first ancestor @@ -28,7 +28,7 @@ function SupernodeTree(etree::EliminationTree, stype::SupernodeType=DEFAULT_SUPE tree = PostorderTree(tree, sorder) order = Order(vcat(snode[sorder]...)) - ograph = OrderedGraph(etree.ograph, order) + graph = OrderedGraph(etree.graph, order) n = length(tree) representative = zeros(Int, n) @@ -49,7 +49,7 @@ function SupernodeTree(etree::EliminationTree, stype::SupernodeType=DEFAULT_SUPE _degree[n] = degree[n] _ancestor[n] = ancestor[n] - SupernodeTree(tree, ograph, representative, cardinality, _ancestor, _degree) + SupernodeTree(tree, graph, representative, cardinality, _ancestor, _degree) end @@ -93,16 +93,16 @@ end # Construct an elimination graph. function eliminationgraph(stree::SupernodeTree) - ograph = deepcopy(stree.ograph) + graph = deepcopy(stree.graph) n = length(stree.tree) for i in 1:n - 1 for u in supernode(stree, i)[1:end - 1] v = u + 1 - for w in outneighbors(ograph, u) + for w in outneighbors(graph, u) if v < w - add_edge!(ograph, v, w) + add_edge!(graph, v, w) end end end @@ -110,14 +110,14 @@ function eliminationgraph(stree::SupernodeTree) u = last(supernode(stree, i)) v = first(supernode(stree, parentindex(stree.tree, i))) - for w in outneighbors(ograph, u) + for w in outneighbors(graph, u) if v < w - add_edge!(ograph, v, w) + add_edge!(graph, v, w) end end end - ograph + graph end @@ -139,10 +139,10 @@ end function seperators(stree::SupernodeTree) n = length(stree.tree) seperator = Vector{Vector{Int}}(undef, n) - ograph = eliminationgraph(stree) + graph = eliminationgraph(stree) for i in 1:n - clique = collect(outneighbors(ograph, stree.representative[i])) + clique = collect(outneighbors(graph, stree.representative[i])) filter!(j -> stree.ancestor[i] <= j, clique) seperator[i] = clique end