-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphExpansionPack.py
28 lines (18 loc) · 1.21 KB
/
GraphExpansionPack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#class that incapsulates all possible extensions to the basic collaboration graph
import FileNodeExpansionPack
import numbers
class GraphExpansionPack:
def __init__(self,baseGraph):
self.baseGraph = baseGraph
self.fileNodeExpansion = FileNodeExpansionPack.FileNodeExpansionPack(baseGraph.getNodeIterator(),baseGraph.getNodesList(),baseGraph.getClusterNodesList())
#expand the base graph with file nodes that give a notion of the isolated files a programmer works on
#@return a dictionary with the file nodes and edges lists in respectively "nodes" and "edges"
def expandWithFileNodes(self):
newNodeIterator = self.fileNodeExpansion.createFileNodes()
if(isinstance(newNodeIterator,numbers.Number)):
self.baseGraph.setNodeIterator(newNodeIterator)
fileNodesList = self.fileNodeExpansion.getNodesList()
fileEdgesList = self.fileNodeExpansion.getEdgesList()
clusterFileNodesList = self.fileNodeExpansion.getClusterNodesList()
clusterFileEdgesList = self.fileNodeExpansion.getClusterEdgesList()
return {"nodes":fileNodesList,"edges":fileEdgesList,"clusternodes": clusterFileNodesList,"clusteredges":clusterFileEdgesList}