Ni!
Hi Alvaro, this is explained in the documentation for the
graph_tool.generation.random_graph
<https://graph-tool.skewed.de/static/doc/generation.html#graph_tool.generation.random_graph>
function concerning the `deg_sampler`:

> Optionally, you can also pass a function which receives one or two
> arguments. If block_membership is None, the single argument passed will
> be the index of the vertex which will receive the degree. If
> block_membership is not None, the first value passed will be the vertex
> index, and the second will be the block value of the vertex.
>
Cheers,
.~ยด


On Thu, Oct 31, 2019 at 9:37 PM Alvaro Sechinel <sechi...@gmail.com> wrote:

> Hi,
>
> I'm using graph-tool to try to generate random graphs with a sequence of
> degrees. For example, in a 3-node graph, I generated a random graph with
> all nodes with input degrees 1 and output degrees 1.
>
> My code:
>
> >>> import graph_tool.all as gt>>> def deg_sampler():...      return 1,1... 
> >>> >>> g = gt.random_graph(3,deg_sampler,parallel_edges=True, 
> >>> self_loops=False)>>> gt.graph_draw(g)
>
> Can I generate a random graph defining the input and output degrees of
> each node? For example, tree nodes with respectively the input degrees (1,
> 2, 0) and output degrees (1, 0, 2).
>
> Thanks,
>
> Alvaro
> _______________________________________________
> graph-tool mailing list
> graph-tool@skewed.de
> https://lists.skewed.de/mailman/listinfo/graph-tool
>
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to