[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] contract.vertices() generates error "structure_generators.c
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] contract.vertices() generates error "structure_generators.c:84 : Invalid (negative) vertex id, Invalid vertex id" |
Date: |
Wed, 20 Nov 2013 09:38:12 -0500 |
You cannot eliminate negative vertex ids from an igraph graph, as it
can _never_ contain vertices with negative ids.
As for contract.vertices() I guess you are calling it with a wrong
'mapping' argument, but we would need to see you complete code to be
sure.
As for the projection of the bipartite graph, yes, it would make sense
to make it unipartite:
https://github.com/igraph/igraph/issues/255
Gabor
On Wed, Nov 20, 2013 at 6:56 AM, <address@hidden> wrote:
> Hello list,
>
> I already got the same error with bipartite.projection(). At that step I was
> able to solve the problem by
> 1) eliminating few negative ids and
> 2) eliminating few edges between same type nodes (the graph was then
> actually not truly bipartite).
>
> After correcting the bipartite graph I executed with no errors
>
> > igraph_onemode <- bipartite.projection(igraph_bi)
> > igraph_onemode
> IGRAPH UNWB 75439 50375688 --
> attr: ...
> > igraph_onemode_threads <- igraph_onemode$proj2
> > category_attr <- get.vertex.attribute(igraph_onemode_threads,
> "category")
> > # Map categories to integers, empty attribute is mapped to 4
> > map = setNames(c(1:4), c("category1",
> "category2",
> "category3",
> ""))
>
> And finally
>
> > igraph_category <- contract.vertices(igraph_onemode_threads,
> category_attr)
> Error in contract.vertices(igraph_onemode_threads, category_attr) :
> At structure_generators.c:84 : Invalid (negative) vertex id, Invalid
> vertex id
>
> But this error is quite unexpected since the vertex id went through
> bipartite.projection() which also check for negative values. Can still be a
> problem with edges between the nodes of the same type?
>
> I am more than happy to share data and code (only the
> 'igraph_onemode_threads' is 460MB) if can be help.
>
> PS: BTW, how come the graph returned from the one-mode projection is
> bipartite?
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help