[Lemon-user] countIncEdges doesn't give correct answer

Balázs Dezső deba.mf at gmail.com
Fri Jul 19 14:33:59 CEST 2013


Could you send a self contained example when the countIncEdges()
misbehaves? It would make easy debugging the problem.

On Fri, Jul 19, 2013 at 2:07 PM, likaiming <likaiming at gmail.com> wrote:
> Alpar, thanks for your feedback. Not really, since loops were not added to
> the graph. Had anyone encountered similar problem ?
>
> On Jul 19, 2013 7:58 AM, "Alpar Juttner" <alpar at cs.elte.hu> wrote:
>>
>> By definition, countIncEdges() counts the loop edges twice.
>> Isn't this the root of the problem?
>>
>> Regards,
>> Alpar
>> On Thu, 2013-07-18 at 13:29 -0400, Kaiming Li wrote:
>> > Hi there,
>> >
>> > I'm constructing an undirected graph (grf, which is a ListGraph obj) via
>> > an existing structure (allEdges), and I know the number of nodes
>> > (numNodes) and edges (numConnections):
>> >
>> >
>> >    for ( int idx = 0; idx < numNodes ; ++idx )
>> >     {
>> >         grf.addNode();
>> >     } // end for loop::idx
>> >
>> >
>> >     for ( int idx = 0; idx < numConnections ; ++idx )
>> >     {
>> >         if(allEdges[idx].z > threshold && allEdges[idx].x !=
>> > allEdges[idx].y) { //remove loops and low prob edge; x,y are node index,
>> > and z is weight
>> >             ListGraph::Node nv = grf.nodeFromId(allEdges[idx].x);
>> >             ListGraph::Node nu = grf.nodeFromId(allEdges[idx].y);
>> >             ListGraph::Edge eg = grf.addEdge(nu,nv);
>> >             prob[eg] = allEdges[idx].z;
>> >         }
>> >     } // end for loop::idx
>> >
>> > However, when I call method : countIncEdges(grf, grf.nodeFromId(0)), it
>> > doen't give me the correct result, which is the degree of the first
>> > node.
>> >
>> > Any comment?
>> > Thanks,
>> >
>> >
>> >
>> > _______________________________________________
>> > Lemon-user mailing list
>> > Lemon-user at lemon.cs.elte.hu
>> > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>> >
>>
>>
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>


More information about the Lemon-user mailing list