Created
December 9, 2014 02:09
-
-
Save xmichaelx/9d470ba3324a0a756fa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import snap | |
| # requires python 2.7 and 64-bit machine | |
| G1 = snap.TUNGraph.New() | |
| with open("data/edges.csv") as f: | |
| for line in f: | |
| tokens = line.split() | |
| n1, n2, weight = int(tokens[0]), int(tokens[1]), int(tokens[2]) | |
| if not G1.IsNode(n1): | |
| G1.AddNode(n1) | |
| if not G1.IsNode(n2): | |
| G1.AddNode(n2) | |
| G1.AddEdge(n1, n2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment