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.

Dear Tiago,
I have a directed graph of about half a million nodes and approximately a
million edges following scale free behaviour and a power law degree
distribution. To test some of my hypothesis, I would like to generate random
smaller graphs (about 50 up to 200 nodes) representative of the big one.
When I used a sample function that samples straight away from the real
distribution of the big network, I have following problems:
- I generate unconnected nodes with both 0 in AND out degree.
- I generate small sub parts of a few nodes that are not connected to the
main graph.
- If only sampling from nodes with at least 1 degree, the generated graph is
coherent, but not representative anymore as I need a big portion of nodes
with either only one in or one out degree.
Here is the part of my script I used for that, where samples are drawn from
dictionaries of the degrees:
def sample_in():
a=np.random.randint(num)
k_in = in_degrees[a]
return k_in
def sample_out():
if sample_in()==0:
b=np.random.randint(num_out)
k_out=out_zero_zeros.values()[b]
return k_out
else:
b=np.random.randint(num)
k_out=out_degrees[b]
return k_out
N=200
g=gt.random_graph(N, lambda:(sample_in(), sample_out()),
model="constrained-configuration", directed=True)
I also tried sampling from a list of tuples as you have mentioned before in
the forum, but I didn't receive any results, as the tuples randomly drawn
from my list might not be combinable.
degs=[(7,1),(4,3),(5,6),(2,4),(6,8),(2,0),(3,5),(0,3),(2,7),(2,1)]
g = gt.random_graph(4, lambda i: degs[i], directed=True)
- Is there any option I could active that would help me in those cases I
described above?
- Is there a better way how to create representative small networks?
Any help on that issue will be much appreciated.
Best wishes,
Jana
--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/

Hi again,
I'm writing a small package that builds on graph-tool, but not on its graphics capabilities (also because I have to represent other things rather than the graph itself). Still I could use some of the functions "under the hood" for my purposes. I have a question about gt.draw.get_hierarchy_control_points(): the function returns the Bézier spline control points for edges in a given graph, but I'm having difficulties in understanding how this information is encoded. For a single edge in graph, I have dozens of values as control points (half dozens + 2), hence I suspect all splines going from node A to the root of a hierarchy and back to node B are encoded there, and control points should be taken 6 by 6 (3x2 by 3x2 coordinates?). How (x,y) for control points are encoded then: (x, x, x, y, y, y) or (x, y, x, y, x, y)? What are the 2 additiona values I have for each vector? Also, are values absolute or relative to one node in particular (A, B or root...)?
Thanks
d

Greetings,
I have been unable to see any effect on the layout when using the 'groups'
argument.
For example, I have tried setting groups equal to a VertexPropertyMap as
follows:
vprop_layout_groups = self.new_vertex_property("int") # Vertex
groups.
With layout_groups = [0 0 0 0 0 0 1 1 1]
I can see no grouping effect on the positions of the vertices as returned by
sfdp_layout().
The three vertices without edges are in the '1' group. The connected
vertices are in the '0' group.
<https://nabble.skewed.de/file/t496263/sfdp-groups.png>
I have been unable to find any example showing a call to sfdp_layout() where
'groups' is used.
Is there a working example available?
Thank you.
p.s. Is there a way to donate money to the graph-tool project?
--
Sent from: https://nabble.skewed.de/

Hi,
I need to find a way to label all reachable nodes in a directed graph starting at a specific node. Is there a short way to do this?
Currently I use this:
```
graph = get_graph()
is_reachable = graph.new_vp("bool")
start_vertex = get_start_vertex()
tc = gt.transitive_closure(graph)
is_reachable[start_vertex] = True
for node in tc.vertex(start_vertex).out_neighbors():
is_reachable[graph.vertex(node)] = True
```
This works, but seems quite inefficient, since I don't need the full transitive closure (although I have multiple such start vertexes).
Another possibility should be a raw DFS but this needs far more LOC, since it needs to stop when it backtracks and therefore needs a custom visitor.
Gerion

Hi,
I'm using graph-tool from both Python and C++. Normally, all works well
with the dispatch function. But now I came to a situation, where I get
an edge object (graph_tool.libgraph_tool_core.Edge) and want to use
this from C++. Is there a way to do this?
This is the same question as: I have a function `void do_stuff(PyObject* foo)`
where `foo` is a `graph_tool.libgraph_tool_core.Edge`. Can I extract the
boost::detail::adj_edge_descriptor somehow (or whatever is the correct
edge type)?
Kind regards
Gerion

Hi, all,
I am working on time-series networks. I have one network in each year, and
I totally have 5 networks in 1970, 1980,1990,2000, 2010. Then I use the
layered model to generate communities.
state_G_layers=graph_tool.all.minimize_blockmodel_dl(G_layers,layers=True,
deg_corr=True,
state_args=dict(ec=G_layers.ep.layer,recs=[G_layers.ep.weight],rec_types=["real-exponential"],layers=True))
Then I got 10 communities. My questions:
1. Does it mean that in each year there are 10 communities , i.e., the
number of communities remains constant over time ?
2. If so, how can we detect the change in the number of communities as the
time goes by? As time goes by, some communities may disappear or merge with
other communities, or the whole network becomes more homophily and forms one
community.
It will be appreciated if you can help me.
Best regards,
Jianjian
--
Sent from: https://nabble.skewed.de/

Hi Tiago,
From the documentation for random_rewire : "If parallel_edges = False, parallel edges are not placed during rewiring. In this case, the returned graph will be a uncorrelated sample from the desired ensemble only if n_iter is sufficiently large."
If I set "model = 'configuration'" and "parallel_edges = True, self_loops = True", will "n_inter = 1" suffice?
Thank you
SS

Hi,
So I am trying to extract the largest connected component from a network I
have but if I do label_components on the resulting GraphView, it tells me
there are different components within the largest connected components,
which doesn't make sense.
Here is what I do:
In [24]: print(pharma_reach)
Out[24]: <GraphView object, directed, with 16211 vertices and 15527 edges,
edges filtered by (<EdgePropertyMap object with value type 'bool', for
Graph 0x7f9399d88b00, at 0x7f9399d88f28>, False), vertices filtered by
(<VertexPropertyMap object with value type 'bool', for Graph 0x7f9399d88b00,
at 0x7f9399d88eb8>, False) at 0x7f9399d88b00>
This is a network of pharma companies extracted from a larger network. I
then extract the largest component as follows:
In [25]: pharma_reach_lc = GraphView(pharma_reach,
vfilt=label_largest_component(pharma_reach, directed=False))
In [26]: print(pharma_reach_lc)
Out [26]: <GraphView object, directed, with 6798 vertices and 8242 edges,
edges filtered by (<EdgePropertyMap object with value type 'bool', for
Graph 0x7f939417d4a8, at 0x7f939417d588>, False), vertices filtered by
(<VertexPropertyMap object with value type 'bool', for Graph 0x7f939417d4a8,
at 0x7f939417d128>, False) at 0x7f939417d4a8>
So seems to do something. I then plotted the graph and it seemed like there
where disconnected components. So I checked with label_components and get
In [27]: comp, hist = label_components(pharma_reach_lc, directed=False)
In [28]: print(hist)
Out[28]: array([5532, 11, 102, 2, 2, 5, 4, 7, 2, 3,
13,
1, 19, 1, 5, 6, 4, 6, 2, 4, 6, 4,
2, 4, 4, 5, 1, 13, 5, 2, 2, 2, 35,
6, 2, 5, 7, 4, 1, 23, 18, 7, 5, 6,
2, 2, 3, 7, 2, 3, 2, 10, 1, 7, 4,
3, 5, 3, 5, 4, 4, 4, 10, 5, 8, 10,
2, 4, 2, 6, 16, 4, 6, 11, 7, 4, 3,
15, 3, 2, 2, 3, 1, 3, 2, 9, 15, 2,
3, 2, 3, 10, 4, 2, 2, 6, 10, 2, 3,
2, 5, 10, 1, 4, 3, 5, 2, 1, 6, 3,
7, 1, 4, 2, 2, 2, 5, 2, 6, 5, 3,
2, 3, 1, 2, 3, 1, 5, 9, 6, 2, 2,
1, 4, 2, 5, 2, 2, 1, 1, 2, 6, 7,
2, 2, 2, 2, 8, 1, 1, 1, 4, 2, 6,
1, 4, 1, 1, 4, 2, 3, 1, 3, 1, 3,
6, 4, 1, 3, 4, 1, 4, 4, 1, 4, 2,
3, 3, 3, 4, 2, 3, 4, 2, 1, 2, 3,
1, 5, 6, 1, 3, 2, 1, 2, 5, 2, 1,
4, 3, 8, 2, 9, 5, 5, 2, 5, 2, 4,
1, 3, 3, 2, 1, 1, 3, 1, 1, 1, 2,
1, 1, 2, 1, 1, 2, 2, 6, 3, 1, 2,
2, 1, 2, 2, 3, 1, 3, 1, 2, 2, 3,
2, 1, 1, 2, 1, 3, 3, 2, 1, 2, 1,
3, 2, 2, 2, 3, 1, 3, 1, 2, 2, 4,
1, 3, 2, 2, 4, 2, 2, 3, 1, 1, 1,
2, 1, 1, 1, 5, 1, 1, 3, 1, 1, 2,
2, 3, 3, 2, 2, 1, 1, 3, 4, 2, 2,
2, 2, 1, 2, 4, 1, 2, 1, 1, 1, 1,
2, 1, 2, 1, 4, 1, 3, 1, 2, 1, 1,
2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 4,
1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2,
2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1], dtype=uint64)
but even if I again select this first component, it does not subselect any
nodes, it just returns the same set.
In [29]:
pharma_reach_lc_check = GraphView(pharma_reach_lc, vfilt=comp.fa==0)
In [30]: print(pharma_reach_lc_check)
Out[30]: <GraphView object, directed, with 6798 vertices and 8242 edges,
edges filtered by (<EdgePropertyMap object with value type 'bool', for
Graph 0x7f939417deb8, at 0x7f93941f1cf8>, False), vertices filtered by
(<VertexPropertyMap object with value type 'bool', for Graph 0x7f939417deb8,
at 0x7f93941f1f98>, False) at 0x7f939417deb8>
I've been checking different ways but all end up the same. What's going
wrong here?
ps I have version '2.29 (commit 74b5946a, )' because I work on a university
server that is a pain to update regularly in case this was a known bug.
--
Sent from: https://nabble.skewed.de/