Skip to content

Commit 2cfa5d6

Browse files
committedJul 17, 2022
Name changes
1 parent 5180781 commit 2cfa5d6

39 files changed

+274
-272
lines changed
 

‎src/SimpleGraphs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ include("embedding/embedding.jl")
5656

5757
include("hyper/SimpleHypergraphs.jl")
5858

59-
include("abbreviations.jl")
59+
# include("abbreviations.jl")
6060

6161
end # module SimpleGraphs

‎src/abbreviations.jl

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
const UG = SimpleGraph
2-
const DG = SimpleDigraph
3-
# const HG = SimpleHypergraph
4-
export UG, DG
1+
52

63

74
# These names will not be necessary in versions 0.8.1 and on
85

9-
const UndirectedGraph = SimpleGraph
10-
const DirectedGraph = SimpleDigraph
6+
const DirectedGraph = DirectedGraph
117
const HyperGraph = HyperGraph
128

13-
export UndirectedGraph, DirectedGraph, HyperGraph
9+
export DirectedGraph, HyperGraph

‎src/bisect.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This can be invoked as follows:
2121
A plain call to `bisect(G)` is equivalent to `bisect(G,"zero")` (which
2222
is the same as `bisect(G,"user", 0.0)`).
2323
"""
24-
function bisect(G::SimpleGraph, where::AbstractString = "zero", pivot::Real = 0.0)
24+
function bisect(G::UndirectedGraph, where::AbstractString = "zero", pivot::Real = 0.0)
2525

2626
verbose = false
2727

@@ -100,7 +100,7 @@ end
100100
one end in `A` and one end in `B`. Here `A` and `B` are collections
101101
of vertices of `G`.
102102
"""
103-
function cross_edges(G::SimpleGraph, A, B)
103+
function cross_edges(G::UndirectedGraph, A, B)
104104

105105
AB = Base.Iterators.product(A, B)
106106

‎src/cache.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,35 @@ export cache_clear, cache_on, cache_off, cache_recall, cache_check, cache_save
1313
1414
`cache_clear(G,item)` clears just that item.
1515
"""
16-
function cache_clear(G::SimpleGraph)
16+
function cache_clear(G::UndirectedGraph)
1717
if length(G.cache) > 0
1818
G.cache = Dict{Symbol,Any}()
1919
end
2020
nothing
2121
end
2222

23-
cache_clear(G::SimpleGraph, item::Symbol) = delete!(G.cache, item)
23+
cache_clear(G::UndirectedGraph, item::Symbol) = delete!(G.cache, item)
2424

2525
"""
2626
`cache_check(G,item)` checks if the symbol `item` is a valid key.
2727
"""
28-
cache_check(G::SimpleGraph, item::Symbol)::Bool = G.cache_flag && haskey(G.cache, item)
28+
cache_check(G::UndirectedGraph, item::Symbol)::Bool = G.cache_flag && haskey(G.cache, item)
2929

3030
"""
3131
`cache_recall(G,item)` retreives the value associated with `item`.
3232
3333
**WARNING**: No check is done to see if this value is defined. Be
3434
sure to use `cache_check` first!
3535
"""
36-
cache_recall(G::SimpleGraph, item::Symbol) = G.cache[item]
36+
cache_recall(G::UndirectedGraph, item::Symbol) = G.cache[item]
3737

3838

3939

4040
"""
4141
`cache_save(G,item,value)` saves `value` associated with
4242
the symbol (key) `item` in the cache for this graph.
4343
"""
44-
function cache_save(G::SimpleGraph, item::Symbol, value)
44+
function cache_save(G::UndirectedGraph, item::Symbol, value)
4545
if G.cache_flag
4646
G.cache[item] = value
4747
end
@@ -51,14 +51,14 @@ end
5151
"""
5252
`cache_on(G)` activates results caching for this graph. See also: `cache_off`.
5353
"""
54-
cache_on(G::SimpleGraph) = G.cache_flag = true
54+
cache_on(G::UndirectedGraph) = G.cache_flag = true
5555

5656
"""
5757
`cache_off(G)` deactivates cache checking. You may also wish to call
5858
`cache_clear` to recover storage.
5959
6060
See also: `cache_on`.
6161
"""
62-
function cache_off(G::SimpleGraph)
62+
function cache_off(G::UndirectedGraph)
6363
G.cache_flag = false
6464
end

‎src/d_dist.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
function dist_matrix(G::SimpleDigraph)
2+
function dist_matrix(G::DirectedGraph)
33
VV = vlist(G)
44
n = length(VV)
55
A = zeros(Int, n, n)
@@ -12,7 +12,7 @@ function dist_matrix(G::SimpleDigraph)
1212
return A
1313
end
1414

15-
function diam(G::SimpleDigraph)
15+
function diam(G::DirectedGraph)
1616
A = dist_matrix(G)
1717
if minimum(A) < 0
1818
return -1

‎src/d_euler.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export euler, is_cut_edge
22

3-
function euler(G::SimpleDigraph{T}, u::T, v::T) where {T}
3+
function euler(G::DirectedGraph{T}, u::T, v::T) where {T}
44
notrail = T[]
55
#check in_degrees and out_degrees of start and end vertex first
66
if u == v
@@ -25,12 +25,12 @@ function euler(G::SimpleDigraph{T}, u::T, v::T) where {T}
2525
return euler_work!(GG, u)
2626
end
2727

28-
euler(G::SimpleDigraph, u) = euler(G, u, u)
29-
euler(G::SimpleDigraph) = euler(G, first(G.V))
28+
euler(G::DirectedGraph, u) = euler(G, u, u)
29+
euler(G::DirectedGraph) = euler(G, first(G.V))
3030

3131

3232
# determine if an edge in a directed graph is a cut edge
33-
function is_cut_edge(G::SimpleDigraph{T}, u::T, v::T) where {T}
33+
function is_cut_edge(G::DirectedGraph{T}, u::T, v::T) where {T}
3434
if !has(G, u, v)
3535
error("No such edge in this graph")
3636
end
@@ -48,7 +48,7 @@ end
4848

4949
# helper function to determine if there is euler path
5050
# function euler_work!(G::SimpleDigraph{T}, u::T) where {T}
51-
function euler_work!(G::SimpleDigraph{T}, u::T) where {T}
51+
function euler_work!(G::DirectedGraph{T}, u::T) where {T}
5252
trail = T[]
5353
while true
5454
Nu = out_neighbors(G, u)

‎src/d_ham.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export hamiltonian_cycle
22

33
#check if it is safe to add vertex v to the path
4-
function isSafe(v::T, G::SimpleDigraph{T}, path::Deque{T}) where {T}
4+
function isSafe(v::T, G::DirectedGraph{T}, path::Deque{T}) where {T}
55
prev = last(path)
66

77
#check if the added vertex is an out_neighbor of the previous vertex
@@ -21,7 +21,7 @@ function isSafe(v::T, G::SimpleDigraph{T}, path::Deque{T}) where {T}
2121
return true
2222
end
2323

24-
function hamCycle(G::SimpleDigraph{T}, path::Deque{T}) where {T}
24+
function hamCycle(G::DirectedGraph{T}, path::Deque{T}) where {T}
2525
#if all vertices are included in the cycle
2626
if length(path) == NV(G)
2727
#check if last vertex is connected to first vertex in path
@@ -49,7 +49,7 @@ function hamCycle(G::SimpleDigraph{T}, path::Deque{T}) where {T}
4949
end
5050

5151
#check if a directed graph contains a hamiltonian cycle
52-
function directed_ham_cycle(G::SimpleDigraph{T}) where {T}
52+
function directed_ham_cycle(G::DirectedGraph{T}) where {T}
5353
result = Deque{T}()
5454
vlist = collect(G.V)
5555

@@ -72,6 +72,6 @@ function directed_ham_cycle(G::SimpleDigraph{T}) where {T}
7272
end
7373

7474
#export the result as an array
75-
function hamiltonian_cycle(G::SimpleDigraph{T}) where {T}
75+
function hamiltonian_cycle(G::DirectedGraph{T}) where {T}
7676
return collect(directed_ham_cycle(G))
7777
end

‎src/d_simple_constructors.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function ShiftDigraph(alphabet = [0, 1], n::Int = 3)
118118
vertex_iter = all_tuples(alphabet, n)
119119
vlist = collect(vertex_iter)
120120
T = typeof(vlist[1])
121-
G = SimpleDigraph{T}()
121+
G = DirectedGraph{T}()
122122
for v in vlist
123123
add!(G, v)
124124
end
@@ -143,7 +143,7 @@ function for creating a Torus Graph
143143
function TorusDigraph(n::Int = 4, m::Int = 3)
144144

145145
T = Tuple{Int,Int}
146-
G = SimpleDigraph{T}()
146+
G = DirectedGraph{T}()
147147

148148
#create vertices
149149
vlist = Tuple{Int,Int}[]

0 commit comments

Comments
 (0)
Please sign in to comment.