[Lemon-user] countIncEdges doesn't give correct answer
Alpar Juttner
alpar at cs.elte.hu
Fri Jul 19 13:58:33 CEST 2013
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
>
More information about the Lemon-user
mailing list