# Questions tagged [graph-tool]

Graph-tool is an efficient Python module for manipulation and statistical analysis of graphs (a.k.a. networks). http://graph-tool.skewed.de/

217 questions
80 views

### How to find neighbor vertex with a property value in graph_tool

I have a graph with some vertex and edges. I want to find which neighbors of a given vertex match a property value. I can do that with find_vertex(g, prop, match), but this would search in all the ...
42 views

### After generating a random graph with graph-tool, it doesnt show the graph and can't find the output file either

I would like to generate and display random graphs with the help of graphtool, but the displaying part isn't working and I can't figure out why. I have set up Phyton and Docker, with the help of ...
28 views

### 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 ...
58 views

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

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', '...
21 views

### scipy and other simple to integrate python shortest path speed compared against other options

Why is the speed of scipy shortest path rarely referred to? Some old question tried to answer this: NetworkX vs Scipy all shortest path algorithms but only a small reference to networkx in the ...
28 views

### Sort pagerank values of graph-tool vertices

I have a directed graph-tool graph g. I also have already calculated the pagerank for each vertex in the graph using graph_tool.centrality.pagerank as shown below. v_pr = g.new_vertex_property('float'...
30 views

### How to get X Y coordinates of lattice graph using graph_tool

I am creating a lattice graph using graph_tool. I am trying to create a Property Map that represents X Y coordinates in the graph. For instance, if I create a lattice graph with a height of 5 and a ...
75 views

### Conda install graph-tool failed on win-64

I've tried to install graph-tool via anaconda for python 2.7: conda install -c kristanarmstrong graph-tool I got the following error: UnsatisfiableError: The following specifications were found to ...
27 views

### graph-tool Euler circuit

I am currently using the graph-tool library with Python (3.6) and I just noticed that there is no functionality to extract a Eulerian/Hamiltonian path/circuit. Is there a particular reason for this? I ...
42 views

### AttributeError: module 'graph_tool.draw' has no attribute 'draw_hierarchy' is returned when running my code, which is not true

I'm trying to run a script that uses graph tools, and the code returns: /usr/lib/python3/dist-packages/graph_tool/all.py:40: RuntimeWarning: Error importing draw module, proceeding nevertheless: No ...
20 views

### OpenMP on mac (Mojave) along with graph-tool python

I am trying to use multi-threading on mac with python graph-tool Currently when I import graph-tool and do: openmp_enabled() <---this returns False I want to know what steps I need to take to be ...
42 views

### Community detection with (nested and non-nested) stochastic block model for (weighted) bipartite networks using python package graph-tool

I'm new to Python and I would like to use the package graph-tool to estimate the optimal number of communities in my network using the stochastic block model (nested and non-nested) approach. I read ...
40 views

### 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 ...
19 views

### 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 ...
100 views

### 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 ...
74 views

### (Python graph-tool) graph-tool search using OpenMP? Can finding all paths between a source and target vertex be made parallel?

I am currently using graph_tool.topology.all_paths to find all paths between two vertices of a specific length, but the documentation doesn't explicitly say what algorithm is used. I assume it is ...
30 views

### (Python graph-tool) Find paths of a specific length using graph-tool?

Is there a way to find paths between two vertices in a graph of a specific length? I know I can find the shortest path using: graph_tool.topology.all_shortest_paths and that I can find paths of a ...
65 views

### Adding edges using add_edge_list (graph-tool) from Pandas dataframe in a loop writes zeros to property map

I am trying to create a directed graph from a very large data-set (200 million edges) using graph-tool. I am using chunksize in Pandas to work with the data because of memory constraints. The data (...
92 views

### Efficient shortest path in DAG with Python's graph-tool

Task: I want to compute a shortest path between a source and target node in a DAG (directed acyclic graph) using Python's graph-tool efficiently. My DAG has negative weights. In theory, this is a ...
50 views

### MacOS Sierra - brew installs graph-tool with openmp disabled

Running brew install graph-tool on MacOs 10.13.4 does install graph-tool but openmp seems disabled. Am I missing a brew option to have openmp enabled? I did run brew install libomp prior to ...
33 views

### How to I display a figure using graph-tool without the program blocking?

I am trying to write a program which dynamically updates a graph visualization as the state of the graph changes. Currently, the graph_draw method in graph-tool causes the program to halt until the ...
72 views

### conda error when installing geopandas and graph-tool

I'm trying to import geographic data using geopandas and process it with graph-tool, however when I try to install both of these packages with conda, when I import geopandas, I get libgdal.so.20: ...
52 views

### A node's contribution to its Katz centrality

Let G be n x n adjacency matrix of a weighted directed graph. Define the vector of Katz centralities by c = (I- a G)^{-1}.b where I is identity matrix, a is a positive scalar, b is a column vector, ...
51 views

### python graph-tool: Fastest way to add edges without duplicates?

What's the fastest/most performant way to add edges without duplicates to a digraph in Python's graph-tool? The naive solution would be to call g.edge(u, v) before adding edges, but that seems like ...
97 views

### How to attach graph-tool to Django using Docker

I need to use some graph-tool calculations in my Django project. So I started with docker pull tiagopeixoto/graph-tool and then added it to my Docker-compose file: version: '3' services: db: ...
73 views

### graph visualization: graph-tool package python

I have a high order graph that draw by graph-tool package python. but I need a graph visualization that make a better form. is it possible that draw the graph-tool graph by graphviz package? or some ...
82 views

### How can I calculate the girth of a graph using graph-tool?

Graph-tool offers a lot of tools for assessing a graph: https://graph-tool.skewed.de/static/doc/topology.html. However, I can't find any method for calculating the girth, i.e., the shortest cycle in ...
175 views

### python - computing weighted betweenness centrality for nodes of a huge graph

I have a huge graph (say for example 300,000 nodes and 1,000,000 edges) which I'm analyzing using Python on an Ubuntu machine with 32GB of RAM and 4 CPU cores. I found graph-tool to be a very ...
323 views

### Graph-tool installed, Import.all does not work

I have installed graph-tool: brew --prefix graph-tool '/usr/local/opt/graph-tool but when trying to import it: Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33) [GCC 4.2.1 Compatible ...
81 views

### Graph-tool: Dijkstra search with multiple weights constraints

I am using graph-tool library for python to find the shortest path between two vertex. I have multiple weights for the edges and based on the certain conditions the appropriate wight values is chosen ...
37 views

### minimize_blockmodel_dl with weighted graph

I am trying to use minimize_blockmodel_dl to identify communities in a weighted (undirected) graph. I found out that this method once supported a eweight parameter, but it doesn't anymore. Is there ...
73 views

### implementing Girvan-Newman in graph-tool

I'm trying to implement the Girvan-Newman algo in graph-tool and using igraph to cross-check the number of clusters. The problem is I'm getting more clusters, around 460, than the igraph version, 23. ...
34 views

### has_path equivalent in Graph-Tool

Does graph-tool have any equivalent function to NetworkX's has_path? I'd like to return True if there's a valid path between any given nodes.
156 views

### Finding all paths between source and target in graph-tool, return edges instead of vertices

Stack Overflow! I have a directed graph and need to find all paths between a source and target vertex. Between several vertices, there are multiple edges. Using graph-tool, one may suggest using ...
47 views

### Connecting subgraphs programmatically

I am looking for a graph theory package in Python or C++ that enables me to create edges between subgraphs/clusters and their nodes at will, as depicted in the accepted answer to this question, to ...
163 views

### How to check OpenMP usage in python graph-tool

I am using python graph-tool for this algorithm in order to find min-cut in a large graph. My algorithm needs several calls to this function, and it seems to be the bottleneck. So I want to ensure if ...
66 views

### BGL: Get initial direction of edge in undirected graph

In an undirected BGL graph: Can I get the information whether an edge (u,v) == (v,u) was initially added as (u,v) or as (v,u)? Background: I created a graph using Pythons graph-tool library which ...
64 views

### graph-tool: How do I maintain an ordered set of vertices?

I am working on a network using graph-tool. Within the set of all vertices, there are specific groups of vertices with a well defined order that I would like to keep track of. Until now, I have been ...
109 views

### Draw only biggest connected subgraph in graph-tool

In graph-tool, is there a way to only draw the biggest connected subgraph? I'm currently having one big connected subgraph and a few smaller connected subgraphs I'm not particularly interested in. I'm ...
47 views

### Multiple subplots using graph-tool

I'm currently trying to plot several graphs on the same figure using graph-tool, but I'm confronted with a weird bug. I'm using the fact that the graph_draw() function allows to specify a container ...
44 views

### Issue with python graph-tool TSP tour

I'm relatively new to Hamiltonian path and Travelling Salesman Problem (TSP). Particularly for my application, I was attracted to use graph-tool because of its built-in tsp_tour function that "returns ...
195 views

### Setting up graph-tool on Docker Toolbox for WIndows

I followed the graph-tool docker installation instructions here. I've set up Docker Toolbox (can't use Docker for Windows, not on Pro), and I've gotten jupyter running with the Docker image. However, ...
176 views

### graph-tool: How do I find vertices that fit a certain property value?

I have a class Node that I set as a property for a graph using graph-tool. from graph_tool.all import * class Node(object): def __init__(self, name, age): self.symbol = name self....
103 views

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

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(...
265 views

### Graph-tool: compile and connect to local CGAL library, in Linux? (no sudo)

[Ubuntu] I have compiled CGAL locally: /path/to/cgal/ /lib/ libCGAL_Core.so libCGAL_Core.so.13.0.2 libCGAL_ImageIO.so.13 libCGAL.so libCGAL.so.13.0.2 ...
58 views

### Installing graph-tool with local BOOST

In order to install graph-tool, I must install dependencies with autoconf. Some of these dependencies use boost, and I link my local boost install to these dependencies with: export BOOST_ROOT=/my/...
470 views

### Installing graph-tool library on conda installed python 3.5, Mac OS

Precisely the same as here, which hasn't been resolved. Followed the sequential directions here; all channels added. Tried: Adding to .bash_profile export PKG_CONFIG_PATH=\$PKG_CONFIG_PATH://...
64 views

### Is there a way to add a title or a caption to the drawing using graph_tool

At least some workaround would be appreciated. I am trying to save the figures as pdfs and then use it with latex as an animation. If there is a way to automatically add captions that will be really ...