11"""
2- color_graph(g::LightGraphs .AbstractGraphs, ::AcyclicColoring)
2+ color_graph(g::Graphs .AbstractGraphs, ::AcyclicColoring)
33
44Returns a coloring vector following the acyclic coloring rules (1) the coloring
55corresponds to a distance-1 coloring, and (2) vertices in every cycle of the
@@ -9,7 +9,7 @@ is a collection of trees—and hence is acyclic.
99
1010Reference: Gebremedhin AH, Manne F, Pothen A. **New Acyclic and Star Coloring Algorithms with Application to Computing Hessians**
1111"""
12- function color_graph (g:: LightGraphs .AbstractGraph , :: AcyclicColoring )
12+ function color_graph (g:: Graphs .AbstractGraph , :: AcyclicColoring )
1313 color = zeros (Int, nv (g))
1414 two_colored_forest = DisjointSets {Int} (())
1515
6767 v::Integer,
6868 w::Integer,
6969 x::Integer,
70- g::LightGraphs .AbstractGraph,
70+ g::Graphs .AbstractGraph,
7171 two_colored_forest::DisjointSets{<:Integer},
7272 color::AbstractVector{<:Integer})
7373
@@ -81,7 +81,7 @@ function prevent_cycle!(first_visit_to_tree::AbstractVector{<:Tuple{Integer,Inte
8181 v:: Integer ,
8282 w:: Integer ,
8383 x:: Integer ,
84- g:: LightGraphs .AbstractGraph ,
84+ g:: Graphs .AbstractGraph ,
8585 two_colored_forest:: DisjointSets{<:Integer} ,
8686 color:: AbstractVector{<:Integer} )
8787 e = find (w, x, g, two_colored_forest)
100100 first_neighbor::AbstractVector{<: Tuple{Integer,Integer}},
101101 v::Integer,
102102 w::Integer,
103- g::LightGraphs .AbstractGraph,
103+ g::Graphs .AbstractGraph,
104104 color::AbstractVector{<:Integer})
105105
106106Grow a 2-colored star after assigning a new color to the
@@ -112,7 +112,7 @@ function grow_star!(two_colored_forest::DisjointSets{<:Integer},
112112 first_neighbor:: AbstractVector{<: Tuple{Integer,Integer}} ,
113113 v:: Integer ,
114114 w:: Integer ,
115- g:: LightGraphs .AbstractGraph ,
115+ g:: Graphs .AbstractGraph ,
116116 color:: AbstractVector{<:Integer} )
117117 insert_new_tree! (two_colored_forest,v,w,g)
118118 p, q = first_neighbor[color[w]]
132132 v::Integer,
133133 w::Integer,
134134 x::Integer,
135- g::LightGraphs .AbstractGraph)
135+ g::Graphs .AbstractGraph)
136136
137137Subroutine to merge trees present in the disjoint set which have a
138138common edge.
@@ -141,7 +141,7 @@ function merge_trees!(two_colored_forest::DisjointSets{<:Integer},
141141 v:: Integer ,
142142 w:: Integer ,
143143 x:: Integer ,
144- g:: LightGraphs .AbstractGraph )
144+ g:: Graphs .AbstractGraph )
145145 e1 = find (v,w,g,two_colored_forest)
146146 e2 = find (w,x,g,two_colored_forest)
147147 if e1 != e2
@@ -154,15 +154,15 @@ end
154154 insert_new_tree!(two_colored_forest::DisjointSets{<:Integer},
155155 v::Integer,
156156 w::Integer,
157- g::LightGraphs .AbstractGraph)
157+ g::Graphs .AbstractGraph)
158158
159159creates a new singleton set in the disjoint set 'two_colored_forest' consisting
160160of the edge connecting v and w in the graph g
161161"""
162162function insert_new_tree! (two_colored_forest:: DisjointSets{<:Integer} ,
163163 v:: Integer ,
164164 w:: Integer ,
165- g:: LightGraphs .AbstractGraph )
165+ g:: Graphs .AbstractGraph )
166166 edge_index = find_edge_index (v,w,g)
167167 push! (two_colored_forest,edge_index)
168168end
@@ -181,28 +181,28 @@ end
181181"""
182182 find(w::Integer,
183183 x::Integer,
184- g::LightGraphs .AbstractGraph,
184+ g::Graphs .AbstractGraph,
185185 two_colored_forest::DisjointSets{<:Integer})
186186
187187Returns the root of the disjoint set to which the edge connecting vertices w and x
188188in the graph g belongs to
189189"""
190190function find (w:: Integer ,
191191 x:: Integer ,
192- g:: LightGraphs .AbstractGraph ,
192+ g:: Graphs .AbstractGraph ,
193193 two_colored_forest:: DisjointSets{<:Integer} )
194194 edge_index = find_edge_index (w, x, g)
195195 return find_root! (two_colored_forest, edge_index)
196196end
197197
198198
199199"""
200- find_edge(g::LightGraphs .AbstractGraph, v::Integer, w::Integer)
200+ find_edge(g::Graphs .AbstractGraph, v::Integer, w::Integer)
201201
202202Returns an integer equivalent to the index of the edge connecting the vertices
203203v and w in the graph g
204204"""
205- function find_edge_index (v:: Integer , w:: Integer , g:: LightGraphs .AbstractGraph )
205+ function find_edge_index (v:: Integer , w:: Integer , g:: Graphs .AbstractGraph )
206206 pos = 1
207207 for i in edges (g)
208208
0 commit comments