Skip to content

Commit

Permalink
Merge pull request JuliaAttic#174 from JuliaGraphs/hotfix-intersect
Browse files Browse the repository at this point in the history
  • Loading branch information
sbromberger committed Oct 19, 2015
2 parents 76c2bdb + 3038874 commit 770e3c8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ function induced_subgraph{T<:SimpleGraph}(g::T, iter)
newvid[v] = i
end

iterset = Set(iter)
for s in iter
for d in intersect(iter, out_neighbors(g, s))
newe = Edge(newvid[s], newvid[d])
if !has_edge(h, newe)
add_edge!(h, newe)
for d in out_neighbors(g, s)
# println("s = $s, d = $d")
if d in iterset && has_edge(g, s, d)
newe = Edge(newvid[s], newvid[d])
if !has_edge(h, newe)
add_edge!(h, newe)
end
end
end
end
Expand Down

0 comments on commit 770e3c8

Please sign in to comment.