diff --git a/README.md b/README.md index 140b952..b9d054b 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ # BellyDynamic [![Build Status](https://travis-ci.org/SamTube405/BellyDynamic.svg?branch=master)](https://travis-ci.org/SamTube405/BellyDynamic) -BellyDynamic: A scalable framework to handle online and offline dynamic graph objects - +BellyDynamic: A scalable framework to handle online and offline dynamic graph objects! ## Features: -- [x] Load graphs with node and edge labels (graph annotations) -- [x] An user-defined attribute schema for nodes and edges -- [x] Supports multi-graphs with network annotations -- [x] Represent temporal graphs as labeled graphs with timestamp as an edge attribute -- [x] Handle streaming updates +- [x] Load graphs with node and edge labels (graph annotations). +- [x] An user-defined attribute schema for nodes and edges. +- [x] Supports multi-graphs with network annotations. +- [x] Represent temporal graphs as labeled graphs with timestamp as an edge attribute. +- [x] Handle streaming updates. ## How to run: -- Install [snap] graph mining library (http://snap.stanford.edu/). +- Install [snap] graph mining library: (http://snap.stanford.edu/). - Test run: https://github.com/scorelab/BellyDynamic/wiki/How-to-Use +Check out the wiki for more information! + ## Sponsor: Google Summer of Code 2017 | SCoRE diff --git a/bellydynamic-metrics/Centrality.py b/bellydynamic-metrics/Centrality.py index cb14892..47ff149 100644 --- a/bellydynamic-metrics/Centrality.py +++ b/bellydynamic-metrics/Centrality.py @@ -81,31 +81,31 @@ def getOutputFileName(self, suffix): return self.graphName + suffix + ".txt" def genGraphInfoBetweeness(self, centrality): - print "\n+++++++++++ %s ++++++++++++" % (centrality) - print "Calculating centrality values..." + print ("\n+++++++++++ %s ++++++++++++" % (centrality)) + print ("Calculating centrality values...") start_time = time.clock() nodesKeyCentrVals = snap.TIntFltH() edgesKeyCentrVals = snap.TIntPrFltH() snap.GetBetweennessCentr(self.G, nodesKeyCentrVals, edgesKeyCentrVals, 1.0) - print "Computation time: %f secs." % (time.clock() - start_time) + print ("Computation time: %f secs." % (time.clock() - start_time)) outputFileName = self.getOutputFileName(centrality) - print "Generating the output -> %s" % (outputFileName) + print ("Generating the output -> %s" % (outputFileName)) output, topNodes = self.getHashmapText(nodesKeyCentrVals) self.writeOutput(outputFileName, output) - print "Top node labels: \n %s" % (topNodes) + print ("Top node labels: \n %s" % (topNodes)) return nodesKeyCentrVals def genGraphInfo(self, centrality, func): - print "\n+++++++++++ %s ++++++++++++" % (centrality) - print "Calculating centrality values..." + print ("\n+++++++++++ %s ++++++++++++" % (centrality)) + print ("Calculating centrality values...") start_time = time.clock() nodesKeysCentrVals = self.getCentr(func) - print "Computation time: %f secs." % (time.clock() - start_time) + print ("Computation time: %f secs." % (time.clock() - start_time)) outputFileName = self.getOutputFileName(centrality) - print "Generating the output -> %s" % (outputFileName) + print ("Generating the output -> %s" % (outputFileName)) output, topNodes = self.getHashmapText(nodesKeysCentrVals) self.writeOutput(outputFileName, output) - print "Top node labels: \n %s" % (topNodes) + print ("Top node labels: \n %s" % (topNodes)) return nodesKeysCentrVals diff --git a/bellydynamic-metrics/Structure.py b/bellydynamic-metrics/Structure.py index eba7eda..1b769c8 100644 --- a/bellydynamic-metrics/Structure.py +++ b/bellydynamic-metrics/Structure.py @@ -14,7 +14,7 @@ def initilize(self, fileName): self.G = self.getGraph() def genGraph(self, nodes): - print "Generating random graph..." + print("Generating random graph...") genFileName = 'random5000by6.txt' nodesV = snap.TIntV() for i in range(nodes): @@ -38,8 +38,8 @@ def genGraphInfo(self): graphName = self.graphName # get the number of nodes and edges in the graph - print "Number of nodes in %s: %d" % (graphName, self.G.GetNodes()) - print "Number of edges in %s: %d" % (graphName, self.G.GetEdges()) + print("Number of nodes in %s: %d" % (graphName, self.G.GetNodes())) + print("Number of edges in %s: %d" % (graphName, self.G.GetEdges())) # get the node id(s) with highest degree @@ -56,22 +56,22 @@ def genGraphInfo(self): if (maxDegree == node.GetOutDeg()): nodeIdsMaxDegreeT += str(node.GetId()) + "," - print "Node id(s) with highest degree in %s: %s" % (graphName, nodeIdsMaxDegreeT) + print ("Node id(s) with highest degree in %s: %s" % (graphName, nodeIdsMaxDegreeT)) # plot degree distribution snap.PlotOutDegDistr(self.G, graphName, "Degree Distribution") degreeFileName = "outDeg." + graphName + ".png" - print "Degree distribution of %s is in: %s" % (graphName, degreeFileName) + print ("Degree distribution of %s is in: %s" % (graphName, degreeFileName)) # plot shortest path distribution snap.PlotShortPathDistr(self.G, graphName, "Shortest Path Distribution") shortestPathFileName = "diam." + graphName + ".png" - print "Shortest path distribution of %s is in: %s" % (graphName, shortestPathFileName) + print ("Shortest path distribution of %s is in: %s" % (graphName, shortestPathFileName)) # get the fraction of nodes in largest cc - print "Fraction of nodes in largest connected component in %s: %f" % (graphName, snap.GetMxSccSz(self.G)) + print ("Fraction of nodes in largest connected component in %s: %f" % (graphName, snap.GetMxSccSz(self.G))) # plot the component size distribution snap.PlotSccDistr(self.G, graphName, "Component size distribution") sccFileName = "scc." + graphName + ".png" - print "Component size distribution of %s is in: %s" % (graphName, sccFileName) + print ("Component size distribution of %s is in: %s" % (graphName, sccFileName)) diff --git a/bellydynamic-travis/EdgeAttribute.py b/bellydynamic-travis/EdgeAttribute.py index 4f6d89d..a870284 100755 --- a/bellydynamic-travis/EdgeAttribute.py +++ b/bellydynamic-travis/EdgeAttribute.py @@ -27,21 +27,21 @@ def walkGraphEdgeAttributes(self, attribute_type, attribute_name): EI = self.G.BegEAIntI(attribute_name) while EI < self.G.EndEAIntI(attribute_name): if EI.GetDat() != 0: - print "Attribute: %s, Edge: %i, Val: %d" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %d" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() elif attribute_type == 2: EI = self.G.BegEAFltI(attribute_name) while EI < self.G.EndEAFltI(attribute_name): if EI.GetDat() != 0: - print "Attribute: %s, Edge: %i, Val: %f" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %f" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() elif attribute_type == 3: EI = self.G.BegEAStrI(attribute_name) while EI < self.G.EndEAStrI(attribute_name): if EI.GetDat() != "NA": - print "Attribute: %s, Edge: %i, Val: %s" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %s" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() @@ -55,4 +55,4 @@ def walkEdgeAttributes(self, EId): AttrLen = EIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Edge: %i, Attr: %s, Val: %s" % (EId, EIdAttrName.GetI(i)(), EIdAttrValue.GetI(i)()) + print ("Vertical Edge: %i, Attr: %s, Val: %s" % (EId, EIdAttrName.GetI(i)(), EIdAttrValue.GetI(i)())) diff --git a/bellydynamic-travis/MultiGraph.py b/bellydynamic-travis/MultiGraph.py index eca3736..a916427 100755 --- a/bellydynamic-travis/MultiGraph.py +++ b/bellydynamic-travis/MultiGraph.py @@ -4,9 +4,9 @@ def PrintGStats(s, Graph): - print "graph %s, nodes %d, edges %d, empty %s" % ( + print("graph %s, nodes %d, edges %d, empty %s" % ( s, Graph.GetNodes(), Graph.GetEdges(), - "yes" if Graph.Empty() else "no") + "yes" if Graph.Empty() else "no")) class MultiGraph: @@ -51,19 +51,19 @@ def loadBinaryGraph(self, fileName): self.G = snap.TNEANet(FIn) def walkNodes(self): - print "Nodes: " + print("Nodes: ") NCount = 0 NI = self.G.BegNI() while NI < self.G.EndNI(): - print NI.GetId() + print(NI.GetId()) NCount += 1 NI.Next() def walkEdges(self): - print "Edges: " + print("Edges: ") ECount = 0 EI = self.G.BegEI() while EI < self.G.EndEI(): - print EI.GetId() + print(EI.GetId()) ECount += 1 EI.Next() diff --git a/bellydynamic-travis/NodeAttribute.py b/bellydynamic-travis/NodeAttribute.py index c2de351..ac7923e 100755 --- a/bellydynamic-travis/NodeAttribute.py +++ b/bellydynamic-travis/NodeAttribute.py @@ -27,21 +27,21 @@ def walkGraphNodeAttributes(self, attribute_type, attribute_name): NI = self.G.BegNAIntI(attribute_name) while NI < self.G.EndNAIntI(attribute_name): if NI.GetDat() != 0: - print "Attribute: %s, Node: %i, Val: %d" % (attribute_name, NodeId, NI.GetDat()) + print ("Attribute: %s, Node: %i, Val: %d" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() elif attribute_type == 2: NI = self.G.BegNAFltI(attribute_name) while NI < self.G.EndNAFltI(attribute_name): if NI.GetDat() != 0: - print "Attribute: %s, Node: %i, Val: %f" % (attribute_name, NodeId, NI.GetDat()) + print ("Attribute: %s, Node: %i, Val: %f" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() elif attribute_type == 3: NI = self.G.BegNAStrI(attribute_name) while NI < self.G.EndNAStrI(attribute_name): if NI.GetDat() != "NA": - print "Attribute: %s, Node: %i, Val: %s" % (attribute_name, NodeId, NI.GetDat()) + print ("Attribute: %s, Node: %i, Val: %s" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() @@ -55,4 +55,4 @@ def walkNodeAttributes(self, NId): AttrLen = NIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Node: %i, Attr: %s, Val: %s" % (NId, NIdAttrName.GetI(i)(), NIdAttrValue.GetI(i)()) + print ("Vertical Node: %i, Attr: %s, Val: %s" % (NId, NIdAttrName.GetI(i)(), NIdAttrValue.GetI(i)())) diff --git a/bellydynamic-util/EdgeAttribute.py b/bellydynamic-util/EdgeAttribute.py index 820cba4..fe33c64 100755 --- a/bellydynamic-util/EdgeAttribute.py +++ b/bellydynamic-util/EdgeAttribute.py @@ -26,21 +26,21 @@ def walkGraphEdgeAttributes(self, attribute_type, attribute_name): EI = self.G.BegEAIntI(attribute_name) while EI < self.G.EndEAIntI(attribute_name): if EI.GetDat() != 0: - print "Attribute: %s, Edge: %i, Val: %d" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %d" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() elif attribute_type == 2: EI = self.G.BegEAFltI(attribute_name) while EI < self.G.EndEAFltI(attribute_name): if EI.GetDat() != 0: - print "Attribute: %s, Edge: %i, Val: %f" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %f" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() elif attribute_type == 3: EI = self.G.BegEAStrI(attribute_name) while EI < self.G.EndEAStrI(attribute_name): if EI.GetDat() != "NA": - print "Attribute: %s, Edge: %i, Val: %s" % (attribute_name, EdgeId, EI.GetDat()) + print("Attribute: %s, Edge: %i, Val: %s" % (attribute_name, EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() @@ -54,4 +54,4 @@ def walkEdgeAttributes(self, EId): AttrLen = EIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Edge: %i, Attr: %s, Val: %s" % (EId, EIdAttrName.GetI(i)(),EIdAttrValue.GetI(i)()) \ No newline at end of file + print("Vertical Edge: %i, Attr: %s, Val: %s" % (EId, EIdAttrName.GetI(i)(),EIdAttrValue.GetI(i)())) diff --git a/bellydynamic-util/MultiGraph.py b/bellydynamic-util/MultiGraph.py index 7ae0537..b6f7f28 100755 --- a/bellydynamic-util/MultiGraph.py +++ b/bellydynamic-util/MultiGraph.py @@ -4,7 +4,7 @@ def PrintGStats(s, Graph): - print "graph %s, nodes %d, edges %d, empty %s" % ( + print("graph %s, nodes %d, edges %d, empty %s" % ( s, Graph.GetNodes(), Graph.GetEdges(), "yes" if Graph.Empty() else "no") @@ -69,20 +69,20 @@ def loadBinaryGraph(self, fileName): self.G = snap.TNEANet(FIn) def walkNodes(self): - print "Nodes: " + print("Nodes:) NCount = 0 NI = self.G.BegNI() while NI < self.G.EndNI(): - print NI.GetId() + print(NI.GetId()) NCount += 1 NI.Next() def walkEdges(self): - print "Edges: " + print("Edges: ") ECount = 0 EI = self.G.BegEI() while EI < self.G.EndEI(): - print EI.GetId() + print(EI.GetId()) ECount += 1 EI.Next() diff --git a/bellydynamic-util/NodeAttribute.py b/bellydynamic-util/NodeAttribute.py index 9f999bf..1d71aee 100755 --- a/bellydynamic-util/NodeAttribute.py +++ b/bellydynamic-util/NodeAttribute.py @@ -26,21 +26,21 @@ def walkGraphNodeAttributes(self, attribute_type, attribute_name): NI = self.G.BegNAIntI(attribute_name) while NI < self.G.EndNAIntI(attribute_name): if NI.GetDat() != 0: - print "Attribute: %s, Node: %i, Val: %d" % (attribute_name, NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %d" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() elif attribute_type == 2: NI = self.G.BegNAFltI(attribute_name) while NI < self.G.EndNAFltI(attribute_name): if NI.GetDat() != 0: - print "Attribute: %s, Node: %i, Val: %f" % (attribute_name, NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %f" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() elif attribute_type == 3: NI = self.G.BegNAStrI(attribute_name) while NI < self.G.EndNAStrI(attribute_name): if NI.GetDat() != "NA": - print "Attribute: %s, Node: %i, Val: %s" % (attribute_name, NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %s" % (attribute_name, NodeId, NI.GetDat())) NodeId += 1 NI.Next() @@ -54,4 +54,4 @@ def walkNodeAttributes(self, NId): AttrLen = NIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Node: %i, Attr: %s, Val: %s" % (NId, NIdAttrName.GetI(i)(),NIdAttrValue.GetI(i)()) \ No newline at end of file + print("Vertical Node: %i, Attr: %s, Val: %s" % (NId, NIdAttrName.GetI(i)(),NIdAttrValue.GetI(i)())) diff --git a/bellydynamic-util/TemporalGraph.py b/bellydynamic-util/TemporalGraph.py index 1ad5601..68afb4e 100644 --- a/bellydynamic-util/TemporalGraph.py +++ b/bellydynamic-util/TemporalGraph.py @@ -12,9 +12,9 @@ def PrintGStats(s, Graph): Print graph statistics ''' - print "graph %s, nodes %d, edges %d, empty %s" % ( + print("graph %s, nodes %d, edges %d, empty %s" % ( s, Graph.GetNodes(), Graph.GetEdges(), - "yes" if Graph.Empty() else "no") + "yes" if Graph.Empty() else "no")) def DefaultConstructor(): @@ -80,15 +80,15 @@ def ManipulateNodesEdges(): ECount2 += 1 EI.Next() - print "graph ManipulateNodesEdges:Graph2, nodes %d, edges1 %d, edges2 %d" \ - % (NCount, ECount1, ECount2) + print("graph ManipulateNodesEdges:Graph2, nodes %d, edges1 %d, edges2 %d" \ + % (NCount, ECount1, ECount2)) # assignment Graph1 = Graph PrintGStats("ManipulateNodesEdges:Graph3", Graph1) # save the graph - print "graph type = ", type(Graph) + print("graph type = ", type(Graph)) FOut = snap.TFOut(snap.TStr(FName)) Graph.Save(FOut) FOut.Flush() @@ -137,7 +137,7 @@ def ManipulateNodeEdgeAttributes(): n = Graph.AddEdge(x, y) NCount -= 1 - print "Added nodes" + print("Added nodes") # create attributes and fill all nodes attr1 = snap.TStr("str") @@ -153,13 +153,13 @@ def ManipulateNodeEdgeAttributes(): Graph.AddIntAttrDatN(700, 700 * 2, attr2) Graph.AddIntAttrDatN(900, 900 * 2, attr2) - print "Added attributes" + print("Added attributes") NodeId = 0 NI = Graph.BegNAIntI(attr2) while NI < Graph.EndNAIntI(attr2): if NI.GetDat() != 0: - print "Attribute: %s, Node: %i, Val: %d" % (attr2(), NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %d" % (attr2(), NodeId, NI.GetDat())) NodeId += 1 NI.Next() @@ -180,7 +180,7 @@ def ManipulateNodeEdgeAttributes(): NodeId = 0 while NI < Graph.EndNAFltI(attr3): if NI.GetDat() != snap.TFlt.Mn: - print "Attribute: %s, Node: %i, Val: %f" % (attr3(), NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %f" % (attr3(), NodeId, NI.GetDat())) NodeId += 1 NI.Next() @@ -196,7 +196,7 @@ def ManipulateNodeEdgeAttributes(): NodeId = 0 while NI < Graph.EndNAStrI(attr1): if NI.GetDat() != snap.TStr.GetNullStr(): - print "Attribute: %s, Node: %i, Val: %s" % (attr1(), NodeId, NI.GetDat()) + print("Attribute: %s, Node: %i, Val: %s" % (attr1(), NodeId, NI.GetDat())) NodeId += 1 NI.Next() @@ -210,26 +210,26 @@ def ManipulateNodeEdgeAttributes(): Graph.AttrNameNI(NId, NIdAttrName) AttrLen = NIdAttrName.Len() for i in range(AttrLen): - print "Vertical Node: %i, Attr: %s" % (NId, NIdAttrName.GetI(i)()) + print("Vertical Node: %i, Attr: %s" % (NId, NIdAttrName.GetI(i)())) Graph.DelAttrDatN(NId, attr2) Graph.AttrNameNI(NId, NIdAttrName) AttrLen = NIdAttrName.Len() for i in range(AttrLen): - print "Vertical Node (no int) : %i, Attr: %s" % (NId, NIdAttrName.GetI(i)()) + print("Vertical Node (no int) : %i, Attr: %s" % (NId, NIdAttrName.GetI(i)())) Graph.AddIntAttrDatN(NId, 3 * 2, attr2) Graph.DelAttrN(attr1) Graph.AttrNameNI(NId, NIdAttrName) AttrLen = NIdAttrName.Len() for i in range(AttrLen): - print "Vertical Node (no str) : %i, Attr: %s" % (NId, NIdAttrName.GetI(i)()) + print("Vertical Node (no str) : %i, Attr: %s" % (NId, NIdAttrName.GetI(i)())) NIdAttrValue = snap.TStrV() Graph.AttrValueNI(NId, NIdAttrValue) AttrLen = NIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Node (no str) : %i, Attr_Val: %s" % (NId, NIdAttrName.GetI(i)()) + print("Vertical Node (no str) : %i, Attr_Val: %s" % (NId, NIdAttrName.GetI(i)())) for i in range(NNodes): Graph.AddIntAttrDatN(i, 70, attr2) @@ -240,7 +240,7 @@ def ManipulateNodeEdgeAttributes(): total += NI.GetDat() NI.Next() - print "Average: %i (should be 70)" % (total / NNodes) + print("Average: %i (should be 70)" % (total / NNodes)) # Test verticaliterator for edge Graph.AddIntAttrDatE(3, 3 * 2, attr2) @@ -251,8 +251,8 @@ def ManipulateNodeEdgeAttributes(): EI = Graph.BegEAIntI(attr2) while EI < Graph.EndEAIntI(attr2): if EI.GetDat() != snap.TInt.Mn: - print "E Attribute: %s, Edge: %i, Val: %i" \ - % (attr2(), EdgeId, EI.GetDat()) + print("E Attribute: %s, Edge: %i, Val: %i" \ + % (attr2(), EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() @@ -267,8 +267,8 @@ def ManipulateNodeEdgeAttributes(): while EI < Graph.EndEAFltI(attr3): # Check if defaults are set to 0. if EI.GetDat() != 0: - print "E Attribute: %s, Edge: %i, Val: %f" % \ - (attr3(), EdgeId, EI.GetDat()) + print("E Attribute: %s, Edge: %i, Val: %f" % \ + (attr3(), EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() @@ -282,8 +282,8 @@ def ManipulateNodeEdgeAttributes(): EI = Graph.BegEAStrI(attr1) while EI < Graph.EndEAStrI(attr1): if EI.GetDat() != snap.TStr.GetNullStr(): - print "E Attribute: %s, Edge: %i, Val: %s" % \ - (attr1(), EdgeId, EI.GetDat()) + print("E Attribute: %s, Edge: %i, Val: %s" % \ + (attr1(), EdgeId, EI.GetDat())) EdgeId += 1 EI.Next() @@ -297,26 +297,26 @@ def ManipulateNodeEdgeAttributes(): # Graph.AttrNameEI(EId, EIdAttrName) AttrLen = EIdAttrName.Len() for i in range(AttrLen): - print "Vertical Edge: %i, Attr: %s" % (EId, EIdAttrName.GetI(i)) + print("Vertical Edge: %i, Attr: %s" % (EId, EIdAttrName.GetI(i))) Graph.DelAttrDatE(EId, attr2) # Graph.AttrNameEI(EId, EIdAttrName) AttrLen = EIdAttrName.Len() for i in range(AttrLen): - print "Vertical Edge (no int) : %i, Attr: %s" % (EId, EIdAttrName.GetI(i)) + print("Vertical Edge (no int) : %i, Attr: %s" % (EId, EIdAttrName.GetI(i))) Graph.AddIntAttrDatE(EId, 3 * 2, attr2) Graph.DelAttrE(attr1) # Graph.AttrNameEI(EId, EIdAttrName) AttrLen = EIdAttrName.Len() for i in range(AttrLen): - print "Vertical Edge (no str) : %i, Attr: %s" % (EId, EIdAttrName.GetI(i)()) + print("Vertical Edge (no str) : %i, Attr: %s" % (EId, EIdAttrName.GetI(i)())) EIdAttrValue = snap.TStrV() Graph.AttrValueEI(snap.TInt(EId), EIdAttrValue) AttrLen = EIdAttrValue.Len() for i in range(AttrLen): - print "Vertical Edge (no str) : %i, Attr_Val: %s" % (EId, EIdAttrValue.GetI(i)()) + print("Vertical Edge (no str) : %i, Attr_Val: %s" % (EId, EIdAttrValue.GetI(i)())) for i in range(NEdges): Graph.AddIntAttrDatE(i, 70, attr2) @@ -327,15 +327,15 @@ def ManipulateNodeEdgeAttributes(): total += EI.GetDat() EI.Next() - print "Average: %i (should be 70)" % (total / NEdges) + print("Average: %i (should be 70)" % (total / NEdges)) Graph.Clr() if __name__ == '__main__': - print "----- DefaultConstructor -----" + print("----- DefaultConstructor -----") DefaultConstructor() - print "----- ManipulateNodesEdges -----" + print("----- ManipulateNodesEdges -----") ManipulateNodesEdges() - print "----- ManipulateNodesEdgesAttributes -----" + print("----- ManipulateNodesEdgesAttributes -----") ManipulateNodeEdgeAttributes()