Skip to content

Commit

Permalink
Fix for multiple alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
vvjn committed Feb 11, 2018
1 parent 035862d commit 1b8ecc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/dynamicnetworks.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export Events, networkactivity, nodeactivity, cet_ncet, fixevents,
fixevents!, widenevents!, snapshot, snapshots, mintime, maxtime,
meannodeactivity, numevents, mergeevents, mergeevents!
meannodeactivity, numevents, mergeevents, mergeevents!, flatten

# Functions for working with dynamic networks
import Base: zero, ==
Expand Down Expand Up @@ -31,6 +31,10 @@ mergesorted(x::Events, y::Events) =
numevents(G::SparseMatrixCSC{Events}) =
sum(map(x->length(x.timestamps), G.nzval))

flatten(G::SparseMatrixCSC{<:Number,Int}) = G
flatten(G::SparseMatrixCSC{Events,Int}) =
SparseMatrixCSC(G.m,G.n,G.colptr,G.rowval,ones(Int,length(G.nzval)))

"""
Total time during which events in event set are active
i.e. active duration of an edge
Expand Down
13 changes: 7 additions & 6 deletions src/measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ immutable LCCSMeasure <: NetalignMeasure
G
function LCCSMeasure(G::SparseMatrixCSC...)
if length(G) < 2 error("Need 2 of more networks") end
for i = 2:length(G)
if size(G[i-1],1) > size(G[i],1) error("Network size order") end
end
new(G)
end
end
Expand Down Expand Up @@ -316,6 +313,9 @@ end
# Only works for 1-1 MNA
# fs[i] is permutation from G[i] to G[end]
function measure(meas::LCCSMeasure,fs::Tuple{Vector{<:Integer}})
for i = 2:length(meas.G)
if size(meas.G[i-1],1) > size(meas.G[i],1) error("Network size order") end
end
k = length(meas.G)
length(fs) == k-1 || error("number of permutations")
ncs = size(meas.G[end],1)
Expand Down Expand Up @@ -354,9 +354,6 @@ immutable CIQMeasure <: NetalignMeasure
G
function CIQMeasure(G::SparseMatrixCSC...)
if length(G) < 2 error("Need 2 of more networks") end
for i = 2:length(G)
if size(G[i-1],1) > size(G[i],1) error("Network size order") end
end
new(G)
end
end
Expand All @@ -368,6 +365,10 @@ end
# Only works for 1-1 MNA
# fs[i] is permutation from G[i] to G[end]
function measure(meas::CIQMeasure,fs::Tuple{Vector{<:Integer}})
for i = 2:length(meas.G)
if size(meas.G[i-1],1) > size(meas.G[i],1) error("Network size order") end
end

k = length(meas.G)
length(fs) == k-1 || error("number of permutations")
ncs = size(meas.G[end],1)
Expand Down

0 comments on commit 1b8ecc5

Please sign in to comment.