Util function
This commit is contained in:
parent
ddc7e8b8c7
commit
e93735903e
@ -116,20 +116,26 @@ public:
|
|||||||
EdgeIterator FindEdge( const NodeIterator &from, const NodeIterator &to ) const {
|
EdgeIterator FindEdge( const NodeIterator &from, const NodeIterator &to ) const {
|
||||||
EdgeIterator smallestEdge = SPECIAL_EDGEID;
|
EdgeIterator smallestEdge = SPECIAL_EDGEID;
|
||||||
EdgeWeight smallestWeight = UINT_MAX;
|
EdgeWeight smallestWeight = UINT_MAX;
|
||||||
for ( EdgeIterator edge = BeginEdges( from ); edge < EndEdges(from); edge++ )
|
for ( EdgeIterator edge = BeginEdges( from ); edge < EndEdges(from); edge++ ) {
|
||||||
{
|
|
||||||
const NodeID target = GetTarget(edge);
|
const NodeID target = GetTarget(edge);
|
||||||
const EdgeWeight weight = GetEdgeData(edge).distance;
|
const EdgeWeight weight = GetEdgeData(edge).distance;
|
||||||
{
|
if(target == to && weight < smallestWeight) {
|
||||||
if(target == to && weight < smallestWeight)
|
smallestEdge = edge; smallestWeight = weight;
|
||||||
{
|
|
||||||
smallestEdge = edge; smallestWeight = weight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return smallestEdge;
|
return smallestEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EdgeIterator FindEdgeIndicateIfReverse( const NodeIterator &from, const NodeIterator &to, bool & result ) const {
|
||||||
|
EdgeIterator tmp = FindEdge( from, to );
|
||||||
|
if(UINT_MAX == tmp) {
|
||||||
|
tmp = FindEdge( to, from );
|
||||||
|
if(UINT_MAX != tmp)
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct _StrNode {
|
struct _StrNode {
|
||||||
|
Loading…
Reference in New Issue
Block a user