mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
Delete graph-feature-service/doc directory
This commit is contained in:
parent
d7faf3c653
commit
e4dc4de93a
|
@ -1,62 +0,0 @@
|
|||
# Common thrift types
|
||||
|
||||
GFS uses several thrift datastructures which are common to multiple queries. They are listed below.
|
||||
|
||||
## EdgeType
|
||||
|
||||
`EdgeType` is a thrift enum which specifies which edge types to query for the graph.
|
||||
|
||||
```thrift
|
||||
enum EdgeType {
|
||||
FOLLOWING,
|
||||
FOLLOWED_BY,
|
||||
FAVORITE,
|
||||
FAVORITED_BY,
|
||||
RETWEET,
|
||||
RETWEETED_BY,
|
||||
REPLY,
|
||||
REPLYED_BY,
|
||||
MENTION,
|
||||
MENTIONED_BY,
|
||||
MUTUAL_FOLLOW,
|
||||
SIMILAR_TO, // more edge types (like block, report, etc.) can be supported later.
|
||||
RESERVED_12,
|
||||
RESERVED_13,
|
||||
RESERVED_14,
|
||||
RESERVED_15,
|
||||
RESERVED_16,
|
||||
RESERVED_17,
|
||||
RESERVED_18,
|
||||
RESERVED_19,
|
||||
RESERVED_20
|
||||
}
|
||||
```
|
||||
|
||||
For an example of how this is used, consider the `GetNeighbors` query. If we set the `edgeType` field
|
||||
of the `GfsNeighborsRequest`, the response will contain all the users that the specified user follows.
|
||||
If, on the other hand, we set `edgeType` to be `FollowedBy` it will return all the users who are
|
||||
followed by the specified user.
|
||||
|
||||
## FeatureType
|
||||
|
||||
`FeatureType` is a thrift struct which is used in queries which require two edge types.
|
||||
|
||||
```thrift
|
||||
struct FeatureType {
|
||||
1: required EdgeType leftEdgeType // edge type from source user
|
||||
2: required EdgeType rightEdgeType // edge type from candidate user
|
||||
}(persisted="true")
|
||||
```
|
||||
|
||||
## UserWithScore
|
||||
|
||||
The candidate generation queries return lists of candidates together with a computed score for the
|
||||
relevant feature. `UserWithScore` is a thrift struct which bundles together a candidate's ID with
|
||||
the score.
|
||||
|
||||
```thrift
|
||||
struct UserWithScore {
|
||||
1: required i64 userId
|
||||
2: required double score
|
||||
}
|
||||
```
|
|
@ -1,43 +0,0 @@
|
|||
# GetIntersection
|
||||
|
||||
## Request and response syntax
|
||||
|
||||
A `GetIntersection` call takes as input a `GfsIntersectionRequest` thrift struct.
|
||||
|
||||
```thrift
|
||||
struct GfsIntersectionRequest {
|
||||
1: required i64 userId
|
||||
2: required list<i64> candidateUserIds
|
||||
3: required list<FeatureType> featureTypes
|
||||
}
|
||||
```
|
||||
|
||||
The response is returned in a `GfsIntersectionResponse` thrift struct.
|
||||
|
||||
```thrift
|
||||
struct GfsIntersectionResponse {
|
||||
1: required i64 userId
|
||||
2: required list<GfsIntersectionResult> results
|
||||
}
|
||||
|
||||
struct GfsIntersectionResult {
|
||||
1: required i64 candidateUserId
|
||||
2: required list<IntersectionValue> intersectionValues
|
||||
}
|
||||
|
||||
struct IntersectionValue {
|
||||
1: required FeatureType featureType
|
||||
2: optional i32 count
|
||||
3: optional list<i64> intersectionIds
|
||||
4: optional i32 leftNodeDegree
|
||||
5: optional i32 rightNodeDegree
|
||||
}(persisted="true")
|
||||
```
|
||||
|
||||
## Behavior
|
||||
|
||||
The `GfsIntersectionResponse` contains in its `results` field a `GfsIntersectionResult` for every candidate in `candidateIds` which contains an `IntersectionValue` for every `FeatureType` in the request's `featureTypes` field.
|
||||
|
||||
The `IntersectionValue` contains the size of the intersection between the `leftEdgeType` edges from `userId` and the `rightEdgeType` edges from `candidateId` in the `count` field, as well as their respective degrees in the graphs in `leftNodeDegree` and `rightNodeDegree` respectively.
|
||||
|
||||
**Note:** the `intersectionIds` field currently only contains `Nil`.
|
Loading…
Reference in New Issue
Block a user