Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
got rid of isunique
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacCranko committed Jun 30, 2015
1 parent 84c663a commit 56d6719
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,12 @@ function union{T<:AbstractGraph}(g::T, h::T)
return r
end

isunique(iter::Range) = true
isunique(iter::Set) = true
isunique(iter) = (length(unique(iter)) == length(iter))

#@doc "filter g to include only the vertices present in iter which should not have duplicates
#returns the subgraph of g induced by set(iter) along with the mapping from the old vertex names to the new vertex names" ->
function induced_subgraph{T<:AbstractGraph}(g::T, iter)
!isunique(iter) && error("Vertices in subgraph list must be unique")

if length(iter) == nv(g)
if length(unique(iter)) == length(iter)
error("Vertices in subgraph list must be unique")
elseif length(iter) == nv(g)
return copy(g) # if iter is not a proper subgraph
end

Expand Down

0 comments on commit 56d6719

Please sign in to comment.