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'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 and everyone else on the list
Thank you for your swift reply.
The attached png is one example of a max flow calculation result.
The flow is limited in four places in this graph.
I would like to extract the order of the edges in the four paths I drew.
The shortest path solution you described corresponds to path 3 in the drawing.
all_shortest_paths gives my path 3 and another completely different path before crashing with a memoryError.
Looking forward to hearing from you.
Best,
Alex
________________________________________
From: Tiago de Paula Peixoto [tiago(a)skewed.de]
Sent: Thursday, March 09, 2017 18:43
To: Hobé Alex
Subject: Re: Graphtool: Finding the paths that the maximum flow algorithm produces
Hi Hobé,
I'm not sure I understand what you want. Any path containing edges with
positive flow is a "flow path". There are many of them. Which one do you
want? If you just want _some_ path, just filter out the edges with zero flow
and get the shortest path. But there are many other ways to proceed...
Best,
Tiago
PS. There is a mailing list of the graph-tool project, where questions like
this can be posted. It is better to use the list than to ask me directly,
since it builds a repository of questions others can consult, and other
people can help you as well.
On 09.03.2017 17:04, Hobé Alex wrote:
> Dear Mr. de Paula Peixoto
>
> I am using the python graphtool for my master thesis and am enjoying the
> beautiful pictures it produces.
> When computing the maximum flow I would like to use other edge properties
> along the computed path for further calculations.
> I am therefore looking for a way to find an array, which contains the edges
> along a flow path, similar to the shortest_path result.
> I looked through all the pages of the online tutorial, learnt a couple of
> new tricks, but haven't found a way to solve this.
>
> I would be very thankful for any assistance you would be able to provide and
> I look forward to hearing from you.
> Best wishes,
>
> Alex Hobé
--
Tiago de Paula Peixoto <tiago(a)skewed.de>

I tried the following command in Python and ipython prompt (2.7 version)
---------------------------------------------------------------------------
In [1]: from graph_tool.all import *
---------------------------------------------------------------------------
Its giving the following error. How can we solve it?
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-100bbe2bc9d9> in <module>()
----> 1 from graph_tool.all import *
/usr/lib/python2.7/dist-packages/graph_tool/__init__.py in <module>()
103
104 from .dl_import import *
--> 105 dl_import("from . import libgraph_tool_core as libcore")
106 __version__ = libcore.mod_info().version
107
/usr/lib/python2.7/dist-packages/graph_tool/dl_import.pyc in dl_import(import_expr)
55
56 try:
---> 57 exec(import_expr, local_dict, global_dict)
58 finally:
59 sys.setdlopenflags(orig_dlopen_flags) # reset it to normal case to
<string> in <module>()
ImportError: /usr/lib/python2.7/dist-packages/graph_tool/libgraph_tool_core.so: undefined symbol: _ZN5boost9iostreams4zlib6finishE
---------------------------------------------------------------------------
Thanks

Hi,
I recently upgraded to v2.22 (from v2.19) and I noticed that with the new
version when I use the roller button on the mouse to zoom in or out, the
application crashes with a segmentation fault - this was NOT the case with
v2.19.
I was wondering if anybody else has experienced similar issues or have any
ideas how to resolve the issue.
Regards,
Vaggelis
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hello all,
I am trying to use mplfig parameter of the graph_draw to draw 4 graphs on
the same plot. My code is given below. However, this only produces graphs
in first and second subplots. What am I missing?
import graph_tool.all as gt
import matplotlib.pyplot as plt
plt.switch_backend('cairo')
'''Load a graph'''
g = gt.collection.data['karate']
for ind in range(4):
ax = plt.subplot(2, 2, ind+1)
gt.graph_draw(g, mplfig = ax)
plt.savefig('karate4states.pdf')
Thank you
--
Snehal M. Shekatkar
Pune
India

Hello Tiago,
I am trying to generate a stochastic block model but with the
degree-sequence preserved. I am fine even if the degree-distribution is
preserved instead of the exact sequence. I tried the following:
def prob(a, b):
if a == b :
return 0.999
else:
return 0.001
g, bm = gt.random_graph(N, lambda: 1 + np.random.poisson(5), model =
"blockmodel-degree", directed = False,
block_membership=np.random.randint(0, b, N), edge_probs = prob)
However, this generates an ER graph. What can I do to retain the
block-structure?
Thank you
--
Snehal M. Shekatkar
Pune
India

Hello Tiago,
I am trying to make an animation using Graph tool.
My data is preety simple, i have a interactions between two vertices and
timestamps of those interactions, something like this:
time vertex_id vertex_id
1830 356 681
1835 12 590
1835 123 456
What i am trying to do, is to show all interactions per time step,
therefore i would like to animate edges, display all edges (interactions)
that happen at a certain time step.
What i don't get is how to loop through the list of timestamps. Should I
even do it like this.
I imagine looping through the list of timestamps, where every time stamp
points to a list of all the edges and then I somehow (unclear how) display
them.
Also, what happens in the update_state function from this page
https://graph-tool.skewed.de/static/doc/demos/animation/animation.html is
a bit unclear to me. Could you please help me somehow?
Is there any other resource/documentation I could look at, because a lot of
the code from the example is like magic to me.
Best regards,
Stefan

Hi all,
I'm running 2.22 on Ubuntu 16.04.
Iterating over all_circuits() results in a segmentation fault. e.g.,
cycles = gt.all_circuits(G)
for c in cycles:
...
I also tried iterating over it by cycles.next() to see which cycle causes
the crash. Turns out it crashes sporadically at different iterations.
Sometimes on the first, sometimes on the seventh, etc.
This happens for all combinations of python 2.7 and python 3.6 under WSL
16.04 or pure 16.04 Ubuntu.
My cursory search didn't get me anywhere. Is this a bug or an error on my
part?
Your help is appreciated,
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/