Hi Tiago,
sometimes, when delete the graph and create a new one, then plot it, the
plotted graph is shown upside down (in terms of the node text). So how could
we control the orientation of the graph? Or which parameter we should use to
always make node text shown in a correct orientation. Thanks a lot.
--
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com…
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.

Hi,
I'm suffering from the same issue mentioned in this post:
https://git.skewed.de/count0/graph-tool/issues/174
Namely, I'm trying to draw a graph that includes a lot of self-looping
edges, and my labels are being printed upside down. If I remove the
self-loops the labels are shown the right way up.
Is there a fix for it?
Thanks,
Charlie
--
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com…
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.

I am curious what is being used to calculate the standard deviation of the
average in gt.vertex_average and gt.edge_average
>>> t2=gt.Graph()
>>> t2.add_vertex(2)
>>> t2.add_edge(t2.vertex(0), t2.vertex(1))
>>> gt.vertex_average(t2, "in")
(0.5, 0.35355339059327373)
Now, shouldn't std be σ(n)=sqrt(((0-0.5)^2+(1-0.5)^2)/2)=0.5 ?
also q(n-1)=sqrt((0.5^2+0.5^2)/(2-1))~=0.70710
0.3535 is sqrt(2)/4 which happens to be σ(n-1)/2, so it seems there is some
relation to that.
A little bigger graph.
>>> t3=gt.Graph()
>>> t3.add_vertex(5)
>>> t3.add_edge(t3.vertex(0), t3.vertex(1))
>>> gt.vertex_average(t3, "in")
(0.2, 0.17888543819998318)
Now, we should have 0,1,0,0,0 series for vertex incoming degree.
So Windows calc gives σ(n)=0.4 and σ(n-1)~=0.44721, so where does 0.1788854
come from ?
Reason, I am asking because, I have a large graph, where the average looks
quite alright but the std makes no sense, as going by the histogram, degree
values are quite a bit more distributed than the std would indicate.
--
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com…
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.

Hi,
I was wondering if there is any way to assign vertex properties while
adding edges to the graph. for example using "add_edge_list" I can assign
edge properties but later I have to iterate through all vertices again to
assign their properties.
I know this is not a problem when the vertex property is of the type "int"
or "float" because then one can use "vprop.a = values", but in case of
"string" and "object" this method doesn't work
What would be the best/fastest way to handle this situation.
I guess it would be very helpful to extend the "add_edge_list" function to
accept vertex property in some way.
cheers,
--
Mohsen

I ran mcmc_equilibrate on a nested block state model in a weighted graph. As
per instructions, I copied the initially computed state in another object
with increased hierarchy depth to 10. However, this fixed the depth to 10.
Everything computed afterwards has depth 10 even if is clear that after 3 or
4 levels the nodes converge to one.
There are many empty branches and when I try to plot it with empty_branches
= False, I get an error stating it is not a tree.
RuntimeError: Invalid hierarchical tree: No path from source to target.
Did anybody perform any similar analyses?
The hierarchy after mcmc_equilibrate:
<NestedBlockState object, with base <BlockState object with 24 blocks (24
nonempty), degree-corrected, with 1 edge covariate, for graph <Graph
object, undirected, with 230 vertices and 11230 edges, edges filtered by
(<PropertyMap object with key type 'Edge' and value type 'bool', for
Graph 0x7fc3a89f1210, at 0x7fc3a64911d0>, False), vertices filtered by
(<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph
0x7fc3a89f1210, at 0x7fc3a64912d0>, False) at 0x7fc3a89f1210>, at
0x7fc3a6491950>, and 10 levels of sizes [(230, 24), (24, 5), (5, 1), (1, 1),
(1, 1), (1, 1), (1, 1), (1, 1), (1, 1), (1, 1)] at 0x7fc3a6491590>
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hi,
I am trying to enable overlap in the nested_blockmodel:
state = gt.inference.minimize.minimize_nested_blockmodel_dl(g, overlap=True)
So far, I have only tried a very simple network ("celegansneural"), and it
gives me three levels, with the first level being a OverlapBlockState and
upper levels being BlockState.
[<OverlapBlockState object with 3 blocks, degree corrected, for graph
<Graph object, directed, with 297 vertices and 2359 edges at
0x10bc7d710>, at 0x1351e6470>, <BlockState object with 2 blocks (2
nonempty), for graph <Graph object, directed, with 3 vertices and 6 edges
at 0x135e3a1d0>, at 0x135e27ac8>, <BlockState object with 1 blocks (1
nonempty), for graph <Graph object, directed, with 2 vertices and 3 edges
at 0x135214128>, at 0x1352192b0>]
I am interested in inferred a DAG structure from some networks, i.e. not
only the leaf nodes, but nodes on intermediate level can have multiple
membership.
I am wondering whether the fact that I only get one level of overlapping
block is due to the very simple network, or is it simply not possible to
have multiple levels of overlapping blocks?
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

I'd like to use the "add_edge_list" function to add edges to my graph, and
simultaneously assign a value for an edge property map for each of the added
edges.
When I try the following example (with no edge property map information)
works fine:
elist1 = np.array([[0,1], [1, 2]]) #edge list with no value for edge
property map data (only the source and target for the edges)
g = gt.Graph()
my_eprop = g.new_edge_property('bool')
g.add_edge_list(elist)
But with the following example, I get the error below:
elist2 = np.array([[0,1, 1], [1, 2, 0]]) #edge list with edge property map
value in 3rd column
g = gt.Graph()
my_eprop = g.new_edge_property('bool')
g.add_edge_list(elist2, eprops=my_eprop)
Error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-48-6a949ea52c9b> in <module>()
----> 1 g.add_edge_list(elist2, eprops=my_eprop)
/usr/lib/python2.7/dist-packages/graph_tool/__init__.pyc in
add_edge_list(self, edge_list, hashed, string_vals, eprops)
1969 eprops = ()
1970 else:
-> 1971 convert = [_converter(x.value_type()) for x in eprops]
1972 eprops = [_prop("e", self, x) for x in eprops]
1973 if not isinstance(edge_list, numpy.ndarray):
/usr/lib/python2.7/dist-packages/graph_tool/__init__.pyc in
__getitem__(self, k)
534 kt = "Graph"
535 raise ValueError("invalid key '%s' of type '%s',
wanted type: %s"
--> 536 % (str(k), str(type(k)), kt) )
537
538 def __setitem__(self, k, v):
ValueError: invalid key '0' of type '<type 'int'>', wanted type: Edge
---------------------------------------------------------------------------
Please help!
--
View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com…
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.

Hi Tiago,
I installed graph-tool on a mac machine. After struggling a lot to import
graph_tool without any error in python, I was running an example with
plotting and I was getting following error
>>> from graph_tool import all
/Users/zahra/anaconda3/lib/python3.6/site-packages/graph_tool/draw/cairo_draw.py:1494:
RuntimeWarning: Error importing Gtk module: No module named 'gi'; GTK+
drawing will not work.
warnings.warn(msg, RuntimeWarning)
>>> from graph_tool.all import *
>>> g=Graph()
>>> v1 = g.add_vertex(
... )
>>> v2 = g.add_vertex()
>>> e=g.add_edge(v1,v2)
>>> graph_draw(g, vertex_text=g.vertex_index,
vertex_font_size=18,output_size=(200, 200), output="../two-nodes.png")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/Users/zahra/anaconda3/lib/python3.6/site-packages/graph_tool/draw/cairo_draw.py",
line 1185, in graph_draw
nodesfirst, fit_view=fit_view, **kwargs)
File
"/Users/zahra/anaconda3/lib/python3.6/site-packages/graph_tool/draw/cairo_draw.py",
line 707, in cairo_draw
max_render_time, cr)
MemoryError
>>> quit()
Well, googling this error did not help to solve the problem. Could you
please suggest a solution ?
Thanks in advance.
Cheers,
Zahra

Hello,
I have recently started working with graph-tool, and was wondering if we
can try to view any of the data provided in the repo as a pandas Dataframe?
This would be helpful, because I would like to analyze a few things with a
custom dataset.
For example, gt.collection.data["celegansneural"], can it be displayed as a
dataframe? Or any other way?
I would like to see the all the content in it.
Warm regards,
Rachit Saluja

Hi there!
Due to certain limitations, we are trying to install the graphtool version 2.7 on a redhat distribution.
After a lot of fidling around, we have been able to make the functions we need work, except for the find_edge_range function.
The following simple example demonstrates the problem:
from graph_tool.all import *
g = Graph()
v1, v2 = g.add_vertex(), g.add_vertex()
e1,e2 = g.add_edge(v1,v2), g.add_edge(v2,v1)
res = g.new_edge_property("double")
res[e1] = 0.1
res[e2] = 12.
eList = find_edge_range(g,res, [0.0, 1.])
This causes the following issue:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/graph_tool/util/__init__.py", line 84, in find_edge_range
convert = converter(prop.value_type())
NameError: global name 'converter' is not defined
Unfortunately, I have not found a way to see the actual code, where this error arises.
Was this a problem in that particular version?
What do I need to do to find the code where this issue arises?
The following python loop is able to reproduce the desired behavior, but it is way too slow:
eList = []
for e in g.edges():
if res[e] <= eps and res[e] >= 0.0:
eList.append(e)
Is there a more efficient way to do this, if I cannot make "find_edge_range" work?
Looking forward to hearing from you.
All the best,
Alex