Skip to content

Commit 0710e3f

Browse files
InterdisciplinaryPhysicsTeampitmonticoneClaudMor
committed
Delete commented constructors
Co-Authored-By: Pietro Monticone <[email protected]> Co-Authored-By: Claudio Moroni <[email protected]>
1 parent 261a772 commit 0710e3f

File tree

3 files changed

+0
-227
lines changed

3 files changed

+0
-227
lines changed

src/graphs_extensions/metagraphs.jl

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,3 @@
1-
#= """
2-
MetaGraph{T,U}()
3-
4-
Empty MetaGraph with vertex type `T` and adjacency matrix eltype `U`. The underlying graph is a SimpleGraph.
5-
"""
6-
MetaGraphs.MetaGraph{T,U}() where {T,U} = MetaGraph{T,U}(SimpleGraph{T}())
7-
8-
"""
9-
MetaDiGraph{T,U}()
10-
11-
Empty MetaDiGraph with vertex type `T` and adjacency matrix eltype `U`. The underlying graph is a SimpleDiGraph.
12-
"""
13-
MetaGraphs.MetaDiGraph{T,U}() where {T,U} = MetaDiGraph{T,U}(SimpleDiGraph{T}())
14-
15-
"""
16-
MetaGraph{T,U}(n_vertices::Integer, n_edges::Integer)
17-
18-
Random MetaGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. the underlying graph is a SimpleGraph.
19-
"""
20-
MetaGraphs.MetaGraph{T,U}(n_vertices::Integer, n_edges::Integer) where {T,U} = MetaGraph{T,U}(SimpleGraph(n_vertices, n_edges))
21-
22-
"""
23-
MetaGraph(n_vertices::Integer, n_edges::Integer; T = Int64, U = Float64)
24-
25-
Random MetaGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. the underlying graph is a SimpleGraph.
26-
"""
27-
MetaGraphs.MetaGraph(n_vertices::Integer, n_edges::Integer; T = Int64, U = Float64) = MetaGraph{T,U}(SimpleGraph(n_vertices, n_edges))
28-
29-
30-
"""
31-
MetaDiGraph{T,U}(n_vertices::Integer, n_edges::Integer)
32-
33-
Randoms MetaDiGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. the underlying graph is a SimpleDiGraph.
34-
"""
35-
MetaGraphs.MetaDiGraph{T,U}(n_vertices::Integer, n_edges::Integer) where {T,U} = MetaDiGraph{T,U}(SimpleDiGraph(n_vertices, n_edges))
36-
37-
"""
38-
MetaGraph(n_vertices::Integer, n_edges::Integer; T = Int64, U = Float64)
39-
40-
Randoms MetaGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. the underlying graph is a SimpleDiGraph.
41-
"""
42-
MetaGraphs.MetaDiGraph(n_vertices::Integer, n_edges::Integer; T = Int64, U = Float64) = MetaDiGraph{T,U}(SimpleDiGraph(n_vertices, n_edges))
43-
44-
45-
"""
46-
MetaGraph{T,U}(adjm::Matrix) where {T,U}
47-
48-
MetaGraph with adjacency matrix `adjm`, vertex type `T` and adjacency matrix eltype `U`. The underlying graph is a SimpleGraph.
49-
"""
50-
MetaGraphs.MetaGraph{T,U}(adjm::Union{Matrix,SparseMatrixCSC}) where {T,U} = MetaGraph{T,U}(SimpleGraph(adjm))
51-
52-
"""
53-
MetaGraph{T,U}(n_vertices::Integer, n_edges::Integer)
54-
55-
MetaDiGraph with adjacency matrix `adjm`, vertex type `T` and adjacency matrix eltype `U`. The underlying graph is a SimpleDiGraph.
56-
"""
57-
MetaGraphs.MetaDiGraph{T,U}(adjm::Union{Matrix,SparseMatrixCSC}) where {T,U} = MetaDiGraph{T,U}(SimpleDiGraph(adjm)) =#
58-
591
__add_vertex!(g::AbstractMetaGraph{T}; metadata::Union{Tuple,NamedTuple} = NamedTuple()) where {T <: Integer} = add_vertex!(g, Dict(Symbol(pair.first) => pair.second for pair in pairs(metadata)))
602

613
_get_vertex_metadata(g::AbstractMetaGraph{T}, vertex::T) where T = NamedTuple(props(g,vertex))

src/graphs_extensions/simplevaluegraphs.jl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,3 @@
1-
#= """
2-
ValGraph(n_vertices::Int, n_edges::Int; T = Int64, kwargs...)
3-
4-
Random ValGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleGraph.
5-
"""
6-
SimpleValueGraphs.ValGraph(n_vertices::Int, n_edges::Int; T = Int64, kwargs...) = ValGraph( SimpleGraph{T}(n_vertices, n_edges); kwargs... )
7-
8-
"""
9-
ValOutDiGraph(n_vertices::Int, n_edges::Int; T = Int64, kwargs...)
10-
11-
Random ValOutDiGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleDiGraph.
12-
"""
13-
SimpleValueGraphs.ValOutDiGraph(n_vertices::Int, n_edges::Int; T = Int64, kwargs...) = ValOutDiGraph( SimpleDiGraph{T}(n_vertices, n_edges); kwargs... )
14-
15-
"""
16-
ValOutDiGraph{T}(; kwargs...) where T
17-
18-
Random ValOutDiGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleDiGraph.
19-
"""
20-
SimpleValueGraphs.ValOutDiGraph{T}(; kwargs...) where T = ValOutDiGraph( SimpleDiGraph{T}(); kwargs... )
21-
22-
"""
23-
ValDiGraph(n_vertices::Integer, n_edges::Integer; kwargs...)
24-
25-
Random ValDiGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleDiGraph.
26-
"""
27-
SimpleValueGraphs.ValDiGraph(n_vertices::Int, n_edges::Int; T = Int64, kwargs...) = ValDiGraph( SimpleDiGraph{T}(n_vertices, n_edges); kwargs... )
28-
29-
"""
30-
ValDiGraph{T}(; kwargs...) where T
31-
32-
Random ValDiGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleDiGraph.
33-
"""
34-
SimpleValueGraphs.ValDiGraph{T}(; kwargs...) where T = ValDiGraph( SimpleDiGraph{T}(); kwargs... )
35-
36-
"""
37-
ValDiGraph{T}(; kwargs...) where T
38-
39-
Random ValDiGraph with `n_vertices` vertices and `n_edges` edges and vertex type `T`. the underlying graph is a SimpleDiGraph.
40-
"""
41-
SimpleValueGraphs.ValGraph{T}(; kwargs...) where T = ValGraph( SimpleGraph{T}(); kwargs... ) =#
42-
43-
441
function __add_vertex!(g::SimpleValueGraphs.AbstractValGraph{T}; metadata::Union{Tuple,NamedTuple} = NamedTuple()) where {T <: Integer}
452
if isempty(metadata)
463
add_vertex!(g)

src/graphs_extensions/simpleweightedgraphs.jl

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,3 @@
1-
#= # Some custom extensions of Graphs.jl and SimpleWeightedGraphs.jl
2-
"""
3-
SimpleWeightedGraph(n_vertices::Integer, n_edges::Integer; T::Type = Int64, U::Type = Float64)
4-
5-
Random SimpleWeightedGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
6-
"""
7-
function SimpleWeightedGraphs.SimpleWeightedGraph(
8-
n_vertices::Integer, n_edges::Integer; T::Type=Int64, U::Type=Float64
9-
)
10-
adjm = zeros(U, n_vertices, n_vertices)
11-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
12-
13-
for cart_idx in rand_nnz_cart_idxs
14-
adjm[cart_idx] = U(rand())
15-
end
16-
17-
adjm .= (adjm .+ adjm') ./ U(2)
18-
19-
return SimpleWeightedGraph{T,U}(adjm)
20-
end
21-
22-
"""
23-
SimpleWeightedGraph{T}(n_vertices::Integer, n_edges::Integer; U::Type = Float64) where { T }
24-
25-
Random SimpleWeightedGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
26-
"""
27-
function SimpleWeightedGraphs.SimpleWeightedGraph{T}(
28-
n_vertices::Integer, n_edges::Integer; U::Type=Float64
29-
) where {T}
30-
adjm = zeros(U, n_vertices, n_vertices)
31-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
32-
33-
for cart_idx in rand_nnz_cart_idxs
34-
adjm[cart_idx] = U(rand())
35-
end
36-
37-
adjm .= (adjm .+ adjm') ./ U(2)
38-
39-
return SimpleWeightedGraph{T,U}(adjm)
40-
end
41-
42-
"""
43-
SimpleWeightedGraph{T,U}(n_vertices::Integer, n_edges::Integer) where { T, U }
44-
45-
Random SimpleWeightedGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
46-
"""
47-
function SimpleWeightedGraphs.SimpleWeightedGraph{T,U}(
48-
n_vertices::Integer, n_edges::Integer; weight_range::Tuple{U,U} = (zero(U),one(U)),
49-
) where {T,U}
50-
adjm = zeros(U, n_vertices, n_vertices)
51-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
52-
53-
for cart_idx in rand_nnz_cart_idxs
54-
if U <: Integer
55-
adjm[cart_idx] = U(rand(weight_range[1]:weight_range[2]))
56-
elseif U <: Real
57-
adjm[cart_idx] = U(rand(Uniform(weight_range[1],weight_range[2])))
58-
else
59-
throw(ErrorException("The rand function suited for U = $U has not yet been implemented. Please file an issue."))
60-
end
61-
end
62-
63-
adjm .= (adjm .+ adjm') ./ U(2)
64-
65-
return SimpleWeightedGraph{T,U}(adjm)
66-
end
67-
68-
"""
69-
SimpleWeightedDiGraph(n_vertices::Integer, n_edges::Integer; T::Type = Int64, U::Type = Float64)
70-
71-
Random SimpleWeightedDiGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
72-
"""
73-
function SimpleWeightedGraphs.SimpleWeightedDiGraph(
74-
n_vertices::Integer, n_edges::Integer; T::Type=Int64, U::Type=Float64
75-
)
76-
adjm = zeros(U, n_vertices, n_vertices)
77-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
78-
79-
for cart_idx in rand_nnz_cart_idxs
80-
adjm[cart_idx] = U(rand())
81-
end
82-
83-
return SimpleWeightedDiGraph{T,U}(adjm)
84-
end
85-
86-
"""
87-
SimpleWeightedGraphs.SimpleWeightedDiGraph{T}(n_vertices::Integer, n_edges::Integer; U::Type = Float64) where {T}
88-
89-
Random SimpleWeightedDiGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
90-
"""
91-
function SimpleWeightedGraphs.SimpleWeightedDiGraph{T}(
92-
n_vertices::Integer, n_edges::Integer; U::Type=Float64
93-
) where {T}
94-
adjm = zeros(U, n_vertices, n_vertices)
95-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
96-
97-
for cart_idx in rand_nnz_cart_idxs
98-
adjm[cart_idx] = U(rand())
99-
end
100-
101-
return SimpleWeightedDiGraph{T,U}(adjm)
102-
end
103-
104-
"""
105-
SimpleWeightedDiGraph{T,U}(n_vertices::Integer, n_edges::Integer)
106-
107-
Random SimpleWeightedDiGraph with `n_vertices` vertices and `n_edges` edges, vertex type `T` and adjacency matrix eltype `U`. Edge weights are uniformly extracted between 0 and 1.
108-
"""
109-
function SimpleWeightedGraphs.SimpleWeightedDiGraph{T,U}(
110-
n_vertices::Integer, n_edges::Integer, weight_range::Tuple{U,U} = (zero(U),one(U))
111-
) where {T,U}
112-
adjm = zeros(U, n_vertices, n_vertices)
113-
rand_nnz_cart_idxs = rand(CartesianIndices(adjm), n_edges)
114-
115-
for cart_idx in rand_nnz_cart_idxs
116-
if U <: Integer
117-
adjm[cart_idx] = U(rand(weight_range[1]:weight_range[2]))
118-
elseif U <: Real
119-
adjm[cart_idx] = U(rand(Uniform(weight_range[1],weight_range[2])))
120-
else
121-
throw(ErrorException("The rand function suited for U = $U has not yet been implemented. Please file an issue."))
122-
end
123-
end
124-
return SimpleWeightedDiGraph{T,U}(adjm)
125-
end =#
126-
1271
Graphs.weights(g::G) where {T, G <: AbstractSimpleWeightedGraph{T}} = Graphs.weights(g)
1282

1293

0 commit comments

Comments
 (0)