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
0
votes
1 answer

How to access the eigenvector centralities of all vertices in graph-tool?

I need to access the eigenvector centrality values for all the vertices in a graph. I am using graph-tool to do that. I tried to calculate it just like closeness centrality but since in graph tool closeness returns just the Vertex Property map…
Monali
  • 43
  • 7
0
votes
1 answer

Random graph with degree sequence

I'm using graph-tool to try to generate random graphs with a sequence of degrees. For example, in a 3-node graph, I generated a random graph with all nodes with input degrees 1 and output degrees 1. >>> import graph_tool.all as gt >>> def…
0
votes
1 answer

Does graph-tool have a way of projecting bipartite graphs?

I'm trying to project a bipartite graph into two single mode graphs. I'm want to analyze a bipartite graph using the dual projection approach. I have been using NetworkX, but I wanted to try graph-tool since it claims to be more efficient. There is…
Jean
  • 11
  • 1
  • 4
0
votes
1 answer

Graph-Tool KCore functionality

I'm digging into graph-tool and I try to build a graph, which shows me the current in and out degrees of my vertices. I checked out the sample from the website, which works fine for me, but as I try to build my own random graph all the vertices show…
SKiD
  • 441
  • 1
  • 3
  • 16
0
votes
1 answer

GraphView edge filter is same as original Graph after vertex filtering

I have a Graph and an associated edge property. I then filter the graph with a vertex filter with a GraphView. g = Graph(directed=False) g.add_vertex(6) g.add_edge_list([(0, 1), (1, 2), (1, 4), (2, 4), (3, 5), (4, 5)]) eprop =…
maxcalibur
  • 43
  • 8
0
votes
1 answer

Network graph visualisation with an axis of levels in python (layered layout)

I want to visualise a network, such that the nodes are aligned on a vertical axis based on a variable of each node. It's a little hard to explain, but here is a (low quality) image So each node has a value, and the graph is visualised so these…
chasmani
  • 2,362
  • 2
  • 23
  • 35
0
votes
1 answer

Function "collect_vertex_marginals" returns an error on documentation example

I am trying to reproduce an example from the graph-tool documentation on network reconstruction. I noticed that the code changed recently and although it used to return no error before, it now does. I am running Python 3.6.5 with the graph-tool…
0
votes
1 answer

graph-tool Collect Vertex Marginals - pv Size

I was running gt.mcmc_equilibrate(state, force_niter=300, mcmc_args=dict(niter=10), callback=collect_vertex_marginals) And I got a Property Map (let's call it pv) of the vertex marginals. The pv gives an array for…
Sree Aurovindh
  • 705
  • 1
  • 6
  • 18
0
votes
1 answer

Graph of objects using graph-tool

I'm trying to use the library graph-tool to create a new graph of objects. In particular I want some nodes of students and others of professors. In the following the code I've written, I'm not able to add the vertices of students/professors. The…
Manuel
  • 13
  • 4
0
votes
1 answer

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 graph. Instead, I have neighbors =…
Vladimir Vargas
  • 1,744
  • 4
  • 24
  • 48
0
votes
1 answer

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 width of 10, I want the value of the property map…
Sara Fuerst
  • 5,688
  • 8
  • 43
  • 86
0
votes
2 answers

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 module named 'cairo._cairo' warnings.warn(msg,…
Nande
  • 1
  • 2
0
votes
0 answers

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 the documentation related to the core functions…
Peter
  • 1
  • 1
0
votes
1 answer

(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 maximum length…
0
votes
2 answers

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 computationally "easy" problem (i.e., O(V + E)) by…
netword
  • 113
  • 2
  • 13