alpha = minAlpha + t * (maxAlpha - minAlpha) color = vColor[n] color[3] = int(alpha) self.result[n] = color else: minValue = inputMetric.getEdgeDoubleMin(self.graph) maxValue = inputMetric.getEdgeDoubleMax(self.graph) for e in self.graph.edges(): val = inputMetric[e] t = getFactor(val - minValue, maxValue - minValue) alpha = minAlpha + t * (maxAlpha - minAlpha) color = vColor[e] color[3] = int(alpha) self.result[e] = color return True pluginDoc = """ Map metric values to alpha component of graph element colors. In other words, it enables to compute the graph elements transparency according to the values stored in a numeric property of a graph. """ # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin('AlphaMapping', 'Alpha Mapping', 'Antoine Lambert', '20/04/2017', pluginDoc, '1.1')
viewLabel[newClus] = name viewLabelPosition[newClus] = LabelPositionCluster viewSize[newClus] = tlp.Size(10,10,10) viewColor[newClus] = ColorMetanode TypeNode[newClus] = "Cluster" IdNeo4j[newClus] = str(remote(NewNeo4jClus)._id) viewBorderWidth[newClus] = BorderWidthCluster Nb_Track[newClus] = Nb_Total_Track image_file = open("temp_image/image_Texture_NewAnnotation" + str(name) + str(Nb_Total_Track) + ".jpg","wb") image_file.write(texture.decode('base64')) image_file.close() path_image = "temp_image/image_Texture_NewAnnotation" + str(name) + str(Nb_Total_Track) + ".jpg" viewTexture[newClus] = path_image viewBorderColor[newClus] = ColorBorderUnknow for node_to_connect in list_node_to_connect: self.graph.addEdge(node_to_connect,newClus) parameter_dict = tlp.getDefaultPluginParameters('Fast Overlap Removal') parameter_dict["x border"] = 5 parameter_dict["y border"] = 5 self.graph.applyLayoutAlgorithm("Fast Overlap Removal", viewLayout,parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jAnnotation", "Adrien", "26/08/2016", "Neo4JCluster", "1.0")
from tulip import * import tulipplugins class Test(tlp.Algorithm): def init(self, context): tlp.Algorithm.init(self, context) self.addStringParameter("property", "the property to set", "", True, True, True) def check(self): return (True, "") def run(self): return True tulipplugins.registerPlugin("Test", "A simple Python plugin test", "", "19/07/2016", "", "1.0")
# set edge colors and border colors to be fully transparent colors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) borderColors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) # set new border color for nodes borderColors.setAllNodeValue(borderColor) # ensure node borders are visible borderWidths.setAllNodeValue(1.0) # set the square shape to all leaf nodes for n in self.graph.getNodes(): if self.graph.outdeg(n) == 0: shapes[n] = tlp.NodeShape.Square return True pluginDoc = ''' Enables to easily configure a treemap layout visualisation for a tree. As the treemap layout is different from classical node link diagram representation, some visual properties setup has to be done in order to get an aesthetic visualization of it in Tulip. This plugin takes care of calling the 'Squarified Tree Map' layout algorithm and adjust some visual properties to get a correct rendering of the treemap. ''' # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("SquarifiedTreeMapHelper", "Squarified Tree Map Helper", "Antoine Lambert", "27/04/2017", pluginDoc, "1.0")
self.graph.applyLayoutAlgorithm('Squarified Tree Map', layout, params) # set edge colors and border colors to be fully transparent colors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) borderColors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) # set new border color for nodes borderColors.setAllNodeValue(borderColor) # ensure node borders are visible borderWidths.setAllNodeValue(1.0) # set the square shape to all leaf nodes for n in self.graph.getNodes(): if self.graph.outdeg(n) == 0: shapes[n] = tlp.NodeShape.Square return True pluginDoc=''' Enables to easily configure a treemap layout visualisation for a tree. As the treemap layout is different from classical node link diagram representation, some visual properties setup has to be done in order to get an aesthetic visualization of it in Tulip. This plugin takes care of calling the 'Squarified Tree Map' layout algorithm and adjust some visual properties to get a correct rendering of the treemap. ''' # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("SquarifiedTreeMapHelper", "Squarified Tree Map Helper", "Antoine Lambert", "27/04/2017", pluginDoc, "1.0")
MainviewBorderWidth[NewMetaNode] = MainBorderWidthCluster image_file = open( "temp_image/image_Texture_NewCluster" + str(remote(Newclus)._id) + ".jpg", "wb") image_file.write(Newtexture.decode('base64')) image_file.close() path_image = "temp_image/image_Texture_NewCluster" + str( remote(Newclus)._id) + ".jpg" MainviewTexture[NewMetaNode] = path_image for node_adjacent in list_node_to_connect: graphMain.addEdge(NewMetaNode, node_adjacent) parameter_dict = tlp.getDefaultPluginParameters( 'Fast Overlap Removal') parameter_dict["x border"] = 5 parameter_dict["y border"] = 5 graphMain.applyLayoutAlgorithm("Fast Overlap Removal", MainviewLayout, parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4j Extract Tracks And Create New Cluster", "Adrien", "31/08/2016", "", "1.0")
#print(prop.getNodeStringValue(node)) size = prop.getNodeStringValue(node)[1:-1].split(',') size = (int(size[0]) + int(size[1])) / 2 os << '"size":%s, ' % size # node layout elif prop.getName() == "viewLayout": coord = prop.getNodeStringValue(node)[1:-1].split(',') os << '"x":%s, ' % coord[0] os << '"y":%s, ' % (float(coord[1]) * (-1)) # other elif prop.getNodeDefaultStringValue() != prop.getNodeStringValue(node) \ and prop.getNodeStringValue(node): value = prop.getNodeStringValue(node).replace('\\', '\\\\') value = value.replace('"', '\\\"') # .replace('"', '\\\"')\ # .replace("\n", "")\ # .replace("\r", "")\ # .replace("\t", "") os << '"%s":"%s", ' % (prop.getName(), value) # sigma id os << '"id":"%s"' % node.id os << ' }' os << ']} ' return True # The line below does the magic to register the plugin to the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("ExportSigma", "SIGMA JSON Export", "Norbert Feron", "01/06/2016", "Export to sigma.js JSON format", "1.0")
capacity=bipart_g.getDoubleProperty("capacity"); capacity.setAllEdgeValue(0.); for e in bipart_g.getEdges() : eo=bipart_g.addEdge(bipart_g.target(e),bipart_g.source(e)); capacity[e]=1.; ## init flow flow=bipart_g.getDoubleProperty("flow"); flow.setAllEdgeValue(0.); ## compute the maximum matching in the bipartite graph using a maximum flow algorithm maximumFlow.getMaxFlow(bipart_g,s,t,capacity,flow); ## get the results bipart_g.delNode(s); bipart_g.delNode(t); for e in bipart_g.getEdges() : if flow[e]>0 : if e not in map_oends.keys() : print "Error: unknown edge in maximum matching." return False; self.result[map_oends[e]]=True; # for n in bipart_g.getNodes() : # self.graph.delNode(n); # self.graph.delAllSubGraphs(bipart_g); return True #################################################################################### # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("VertexCycleCover", "Vertex-Disjoint Cycle Cover", "Francois Queyroi", "30/11/2017", "Find a Vertex-Disjoint Cycle Cover", "1.0")
## if the assignment is not secret (due to e1) we remove e1 and look for a new assignment if not keep_e1: result_found = False G.delEdge(e1) break ## get the results if not self.oriented: for e in self.graph.getEdges(): if not copy.isElement(e): if self.result[e]: s, t = self.graph.ends(e) oe = self.graph.existEdge(t, s, True) self.result[oe] = True self.graph.delEdge(e) self.graph.delAllSubGraphs(G) self.graph.delAllSubGraphs(copy) if not result_found: self.pluginProgress.setError("Graph " + self.graph.getName() + " has no Secret Santa Assignment !") self.result.setAllEdgeValue(False) return result_found #################################################################################### # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("SecretSanta", "Secret Santa", "Francois Queyroi", "30/11/2017", "Find a Secret Santa Assignment", "1.0")
idTrack = IdNeo4j[NodeTlp] viewBorderColor[NodeTlp] = ColorBorderValide statement = 'MATCH (clus) '\ 'WHERE ID(clus)=' + str(idMeta) + \ ' MATCH (track) '\ 'WHERE ID(track)=' + str(idTrack) + \ ' MATCH (clus)-[r:CLUSTERED]->(track) '\ 'SET r.isValidated = "Valide"' graphNeo4j.run(statement) else: #Sinon c'est qu'on est sur le graph Main. Seul les cluster peuvent etre valides for NodeTlp in viewSelection.getNodesEqualTo(True): if TypeNode[NodeTlp] == "Cluster": idCluster = IdNeo4j[NodeTlp] viewBorderColor[NodeTlp] = ColorBorderValide statement = 'MATCH (algo:Algo {name:"' + 'user_defined' + '"}) '\ ' MATCH (clus) '\ 'WHERE ID(clus)=' + str(idCluster) + \ ' OPTIONAL MATCH (clus)-[r:INVALIDATED_BY]->(algo) '\ 'DELETE r '\ 'MERGE (clus)-[:VALIDATED_BY]->(algo)' graphNeo4j.run(statement) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jValidate", "Adrien", "29/08/2016", "Neo4JCluster", "1.0")
from tulip import * from SqlReader import * from GraphView import * import tulipplugins import ntpath class SQLImport(tlp.ImportModule): def __init__(self, context): tlp.ImportModule.__init__(self, context) self.addStringParameter("file::SQL script", "Script SQL you want to add in a graph") # You can add parameters to the plugin here through the following syntax: # self.add<Type>Parameter("<paramName>", "<paramDoc>", "<paramDefaultValue>") # (see the documentation of class tlp.WithParameter to see what parameter types are supported). def importGraph(self): filename = self.dataSet["file::SQL script"]; name = ntpath.basename(filename) self.graph.setName(name) sql_reader = SqlReader(filename, self.graph) sql_reader.compute_diagram() g = GraphView(self.graph) g.set_view() return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("SQLImport", "Import SQL", "", "12/06/2017", "", "1.0")
# Loop over all edges. If edge is a gap junction, then search for a gap junction going the other direction. for edge in graph.getEdges(): edgeType = tp.utils.getEdgeType(edge, graph) if edgeType == self.dataSet[self._edgeTypeLabel]: source = graph.source(edge) target = graph.target(edge) links = linkedStructures[edge] if not self.findInverseEdge(graph, source, target, links): output = str(tp.utils.getNodeId( source, graph)) + "-" + tp.utils.getNodeType( source, graph) + "; " + str( tp.utils.getNodeId( target, graph)) + "-" + tp.utils.getNodeType( target, graph) + "; " + links viewSelection[edge] = True self.printToFile(output) self.endFileOutput() return True # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("BidirectionalSynapseCleanup", "Find Missing Bidirectional Synapses", "Kerzner", "12/01/2017", "", "1.0")
from FindPathsPlugin import FindPathsPlugin import tulipplugins class FindPaths0(FindPathsPlugin): """ Tulip plugin algorithm which searches for 1-hop paths """ def __init__(self, context): FindPathsPlugin.__init__(self, context, 0) # The line below does the magic to register the plugin to the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("FindPaths0", "Find Nodes (Regex)", "Nathaniel Nelson", "9/3/2016", "", "1.0")
day = int(dict(record[0][2])["name"]) month = int(dict(record[0][3])["name"]) year = int(dict(record[0][4])["name"]) num_track = int(dict(record[0][1])["num_track"]) num_shot = int(dict(record[0][1])["num_shot"]) #infos = year + "_" + month + "_" + day + "_" + num_shot + "_" + num_track infos = "%04d_%02d_%02d_19_00-shot%02d_%d-Track%d"%(year,month,day,day,num_shot,num_track) dict_cluster[infos] = "Cluster " + str(num_clus) namefile = "" for d in dateStart: namefile += d + "_" namefile += "to_" for d in dateEnd: namefile += d + "_" namefile = namefile[0:-1] with open('Resultat_cluster/' + namefile + '.json', 'w') as f: json.dump(dict_cluster, f, indent=4,sort_keys=True) f.close() return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "neo4j Clusters to file", "Adrien", "07/09/2016", "", "1.0")
continue; for num in xrange(2, len(fieldnames)): patient = fieldnames[num] if row[patient] == '': continue if not patient in addedNodes: addedNodes[patient] = self.create_node(node, patient, createParams) createParams['coords'] -= tlp.Vec3f(10,0,0) edge = self.graph.addEdge(addedNodes[patient], node, {self.EDGE_TYPE_COL:row[patient], "viewColor":createParams['edgesColor']}) self.pluginProgress.progress(i, rlen) if self.pluginProgress.state() == tlp.TLP_CANCEL: self.graph.delNodes(addedNodes.values(), True) return 0; def getUserColor(self, param): try: c = self.dataSet[param] color = tlp.Color(c.getR(),c.getG(),c.getB(),c.getA()) return color except Exception: return tlp.Color(0,0,0,255); def printerr(self, message): self.pluginProgress.setError(message) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("MergeSamples", "VisuDNA - Merge Samples", "SB", "27/11/2017", "", "1.0")
for e in main_sub.getEdges(): viewSize[e] = e2size[e] n2size = {n: viewSize[n] for n in main_sub.getNodes()} parameter_dict = tlp.getDefaultPluginParameters('Size Mapping') parameter_dict["result"] = viewSize parameter_dict["input"] = viewSize parameter_dict["property"] = Nb_Track parameter_dict["node/edge"] = False parameter_dict["min size"] = 0.2 parameter_dict["max size"] = 3.0 parameter_dict["area proportional"] = "Area Proportional" main_sub.applySizeAlgorithm("Size Mapping", viewSize, parameter_dict) for n in main_sub.getNodes(): viewSize[n] = n2size[n] parameter_dict = tlp.getDefaultPluginParameters('Fast Overlap Removal') parameter_dict["x border"] = 5 parameter_dict["y border"] = 5 main_sub.applyLayoutAlgorithm("Fast Overlap Removal", viewLayout, parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jConnect", "Adrien", "16/08/2016", "Neo4JCluster", "1.0")
num_shot) + "_" + str(num_track) + ".jpg" viewTexture[node_track] = path_image viewLayout[node_track] = tlp.Coord( ReferencePositionX + float(SizePicture / 2.0), ReferencePositionY + float(SizePicture / 2.0), 0) node_date = Rootgraph.addNode() subgraph.addNode(node_date) viewSize[node_date] = SizeYear viewShape[node_date] = ShapeYear viewColor[node_date] = ColorYear viewLabel[node_date] = year viewLayout[node_date] = tlp.Coord( (ReferencePositionX + SizePicture + ReferencePositionDebutYearX) / 2.0 + 30.0, ReferencePositionDebutYearY - 80, 0) ReferencePositionX = 0.0 ReferencePositionY = ReferencePositionDebutYearY + float( MaxHauteur) * (float(SizePicture) + float(SizeInterPicture)) + 115.0 AirtimeMeta[Metanode] = airtime return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jLoadHistogramme", "Adrien", "24/08/2016", "Neo4JCluster", "1.0")
from FindPathsPlugin import FindPathsPlugin import tulipplugins class FindPaths1(FindPathsPlugin): """ Tulip plugin algorithm which searches for 1-hop paths """ def __init__(self, context): FindPathsPlugin.__init__(self, context, 1) # The line below does the magic to register the plugin to the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("FindPaths1", "Find 1-Hop Paths (Regex)", "Nathaniel Nelson", "9/3/2016", "", "1.0")
alpha = minAlpha + t * (maxAlpha - minAlpha) color = self.result[n] color[3] = int(alpha) self.result[n] = color else: minValue = inputMetric.getEdgeDoubleMin(self.graph) maxValue = inputMetric.getEdgeDoubleMax(self.graph) for e in self.graph.getEdges(): val = inputMetric[e] t = getFactor(val - minValue, maxValue - minValue) alpha = minAlpha + t * (maxAlpha - minAlpha) color = self.result[e] color[3] = int(alpha) self.result[e] = color return True pluginDoc = ''' Map metric values to alpha component of graph element colors. In other words, it enables to compute the graph elements transparency according to the values stored in a numeric property of a graph. ''' # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("AlphaMapping", "Alpha Mapping", "Antoine Lambert", "20/04/2017", pluginDoc, "1.0")
label = str(record.type()) print label if label == "VALIDATED_BY": viewBorderColor[NewNode] = ColorBorderValide elif label == "INVALIDATED_BY": viewBorderColor[NewNode] = ColorBorderInvalide viewBorderColor[NewNode] = ColorBorderUnknow viewSize[NewNode] = tlp.Size(10, 10, 10) viewColor[NewNode] = ColorCluster if str(nameClus) != "": viewLabel[NewNode] = str(nameClus) viewLabelPosition[NewNode] = LabelPositionMetanode viewShape[NewNode] = ShapeMetanodeAnnote else: viewShape[NewNode] = ShapeMetanodeNotAnnote parameter_dict = tlp.getDefaultPluginParameters('Fast Overlap Removal') parameter_dict["x border"] = 5 parameter_dict["y border"] = 5 self.graph.applyLayoutAlgorithm("Fast Overlap Removal", viewLayout, parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jMerge", "Adrien", "26/08/2016", "Neo4JCluster", "1.0")
from tulip import tlp import tulipplugins class Test(tlp.Algorithm): def init(self, context): tlp.Algorithm.init(self, context) self.addStringParameter("property", "the property to set", "", True, True, True) def check(self): return (True, "") def run(self): return True tulipplugins.registerPlugin("Test", "A simple Python plugin test", "", "19/07/2016", "", "1.0")
self.simple = True self.icon.configure(image=self.simple_link_icon) self.type_frame.grid() self.min_frame.grid_remove() self.middle_frame.grid_remove() self.max_frame.grid_remove() update_global_query() def update_max(self): """Update max spinner value if min value is greater""" if self.max.get() < self.min.get(): self.max.set(self.min.get()) def update_min(self): """Update min spinner value if max value is lower""" if self.max.get() < self.min.get(): self.min.set(self.max.get()) init = Node() init.update_name_list() update_global_query() work_frame.on_frame_configure() root.mainloop() return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("NeOmics", "Query Maker", "Eliot Ragueneau et Jean Clément Gallardo", "11/05/2019", "Help to build a cypher query describing a neo4j graph that will be drawn on Tulip", "1.0")
year) + "_" + str(month) + "_" + str( day) + "_" + str(num_shot) + "_" + str( num_track) + ".jpg" viewTexture[track_node] = path_image parameter_dict = tlp.getDefaultPluginParameters('FM^3 (OGDF)') parameter_dict["Unit edge length"] = 3 subgraphAlgoLayout.applyLayoutAlgorithm( "FM^3 (OGDF)", viewLayout, parameter_dict) Correction = viewLayout[NodeTlp] - initialLayout for node_to_modify in subgraphAlgoLayout.getNodes(): viewLayoutMain[node_to_modify] = tlp.Coord( viewLayout[node_to_modify][0] - Correction[0], viewLayout[node_to_modify][1] - Correction[1], viewLayout[node_to_modify][2] - Correction[2]) print viewLayout[NodeTlp] self.graph.delSubGraph(subgraphAlgoLayout) parameter_dict = tlp.getDefaultPluginParameters('Fast Overlap Removal') parameter_dict["x border"] = 1 parameter_dict["y border"] = 1 self.graph.applyLayoutAlgorithm("Fast Overlap Removal", viewLayout, parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4j Explore Date", "Adrien", "02/09/2016", "", "1.0")
idTrack = IdNeo4j[NodeTlp] viewBorderColor[NodeTlp] = ColorBorderInvalide statement = 'MATCH (clus) '\ 'WHERE ID(clus)=' + str(idMeta) + \ ' MATCH (track) '\ 'WHERE ID(track)=' + str(idTrack) + \ ' MATCH (clus)-[r:CLUSTERED]->(track) '\ 'SET r.isValidated = "NotValide"' graphNeo4j.run(statement) else: #Sinon c'est qu'on est sur le graph Main. Seul les cluster peuvent etre valides for NodeTlp in viewSelection.getNodesEqualTo(True): if TypeNode[NodeTlp] == "Cluster": idCluster = IdNeo4j[NodeTlp] viewBorderColor[NodeTlp] = ColorBorderInvalide statement = 'MATCH (algo:Algo {name:"' + 'user_defined' + '"}) '\ ' MATCH (clus) '\ 'WHERE ID(clus)=' + str(idCluster) + \ ' OPTIONAL MATCH (clus)-[r:VALIDATED_BY]->(algo) '\ 'DELETE r '\ 'MERGE (clus)-[:INVALIDATED_BY]->(algo)' print statement graphNeo4j.run(statement) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jInvalidate", "Adrien", "29/08/2016", "", "1.0")
fm3Properties = tlp.getDefaultPluginParameters('FM^3 (OGDF)', graph=None) fm3Properties['Edge Length Property'] = self.distance self.graph.applyLayoutAlgorithm('FM^3 (OGDF)', self.viewLayout, fm3Properties) def colorLoci(self): self.colorLociByExpression('intergenic', tlp.Color(222, 212, 195, 80)) self.colorLociByExpression('up', tlp.Color(0, 255, 0)) self.colorLociByExpression('down', tlp.Color(255, 0, 0)) self.colorLociByExpression('stable', tlp.Color(0, 0, 0, 80)) self.colorLociByExpression('', tlp.Color(0, 0, 0, 80)) self.colorLociByExpression('nan', tlp.Color(255, 230, 255, 80)) def colorLociByExpression(self, expression, color): for loci in self.expression.getNodesEqualTo(expression): self.viewColor[loci] = color def colorInteractions(self): self.colorInteractionsByStatus('gain', tlp.Color(0, 255, 0)) self.colorInteractionsByStatus('stable', tlp.Color(0, 0, 0, 80)) self.colorInteractionsByStatus('loss', tlp.Color(255, 0, 0)) def colorInteractionsByStatus(self, interactionStatus, color): for interaction in self.interactionStatus.getEdgesEqualTo(interactionStatus): self.viewColor[interaction] = color def setLociSize(self): self.viewSize.setAllNodeValue(tlp.Vec3f(1e5, 1e5, 0.5)) tulipplugins.registerPlugin("InteractionNetwork", "Interaction Network", "AM2E", "28/01/2020", "", "1.0")
statement = 'MATCH (user_defined:User_Defined_Cluster) '\ 'MATCH (user_defined)-[r]-() '\ 'DELETE r ' tx.run(statement) statement = 'MATCH (user_defined:User_Defined_Cluster) '\ 'DELETE user_defined' tx.run(statement) statement = 'MATCH ()-[r:CLUSTERED]->() '\ 'SET r.isValidated = "Unknow" ' tx.run(statement) statement = 'MATCH (n) '\ 'WHERE size(labels(n)) = 0 '\ 'DELETE n' tx.run(statement) tx.commit() neo4j_commit.correct_name(graphNeo4j) neo4j_commit.merge_overlap_cluster(graphNeo4j) neo4j_commit.load_all_texture(graphNeo4j) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jClearAllModification", "Adrien", "29/08/2016", "", "1.0")
delta.setAllNodeValue(0.) ancestors, stack, nb_paths = self.shortestPaths(src, chossen_iterator) while len(stack) > 0: w = stack.pop() flow_sw = self.flow_amount(src, w)/2. # flow divided by two since flows are undirected total_flow += flow_sw if w != src : self.result[w] += delta[w] for v in ancestors[w] : inc_delta = (nb_paths[v]/nb_paths[w])*(flow_sw + delta[w]) delta[v] += inc_delta e = self.graph.existEdge(v, w, False) if self.dataSet["type"] == "Out": e = self.graph.existEdge(v, w, True) if self.dataSet["type"] == "In": e = self.graph.existEdge(w, v, True) self.result[e] += inc_delta val = 1. if self.cost is not None: val = self.cost[e] avg_path_length += val * inc_delta self.dataSet["average path length"] = avg_path_length self.dataSet["total flow"] = total_flow return True ######################################################################################################### tulipplugins.registerPlugin("BetweennessGravityModel", "Betweenness Gravity Model", "Francois Queyroi", "02/04/2019", "", "1.0")
colors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) borderColors.setAllEdgeValue(tlp.Color(0, 0, 0, 0)) # set new border color for nodes borderColors.setAllNodeValue(borderColor) # ensure node borders are visible borderWidths.setAllNodeValue(1.0) # set the square shape to all leaf nodes for n in self.graph.getNodes(): if self.graph.outdeg(n) == 0: shapes[n] = tlp.NodeShape.Square return True pluginDoc = """ Enables to easily configure a treemap layout visualisation for a tree. As the treemap layout is different from classical node link diagram representation, some visual properties setup has to be done in order to get an aesthetic visualization of it in Tulip. This plugin takes care of calling the 'Squarified Tree Map' layout algorithm and adjust some visual properties to get a correct rendering of the treemap. """ # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin('SquarifiedTreeMapHelper', 'Squarified Tree Map Helper', 'Antoine Lambert', '27/04/2017', pluginDoc, '1.0')
val = inputMetric[n] t = getFactor(val - minValue, maxValue - minValue) alpha = minAlpha + t * (maxAlpha - minAlpha) color = vColor[n] color[3] = int(alpha) self.result[n] = color else: minValue = inputMetric.getEdgeDoubleMin(self.graph) maxValue = inputMetric.getEdgeDoubleMax(self.graph) for e in self.graph.edges(): val = inputMetric[e] t = getFactor(val - minValue, maxValue - minValue) alpha = minAlpha + t * (maxAlpha - minAlpha) color = vColor[e] color[3] = int(alpha) self.result[e] = color return True pluginDoc = ''' Map metric values to alpha component of graph element colors. In other words, it enables to compute the graph elements transparency according to the values stored in a numeric property of a graph. ''' # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("AlphaMapping", "Alpha Mapping", "Antoine Lambert", "20/04/2017", pluginDoc, "1.1")
'MATCH (label)-[allRel]-() '\ 'DELETE r ' if nb_rel == 1: statement += 'DELETE allRel '\ 'DELETE label' graphNeo4j.run(statement) statement = 'MATCH (clus) '\ 'WHERE ID(clus)='+ str(remote(clusNeo4j)._id) + \ ' MATCH (clus)-[r]-() '\ 'DELETE r '\ 'DELETE clus' graphNeo4j.run(statement) #We suprress the MetaCluster if there is no track left graphRoot.delNode(MetaCluster) parameter_dict = tlp.getDefaultPluginParameters( 'Fast Overlap Removal') parameter_dict["x border"] = 5 parameter_dict["y border"] = 5 graphMain.applyLayoutAlgorithm("Fast Overlap Removal", MainviewLayout, parameter_dict) return True # The line below does the magic to register the plugin into the plugin database # and updates the GUI to make it accessible through the menus. tulipplugins.registerPlugin("Main", "Neo4jRemoveFromCluster", "Adrien", "29/08/2016", "", "1.0")