graph-tool

Circular layout with edge bundling and labels in graph-tool

瘦欲@ 提交于 2021-02-19 05:39:05
问题 I am very new to graph visualizations and software like graph-tool (gt). My main field is mathematics, but I am somewhat familiar with Python and programming in general. However, I'm not a programmer, so my code may be less than elegant; any suggestions of improvement will be gratefully appreciated. Description: I am very fond of the circular layout with edge bundling used to visualize very large graphs. As an example, I am trying to plot the C.Elegans connectome using the wonderful Python

graph-tool - reading edge lists from pandas dataframe

拜拜、爱过 提交于 2020-01-24 13:41:47
问题 I'm starting working with graph-tool , importing a list of edges from a pandas dataframe df like: node1 node2 0 1 2 1 2 3 2 1 4 3 3 1 4 4 3 5 1 5 So basically a list of directed edges. I'm importing them into graph-tool according to the tutorial with: from graph_tool.all import * import pandas as pd # Read pandas dataframe df = pd.read_csv('file.csv') # Define Graph g = Graph(directed=True) # Add Edges g.add_edge_list(df.values) According to the Documentation of add_edge_list( edge_list ):

What is the optimal way to create a graph with add_edge_list() method?

纵饮孤独 提交于 2020-01-24 09:02:42
问题 I am trying to create large graph via graph-tool library (near 10^6 - 10^7 vertices) and fill vertex property with vertex name or use names instead of vertex indexes. I have: list of names: ['50', '56', '568'] set of edges, but instead of vertex indexes it consists of their names: edge_list = {frozenset({'568', '56'}), frozenset({'56', '50'}), frozenset({'50', '568'})} Since add_edge_list() allows to create vertices if they are no such vertix in the graph. I'm trying to use it to fill an

How to let python3 import graph-tool installed by Homebrew?

≯℡__Kan透↙ 提交于 2020-01-14 09:42:25
问题 I tried to use Homebrew to install graph-tool, but the python3 cannot find it. brew tap homebrew/science brew install graph-tool It is said that the package is installed in homebrew/science/graph-tool-2.22_1 , where I only found /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/graph-tool.rb . When I tried to import graph-tool in python3, it shows that from graph_tool.all import * ImportError: No module named 'graph_tool' I am using python3. which python3 /usr/local/bin/python3 Is

How to let python3 import graph-tool installed by Homebrew?

心已入冬 提交于 2020-01-14 09:42:07
问题 I tried to use Homebrew to install graph-tool, but the python3 cannot find it. brew tap homebrew/science brew install graph-tool It is said that the package is installed in homebrew/science/graph-tool-2.22_1 , where I only found /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/graph-tool.rb . When I tried to import graph-tool in python3, it shows that from graph_tool.all import * ImportError: No module named 'graph_tool' I am using python3. which python3 /usr/local/bin/python3 Is

Explicit vertex position in python graph-tool

烂漫一生 提交于 2020-01-13 10:00:11
问题 I am using python graph-tool. To draw graphs, it uses graph_draw function. I want to send vertex positions explicitly to dot engine. It turns out that I can pass a property map named pos . I tried defining it as v_pos = g.new_vertex_property("vector<double>") where g is my graph. I am not sure if it is the right way to do it. There is one code snippet which you might find helpful. pos = gt.random_layout(g, shape=shape, dim=3) >>> pos[g.vertex(0)].a array([ 86.59969709, 1.31435598, 0.64651486]

How do I access Class fields in Python Graph-Tool property maps?

坚强是说给别人听的谎言 提交于 2019-12-25 19:12:43
问题 I'm trying to draw a graph with a class as a vertex property. How do I draw the graph with the vertex_text set to the name field of the classes they contain? from graph_tool.all import * class Node(object): def __init__(self, name, age): self.symbol = name self.named_entity = age #create your graph object g = Graph() #add the property to vertex object vprop = g.new_vertex_property("object") #add vertex v1 = g.add_vertex() #here you create a vertex v2 = g.add_vertex() #here you create a vertex

How do I access Class fields in Python Graph-Tool property maps?

社会主义新天地 提交于 2019-12-25 19:11:15
问题 I'm trying to draw a graph with a class as a vertex property. How do I draw the graph with the vertex_text set to the name field of the classes they contain? from graph_tool.all import * class Node(object): def __init__(self, name, age): self.symbol = name self.named_entity = age #create your graph object g = Graph() #add the property to vertex object vprop = g.new_vertex_property("object") #add vertex v1 = g.add_vertex() #here you create a vertex v2 = g.add_vertex() #here you create a vertex