50 if (link1->first == link2->first) {
51 return link1->second < link2->second;
54 return link1->first < link2->first;
68 " larger than number of elements attempted");
85 "before checks for links can be made");
89 " larger than number of elements attempted");
104 "before checks for links can be made");
108 ITERATE (vector<int>, it1, elems1) {
109 ITERATE (vector<int>, it2, elems2) {
120 dist = sum / ((double)(elems1.size() * elems2.size()));
162 if (
first > second) {
167 vector<SLink*>::const_iterator it = lower_bound(
m_LinkPtrs.begin(),
173 && (*it)->second == second) {
Exceptions for CLinks class.
Set of edges with weights between nodes represented by zero-based positive integers.
void x_InitLinkPtrs(void)
Initialize secondary list of link pointers.
void AddLink(int first, int second, double weight)
Add link.
bool IsLink(int first, int second) const
Check if link exists between given two nodes.
double m_MaxWeight
Maximym weight in the list.
void Sort(void)
Sort links according to weights in ascending order.
vector< SLink * > m_LinkPtrs
Pointers to links in m_Links sorted according to node indexes; used for checks whether a link exists.
list< SLink > m_Links
Links.
Uint4 m_NumElements
Number of nodes.
bool m_IsSorted
Is list of links sorted.
Uint4 m_NumLinks
Number of links.
const CLinks::SLink * x_GetLink(int first, int second) const
Get link by node ids.
bool x_IsLinkPtr(int first, int second) const
Check if link exists by searching list of link pointers sorted by node indexes.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static bool compare_links_by_nodes(const CLinks::SLink *link1, const CLinks::SLink *link2)
constexpr auto sort(_Init &&init)
double weight
Edge weight.