forked from coyotebush/github-network-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.py
More file actions
executable file
·23 lines (19 loc) · 720 Bytes
/
process.py
File metadata and controls
executable file
·23 lines (19 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
import csv
import igraph
g = igraph.Graph()
with open('repo-attributes.csv', 'rb') as repofile:
reader = csv.DictReader(repofile)
for repo in reader:
g.add_vertex(name=repo['repository_url'],
label=repo['repository_url'][19:],
language='(unknown)' if repo['repository_language'] == 'null'
else repo['repository_language'],
watchers=int(repo['repository_watchers']))
with open('repo-weights.csv', 'rb') as edgefile:
reader = csv.DictReader(edgefile)
for edge in reader:
g.add_edge(edge['repository1'], edge['repository2'],
weight=float(edge['weight']))
print g.summary()
g.write('repositories.gml')