@@ -5,19 +5,20 @@ A type representing a directed graph with weights of type `U`.
5
5
"""
6
6
mutable struct SimpleWeightedDiGraph{T<: Integer , U<: Real } <: AbstractSimpleWeightedGraph{T, U}
7
7
weights:: SparseMatrixCSC{U, T} # indexed by [dst, src]
8
- function SimpleWeightedDiGraph {T, U} (adjmx:: SparseMatrixCSC{U,T} , permute= true ) where T <: Integer where U <: Real
8
+ function SimpleWeightedDiGraph {T, U} (adjmx:: SparseMatrixCSC{U,T} ; permute= true ) where T <: Integer where U <: Real
9
9
dima,dimb = size (adjmx)
10
10
isequal (dima,dimb) || error (" Adjacency / distance matrices must be square" )
11
11
permute ? new {T, U} (permutedims (adjmx)) : new {T, U} (adjmx)
12
12
end
13
13
14
- SimpleWeightedDiGraph {T} (adjmx:: SparseMatrixCSC{U, T} , permute= true ) where T<: Integer where U<: Real =
15
- permute ? new {T, U} (permutedims (adjmx)) : new {T, U} (adjmx)
16
-
17
- SimpleWeightedDiGraph (adjmx:: SparseMatrixCSC{U, T} , permute= true ) where T<: Integer where U<: Real =
18
- permute ? new {T, U} (permutedims (adjmx)) : new {T, U} (adjmx)
19
14
end
20
15
16
+ SimpleWeightedDiGraph {T} (adjmx:: SparseMatrixCSC{U, T} ; permute= true ) where T<: Integer where U<: Real =
17
+ SimpleWeightedDiGraph {T, U} (adjmx; permute= permute)
18
+
19
+ SimpleWeightedDiGraph (adjmx:: SparseMatrixCSC{U, T} ; permute= true ) where T<: Integer where U<: Real =
20
+ SimpleWeightedDiGraph {T, U} (adjmx; permute= permute)
21
+
21
22
SimpleWeightedDiGraph (m:: AbstractMatrix{U} ) where U <: Real =
22
23
SimpleWeightedDiGraph {Int, U} (SparseMatrixCSC {U, Int} (m))
23
24
SimpleWeightedDiGraph {T} (m:: AbstractMatrix{U} ) where T<: Integer where U<: Real =
@@ -27,7 +28,7 @@ SimpleWeightedDiGraph{T, U}(m::AbstractMatrix) where T<:Integer where U<:Real =
27
28
28
29
SimpleWeightedDiGraph (g:: SimpleWeightedDiGraph ) = SimpleWeightedDiGraph (g. weights, false )
29
30
SimpleWeightedDiGraph {T,U} (g:: SimpleWeightedDiGraph ) where T<: Integer where U<: Real =
30
- SimpleWeightedDiGraph (SparseMatrixCSC {U, T} (g. weights), false )
31
+ SimpleWeightedDiGraph (SparseMatrixCSC {U, T} (g. weights); permute = false )
31
32
32
33
33
34
ne (g:: SimpleWeightedDiGraph ) = nnz (g. weights)
64
65
# DiGraph(srcs, dsts, weights)
65
66
function SimpleWeightedDiGraph (i:: AbstractVector{T} , j:: AbstractVector{T} , v:: AbstractVector{U} ; combine = + ) where T<: Integer where U<: Real
66
67
m = max (maximum (j), maximum (i))
67
- SimpleWeightedDiGraph {T, U} (sparse (j, i, v, m, m, combine), false )
68
+ SimpleWeightedDiGraph {T, U} (sparse (j, i, v, m, m, combine); permute = false )
68
69
end
69
70
70
71
edgetype (:: SimpleWeightedDiGraph{T, U} ) where T<: Integer where U<: Real = SimpleWeightedGraphEdge{T,U}
0 commit comments