[Lemon-user] countIncEdges doesn't give correct answer
Kaiming Li
likaiming at gmail.com
Thu Jul 18 19:29:38 CEST 2013
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,
More information about the Lemon-user
mailing list