Skip to content

Commit b274008

Browse files
authored
Rename variables n -> nv and e -> ne (#120)
1 parent 94fa455 commit b274008

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/coloring.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ The vertices are colored in a greedy fashion, following the `order` supplied.
7676
"""
7777
function star_coloring(g::Graph{false}, order::AbstractOrder)
7878
# Initialize data structures
79-
n = nb_vertices(g)
80-
color = zeros(Int, n)
81-
forbidden_colors = zeros(Int, n)
82-
first_neighbor = fill((0, 0), n) # at first no neighbors have been encountered
83-
treated = zeros(Int, n)
79+
nv = nb_vertices(g)
80+
color = zeros(Int, nv)
81+
forbidden_colors = zeros(Int, nv)
82+
first_neighbor = fill((0, 0), nv) # at first no neighbors have been encountered
83+
treated = zeros(Int, nv)
8484
star = Dict{Tuple{Int,Int},Int}()
8585
hub = Int[]
8686
vertices_in_order = vertices(g, order)
@@ -269,12 +269,12 @@ The vertices are colored in a greedy fashion, following the `order` supplied.
269269
"""
270270
function acyclic_coloring(g::Graph{false}, order::AbstractOrder)
271271
# Initialize data structures
272-
n = nb_vertices(g)
273-
e = nb_edges(g) ÷ 2 # symmetric sparse matrix with empty diagonal
274-
color = zeros(Int, n)
275-
forbidden_colors = zeros(Int, n)
276-
first_neighbor = fill((0, 0), n) # at first no neighbors have been encountered
277-
first_visit_to_tree = fill((0, 0), e)
272+
nv = nb_vertices(g)
273+
ne = nb_edges(g) ÷ 2 # symmetric sparse matrix with empty diagonal
274+
color = zeros(Int, nv)
275+
forbidden_colors = zeros(Int, nv)
276+
first_neighbor = fill((0, 0), nv) # at first no neighbors have been encountered
277+
first_visit_to_tree = fill((0, 0), ne)
278278
forest = DisjointSets{Tuple{Int,Int}}()
279279
vertices_in_order = vertices(g, order)
280280

src/graph.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ vertices(g::Graph) = 1:nb_vertices(g)
4141
nb_edges(g::Graph{true}) = length(g.rowval)
4242

4343
function nb_edges(g::Graph{false})
44-
e = 0
44+
ne = 0
4545
for j in vertices(g)
4646
for k in nzrange(g, j)
4747
i = rowvals(g)[k]
4848
if i != j
49-
e += 1
49+
ne += 1
5050
end
5151
end
5252
end
53-
return e
53+
return ne
5454
end
5555

5656
function neighbors(g::Graph{true}, v::Integer)

0 commit comments

Comments
 (0)