Graphics Reference
In-Depth Information
name = name.strip()
# add the name to the distribution
list
if (name!=""):
distlist.append(name)
# create the nodes
for i in range(0,len(distlist)):
addNode(distlist[i],kb)
# undirected graph:
# create links between each pair in
thedistlist
for i in range(0,len(distlist)):
for j in range (i+1,len(distlist)):
if distlist[i] < distlist[j]:
source = distlist[i]
target = distlist[j]
else:
source = distlist[j]
target = distlist[i]
addLink(source,target,kb)
#write out nodes
with open("nodes.csv", "w", newline="") as csvfile:
formatter = csv.writer(csvfile)
formatter.writerow(["Node","NumEmail","SumSize"])
for key in nodemap:
node = nodemap[key]
formatter.writerow([node["id"],node["count"],node["size"]])
#write out the links
with open("links.csv", "w", newline="") as csvfile:
formatter = csv.writer(csvfile)
formatter.writerow(["Source","Target","NumEmail","SumSize"])
for key in linkmap:
lk = linkmap[key]
Search WWH ::




Custom Search