You can just put the weights in another vector, in the same order as the
edges.

In the igraph C library for most functions that support edge weights, you
need to pass the them as a separate argument, so keeping them in a separate
vector is fine in most cases.

Gabor


On Fri, Feb 28, 2014 at 8:53 AM, Przemyslaw Grabowicz <
[email protected]> wrote:

>  Thanks, that's helpful, but I forgot to mention that my graph is
> weighted.
>
> In such case, I should create matrix_t with igraph_matrix_init, fill it
> with my weights, and create a graph using igraph_weighted_adjacency? (Is
> there any other option?)
>
> Thanks,
> Przemek.
>
>
>
> On 28/02/2014 00:05, Gábor Csárdi wrote:
>
> There is no easy way, AFAIK. We could have a matrix view, that handles a
> chunk of memory as a dense matrix, and if the vector of vectors in C++ is a
> continuous chunk of memory, then there was an easy way.
>
>  But right now, just go over the matrix, put the non-zero edges in an
> igraph_vector_t and call igraph_create().
>
>  Gabor
>
>
>  On Thu, Feb 27, 2014 at 5:14 PM, Przemyslaw Grabowicz <
> [email protected]> wrote:
>
>> Dear all,
>>
>> I know that igraph is written in C. However, what is the easiest way of
>> creating an igraph graph from an adjacency matrix declared as a vector of
>> vectors or from a list of links declared as a vector in C++?
>>
>> Thanks,
>> Przemyslaw Grabowicz.
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>
>
>
> _______________________________________________
> igraph-help mailing 
> [email protected]https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to