Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cpgaffney1/cs224w
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Patrick Gaffney committed Oct 24, 2018
2 parents 88745c0 + d1efad5 commit 6dd29f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hw1/q4.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def build_hdn(graph):
dgraph.AddNode(node.GetId())
for i in dgraph.Nodes():
print 'node {}'.format(i.GetId())
for j in dgraph.Nodes():
j = dgraph.GetNI(i.GetId())
j.Next()
while j < dgraph.EndNI():
if i.GetId() == j.GetId():
continue
if dgraph.IsEdge(i.GetId(), j.GetId()):
Expand All @@ -29,6 +31,7 @@ def build_hdn(graph):
j_neighbors = get_neighbors(graph, j.GetId())
if len(i_neighbors.intersection(j_neighbors)) > 0:
dgraph.AddEdge(i.GetId(), j.GetId())
j.Next()

fout = snap.TFOut('hdn.graph')
dgraph.Save(fout)
Expand Down

0 comments on commit 6dd29f0

Please sign in to comment.