-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEdge.hpp
75 lines (56 loc) · 1.24 KB
/
Edge.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// Edage.h
// SocialNetWork
//
// Created by 王珏 on 15/12/22.
// Copyright © 2015年 王珏. All rights reserved.
//
#ifndef Edage_h
#define Edage_h
#include <vector>
class Node;
using namespace std;
class Edge{
public:
int id;
int sourceNodeId;
int targetNodeId;
Node* sourceNode;
Node* targetNode;
//topic分布
double* realDistribution;
double weight;
double distance;
bool isVisited;
Edge(int idnum, Node* source, Node* target, double* realdistribution);
~Edge();
/*
bool operator == (const Edge& target)
{
return this->targetNode == target.targetNode;
}
*/
bool operator != (const Edge& target)
{
return this->targetNode != target.targetNode;
}
bool operator == (const Edge& target);
bool operator < ( const Edge& target)
{
return this->distance > target.distance;
}
bool smallerThan(const Edge* edge)const
{
return this->distance < edge->distance;
}
};
class EdgeCompare{
public:
EdgeCompare(){}
bool operator()(const Edge* source, const Edge* target)
{
return source->smallerThan(target);
}
};
bool findEdge(vector<Edge> edges, Edge edge);
#endif /* Edage_h */