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/

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 all,
Is there a way to create a multilayer network from a group of data.frames?
This would make it very easy to import data to create multigraphs in
graph-tool. This is possible for example in igrap library and for MuxViz in
R( https://github.com/manlius/muxViz).
In Muxviz, for example, one can create a multilayer network using three
data.frames. I copy some of the explanation below from their documentation:
### Node list
One df with following columns :
- nodeID: [mandatory] numerical integer id to identify each node
- nodeLabel: [optional] string specifying the label attribute
- nodeX: [optional] float value specifying the Cartesian coordinate x
for the layout
- nodeY: [optional] float value specifying the Cartesian coordinate x
for the layout
- nodeLat: [optional] float value specifying the latitude for the
geographic layout
- nodeLong: [optional] float value specifying the longitude for the
geographic layout
### Edges list
One or more df with data on the edges. A typical edges list is expected to
be a file with at most three columns, giving the list of edges from a node
(first column) to other nodes (second column), possibly weighted by an
integer or floating number (third column). For instance:
1 2 0.5
1 3 1.4
...
18 124 0.1
### input df
Muxviz also uses a third data.frame that brings information on the list of
layers to be included in a multiplex, the corresponding labels and the
possible layout file to define node properties (e.g., ID, labels,
geographic coordinates, etc).
best wishes,
Rafael H M Pereira

I am currently working with a code that has a directed graph structure: an
object defines `inputs` and `outputs` which return iterables of the objects
with the same interface. Each object has a bunch of useful payload. I am
looking for a python libarary that is capable of handling such data
structure without the conversion to an intermediate format that is loaded
for graph processing algrorithms.
So instead of walking the data structure I have and converting it to a list
of lists or whatever representation is consumed by the graph library, I
would specify an adaptor interface to my own class so the graph library
would be able to interact with my hierarchy directly. Is this sort of thing
possible?
Best regards,
Anton

Hi,
I'm trying to use the function "get_out_degrees", but I get following error:
AttributeError: 'Graph' object has no attribute 'get_out_degrees'
The graph I generated is a directed graph:
<Graph object, directed, with 396 vertices and 10042 edges at
0x7fb5c15c5690>
The gt version is the 2.18 (Ubuntu Trusty):
'2.18 (commit 37996a0a, Thu Jul 21 17:56:14 2016 +0200)'
Any idea of what I'm doing wrong?
Thanks a lot!
Davide

Dear Tiago,
I am on Ubuntu 16.04 and while updating I got the following error.
Err:16 http://downloads.skewed.de/apt/xenial xenial Release.gpg
The following signatures were invalid: BADSIG 7A80C8ED4FCCBE09 Tiago de
Paula Peixoto <tiago(a)skewed.de>
So as per the instructions page, I tried:
sudo apt-key adv --keyserver pgp.skewed.de --recv-key 612DEFB798507F25
However, this returns the following:
Executing: /tmp/tmp.UgWxLPVkr2/gpg.1.sh --keyserver
pgp.skewed.de
--recv-key
612DEFB798507F25
gpg: requesting key 98507F25 from hkp server pgp.skewed.de
gpgkeys: key 612DEFB798507F25 can't be retrieved
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: keyserver helper general error
gpg: keyserver communications error: unknown pubkey algorithm
gpg: keyserver receive failed: unknown pubkey algorithm
What can be done?
Thank you
--
Snehal M. Shekatkar
Pune
India