graph-tool

Basic questions about nested blockmodel in graph-tool

感情迁移 提交于 2019-12-03 15:08:37
Very briefly, two-three basic questions about the minimize_nested_blockmodel_dl function in graph-tool library . Is there a way to figure out which vertex falls onto which block? In other words, to extract a list from each block, containing the labels of its vertices. The hierarchical visualization is rather difficult to understand for amateurs in network theory, e.g. are the squares with directed edges that are drawn meant to implicate the main direction of the underlying edges between two blocks under consideration? The blocks are nicely shown using different colors, but on a very conceptual

Create a weighted graph from an adjacency matrix in graph-tool, python interface

为君一笑 提交于 2019-12-03 12:50:28
问题 How should I create a graph using graph-tool in python, out of an adjacency matrix? Assume we have adj matrix as the adjacency matrix. What I do now is like this: g = graph_tool.Graph(directed = False) g.add_vertex(len(adj)) edge_weights = g.new_edge_property('double') for i in range(adj.shape[0]): for j in range(adj.shape[1]): if i > j and adj[i,j] != 0: e = g.add_edge(i, j) edge_weights[e] = adj[i,j] But it doesn't feel right, do we have any better solution for this? (and I guess a proper

Create a weighted graph from an adjacency matrix in graph-tool, python interface

此生再无相见时 提交于 2019-12-03 03:24:06
How should I create a graph using graph-tool in python, out of an adjacency matrix? Assume we have adj matrix as the adjacency matrix. What I do now is like this: g = graph_tool.Graph(directed = False) g.add_vertex(len(adj)) edge_weights = g.new_edge_property('double') for i in range(adj.shape[0]): for j in range(adj.shape[1]): if i > j and adj[i,j] != 0: e = g.add_edge(i, j) edge_weights[e] = adj[i,j] But it doesn't feel right, do we have any better solution for this? (and I guess a proper tag for this would be graph-tool , but I can't add it, some kind person with enough privileges could

Python equivalent of D3.js

不想你离开。 提交于 2019-12-03 00:02:18
问题 Can anyone recommend a Python library that can do interactive graph visualization? I specifically want something like d3.js but for python and ideally it would be 3D as well. I have looked at: NetworkX - it only does Matplotlib plots and those seem to be 2D. I didn't see any sort of interactiveness, like one that d3.js gives, such as pulling nodes around. graph-tool - it does only 2D plots and has very slow interactive graphs. 回答1: You could use d3py a python module that generate xml pages

Python equivalent of D3.js

不羁岁月 提交于 2019-12-02 13:47:29
Can anyone recommend a Python library that can do interactive graph visualization? I specifically want something like d3.js but for python and ideally it would be 3D as well. I have looked at: NetworkX - it only does Matplotlib plots and those seem to be 2D. I didn't see any sort of interactiveness, like one that d3.js gives, such as pulling nodes around. graph-tool - it does only 2D plots and has very slow interactive graphs. Vincent Agnus You could use d3py a python module that generate xml pages embedding d3.js script. For example : import d3py import networkx as nx import logging logging

Permanently adding to DYLD_LIBRARY_PATH on MAC causes X11 errors

拥有回忆 提交于 2019-12-01 11:23:30
I am using Python 2.7 and am trying to import graph_tool, and it seems that my libboost_thread-mt.dylib is located in /opt/local/lib rather than /usr/local/lib. If I start an X11 terminal and type in export DYLD_LIBRARY_PATH='/opt/local/lib' then Python successfully imports graph_tool. On the other hand, if I add export DYLD_LIBRARY_PATH='/opt/local/lib':$DYLD_LIBRARY_PATH to ~/.bash_profile , X11 stops working. I am really confused as to what is happening here. Why can't I add /opt/local/lib to $DYLD_LIBRARY_PATH permanently without destroying my computer? Any help is much appreciated. Thanks

Graph-tool surprisingly slow compared to Networkx

老子叫甜甜 提交于 2019-11-30 04:12:01
After looking at the impressive performance comparison , I decided that I would give a try to graph-tool. So for comparison, I wrote codes to generate a random tree using both packages. The graph-tool code: import numpy as np import graph_tool.all as gt # construct an initial graph with two nodes and one link n = 5000 G = gt.Graph(directed = False) G.add_edge(0, 1) for t in range(2, n): # connect the new vertex to one of the old vertices randomly G.add_edge(np.random.choice(range(t)), t) The Networkx code: import networkx as nx import numpy as np n = 5000 # initial graph G = nx.Graph() G.add

Graph-tool surprisingly slow compared to Networkx

梦想与她 提交于 2019-11-29 01:30:33
问题 After looking at the impressive performance comparison, I decided that I would give a try to graph-tool. So for comparison, I wrote codes to generate a random tree using both packages. The graph-tool code: import numpy as np import graph_tool.all as gt # construct an initial graph with two nodes and one link n = 5000 G = gt.Graph(directed = False) G.add_edge(0, 1) for t in range(2, n): # connect the new vertex to one of the old vertices randomly G.add_edge(np.random.choice(range(t)), t) The