Questions tagged [graph-tool]

Graph-tool is an efficient Python module for manipulation and statistical analysis of graphs (a.k.a. networks).

Graph-tool is an efficient Python module for manipulation and statistical analysis of graphs (a.k.a. networks). Contrary to most other Python modules with similar functionality, the core data structures and algorithms are implemented in C++, making extensive use of template metaprogramming, based heavily on the Boost Graph Library. This confers it a level of performance which is comparable (both in memory usage and computation time) to that of a pure C/C++ library.

Useful Links

283 questions
2
votes
1 answer

graph-tool: edge property cannot be set to type 'object'

I have worked with networkx and am trying graph-tool for potentially better performance. Working through the documentation I wish to create edges with properties. In networkx I can do something like this for some graph G: G.add_edge(vertex_1,…
MikeB2019x
  • 823
  • 8
  • 23
2
votes
0 answers

Is there a way in graph-tool to have an edge have the same color as the source vertex without a color gradient?

Is there a way in graph-tool to have an edge have the same color as its source vertex without having a gradient? I am referring to a graph such as these examples…
2
votes
1 answer

Set zorder for the labels (vertex_text) in graph_tool

I have a case in which vertex_text is hidden behind the one of the vertices (indicated by the red square in the image below). I have drawn this network using graph_tool's circular layout (minimize_nested_blockmodel_dl). In the graph_tools docs…
user3521099
2
votes
0 answers

What is the proper way to synchronously update graph properties and topology within a GTK loop in graph-tool?

I'm trying to find the neatest way to make an animation similar to this one, with the difference that I need to update the graph topology and the vertices' properties synchronously (it's a graph analog of the game of life). I have been doing so far…
izzorts
  • 106
  • 6
2
votes
2 answers

Trouble installing graph-tool package on google colab

I followed graph-tool installation instructions in the the following link(https://colab.research.google.com/github/count0/colab-gt/blob/master/colab-gt.ipynb#scrollTo=d_j7nNbKRmhx). However, it throws the following…
user206089
  • 21
  • 2
2
votes
1 answer

efficient way of calculating shortest path and distance with python's graph-tool

I have a dictionary representing origin and destination vertices, for example: { 0: [1,3], 1: [0,2], 2: [1], 3: [0,1,2], } The keys represent origin (or source) vertices and the values represent destinations for each origin…
megalodon
  • 63
  • 1
  • 5
2
votes
3 answers

Importing modules installed via Homebrew into Python

Installed graph-tool via homebrew using $ brew install graph-tool Installation was successful. Now, when I try to import the module in the python shell, using from graph_tool.all import * I receive a ModuleNotFoundError: No module named 'graph_tool'…
Aamod Pant
  • 21
  • 4
2
votes
1 answer

Python' s graph-tool: Generate egonet up n-th degree

It seems there's no built-in function in graph-tool library to generate a subgraph that contains all the neighbours of a certain node up to the n-th degree. The problem can be also framed as building an egonet around a node using n-degree…
balkon16
  • 1,338
  • 4
  • 20
  • 40
2
votes
1 answer

How to stop Python from printing out ignored Exceptions from other libraries?

I'm having a bit of a problem with how Python3 is handling a specific Exception, which should be ignored, but that gets printed out anyway at the end of execution along with a Traceback. Specifically, I use the graph-tool library to launch an…
Luca Giorgi
  • 910
  • 3
  • 14
  • 28
2
votes
0 answers

Python's graph-tool Segmentation fault on import

I'm experiencing a Segmentation fault while importing the graph-tool module into Python. I have conducted some tests: import graph_tool doesn't result in any problems. >>> import graph_tool as gt >>> gt.__version__ '2.29 (commit d4154c6c, Tue Aug…
balkon16
  • 1,338
  • 4
  • 20
  • 40
2
votes
1 answer

Graph-tool: How do you access the vertex value property map returned by add_edge_list?

I'm trying to get started using graph-tool for my company's analytics as a higher-performance replacement for networkx. I've managed to figure out a lot of things (plotting, getting centralities, degrees, etc.), but there's one thing that I cannot…
Bat Masterson
  • 1,164
  • 3
  • 11
  • 27
2
votes
1 answer

graph-tool: Efficient way to check if vertex exists before adding it

I understand that from here and the docs that find_vertex runs at O(N). I'm using the function to check if a vertex with a String property I'm adding already exists. Is this the optimal method to check if a graph already contains a vertex with a…
Francis
  • 137
  • 1
  • 10
2
votes
0 answers

How to generate a scale free network with a desired power law distribution and fixed average degrees via graph-tool?

I'm trying to reproduce the synthetic networks described in some papers. How to create scale-free networks with desired power-law degree distributions and fixed average degrees, P(k)=k^(-λ)? The lambda λ values and number of nodes (n) are given,…
Traphix
  • 49
  • 5
2
votes
0 answers

Graph_Tool - Initialize edge properties more efficiently

I am using graph-tool to calculate some centrality measures. from graph_tool.all import * graph = Graph(directed=True) Before I do that, I need to initialize the edge properties. I am doing the following: weight =…
alejo
  • 127
  • 2
  • 11
2
votes
1 answer

Load an edge-list into graph-tool

I want to load an edge-list into graph-tool. The vertex-indices in my list are not sequential, so I would like them to be automatically added as vertex_properties. As far as I understand this should be done with add_edge_list but I find that the…
Nick
  • 69
  • 5