Graphics Reference
In-Depth Information
nodemap[key] = node
return
Creating Directed Links
Creating links is similar to creating nodes. A source node and target node
are required. Given that the order of the original data was from , to , cc , the
first name on the distribution list is the source, and all subsequent names
are targets. For example, for a distribution list with four items ( Joe , Tim ,
Ben , Zoe ), you create three links ( Joe-Tim , Joe-Ben , and Joe-Zoe ).
# create directed links:
for i in range(1,len(distlist)):
addLink(distlist[0],distlist[i],kb)
The addLink function is similar to the addNode function. For a link, the
key can be the unique link that is the combination of the source and target
nodes.
def addLink(src, tgt, kbytes):
key = src + "..." + tgt
if key in linkmap:
link = linkmap[key]
link["count"] += 1
link["size"] += kbytes
else:
link = {"src": src, "tgt": tgt, "count": 1,
"size": kbytes}
linkmap[key] = link
return
Creating Undirected Links
Depending on the objective, you may want to identify connections between
all people on a distribution list based on the assumption that all people
who are copied on a message are linked together. In this case, you want
to use undirected links instead of directed links between all people in the
distributionlist.Youcanusethesame addLink functiontocreateeachlink,
but you have more links to create. Each person in the distribution list is part
ofthesamee-mail,andyoucreatealinkbetweeneachuniquepairofpeople.
Search WWH ::




Custom Search