算法

算法

获取算法列表

List<Table> tables = client.listAlgo();

中心度查询

节点出度(Out Degree)

OutDegreeRequest request = new OutDegreeRequest();
request.setNodeId(12L);
List<Table> tables = client.outDegree(request);

全图节点出度(Out Degree - all nodes)

OutDegreeAllRequest request = new OutDegreeAllRequest();
List<Table> tables = client.outDegreeAll(request);

节点入度(In Degree)

InDegreeRequest request = new InDegreeRequest();
request.setNodeId(12L);
List<Table> tables = client.inDegree(request);

全图节点入度(In Degree - all nodes)

InDegreeAllRequest request = new InDegreeAllRequest();
List<Table> tables = client.inDegreeAll(request);

度中心度(Degree Centrality)

DegreeCentralityRequest request = new DegreeCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.degreeCentrality(request);

全图度中心度(Degree Centrality - all nodes)

DegreeCentralityAllRequest request = new DegreeCentralityAllRequest();
List<Table> tables = client.degreeCentralityAll(request);

中心性计算

接近中心性(Closeness Centrality)

ClosenessCentralityRequest request = new ClosenessCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.closenessCentrality(request);

点出接近中心性(Out Closeness Centrality)

OutClosenessCentralityRequest request = new OutClosenessCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.outClosenessCentrality(request);

点入接近中心性(In Closeness Centrality)

InClosenessCentralityRequest request = new InClosenessCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.inClosenessCentrality(request);

图中心度(Graph Centrality)

GraphCentralityRequest request = new GraphCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.graphCentrality(request);

中介中心性(Betweenness Centrality)

BetweennessCentralityRequest request = new BetweennessCentralityRequest();
request.setNodeId(12L);
List<Table> tables = client.betweennessCentrality(request);

通用图算法

全图K邻算法

KhopAlgoRequest request = new KhopAlgoRequest();
request.setDepth(1);
List<Table> tables = client.khopAlgo(request);

连通分量计算(Connected Component)

List<Table> tables = client.connectedComponent();

三角形计算(Triangle Counting)

List<Table> tables = client.triangleCounting();

共同邻居数计算(Common Neighbours)

CommonNeighboursRequest request = new CommonNeighboursRequest();
request.setNodeId1(12);
request.setNodeId2(24);
List<Table> tables = client.commonNeighbours(request);

子图拼接(subgraph)

SubgraphRequest request = new SubgraphRequest();
request.setNodeIds(new int[] {1,2,3,4});
List<Table> tables = client.subGraph(request);

复杂图计算

图平均距离估算(hyperANF)

HyperANFRequest request = new HyperANFRequest();
request.setLoopNum(2);
request.setRegisterNum(4);
List<Table> tables = client.hyperANF(request);

k最近邻(kNN)

KNearestNeighborRequest request = new KNearestNeighborRequest();
request.setNodeId(2);
request.setNodePropertyNames(Arrays.asList("age"));
request.setTop(10);
request.setTargetPropertyName("name");
List<Table> tables = client.kNearestNeighbor(request);

核心度 (k-core)

KCoreRequest request = new KCoreRequest();
request.setK(5);
List<Table> tables = client.kCore(request);

最小生成树(MST)

MinimumSpanningTreeRequest request = new MinimumSpanningTreeRequest();
request.setStartNodeId(12);
request.setEdgePropertyName("rank");
request.setWriteBack(true);
List<Table> tables = client.minimumSpanningTree(request);

K均值(k-Means)

KMeansRequest request = new KMeansRequest();
request.setK(3);
request.setStartIds(Arrays.asList(1,2,3,4));
request.setLoopNum(2);
request.setNodePropertyNames(Arrays.asList("age"));
request.setDistanceType(DistanceType.CosineSimilarityDistance);
List<Table> tables = client.kMeans(request);

局部聚集系数(Clustering Coefficient)

ClusteringCoefficientRequest request = 
new ClusteringCoefficientRequest();
request.setNodeId(12);
List<Table> tables = client.clusteringCoefficient(request);

社区识别与传播类算法

网页排名(Page Rank)

PageRankRequest request = new PageRankRequest();
request.setLoopNum(2);
request.setDamping(0.8f);
List<Table> tables = client.pageRank(request);

西比尔识别(Sybil Rank)

SybilRankRequest request = new SybilRankRequest();
request.setLoopNum(2);
request.setSybilNum(10);
request.setTrustSeeds(Arrays.asList(63342,12324,52356,18974,9634,34));
request.setTotalTrust(100);
List<Table> tables = client.sybilRank(request);

标签传播算法 (Label Propagation)

LabelPropagationRequest request = new LabelPropagationRequest();
request.setLoopNum(2);
request.setNodePropertyName("name");
List<Table> tables = client.labelPropagation(request);

HANP (Hop Attenuation & Node Preference)

HANPRequest request = new HANPRequest();
request.setLoopNum(2);
request.setDelta(1);
request.setEdgePropertyName("rank");
request.setNodePropertyName("age");
request.setM(2);
request.setWriteBack(true);
List<Table> tables = client.hanp(request);

鲁汶社区识别算法 (Louvain)

LouvainRequest request = new LouvainRequest();
request.setPhase1Loop(5);
request.setMinModularityIncrease(0.01f);
request.setEdgePropertyName("rank");
List<Table> tables = client.louvain(request);

鲁汶算法可视化

LouvaindvRequest request = new LouvaindvRequest();
request.setTaskId(1);
request.setTop(1);
request.setTotal(500);
List<Table> tables = client.louvainDv(request);

相似度算法

杰卡德相似度(Jaccard Similarity)

JaccardSimilarityRequest request = new JaccardSimilarityRequest();
request.setNodeId1(1);
request.setNodeId2(2);
request.setTop(3);
List<Table> tables = client.jaccardSimilarity(request);

余弦相似度(Cosine Similarity)

CosineSimilarityRequest request = new CosineSimilarityRequest();
request.setNodeId1(1);
request.setNodeId2(2);
request.setNodePropertyNames(Arrays.asList("name", "age"));
List<Table> tables = client.cosineSimilarity(request);

图嵌入算法(Graph Embedding)

随机游走(Random Walk)

完全随机游走

RandomWalkRequest request = new RandomWalkRequest();
request.setWalkNum(2);
request.setWalkLength(2);
request.setEdgePropertyName("age");
List<Table> tables = client.randomWalk(request);

Node2Vec随机游走

RandomWalkNode2VecRequest request = new RandomWalkNode2VecRequest();
request.setWalkNum(1);
request.setWalkLength(1);
request.setP(1);
request.setQ(1);
request.setEdgePropertyName("age");
List<Table> tables = client.randomWalkNode2Vec(request);

Struc2Vec 随机游走

RandomWalkStruc2VecRequest request = new RandomWalkStruc2VecRequest();
request.setWalkNum(1);
request.setWalkLength(1);
request.setK(1);
request.setStayProbability(0.5f);
List<Table> tables = client.randomWalkStruc2Vec(request);

Node2Vec

Node2VecRequest request = new Node2VecRequest();
request.setLoopNum(1);
request.setContextSize(1);
request.setDimension(1);
request.setEdgePropertyName("rank");
request.setIterNum(1);
request.setLearningRate(.5);
request.setMinFrequency(1);
request.setMinLearningRate(.5);
request.setNegNum(1);
request.setP(.5f);
request.setQ(.5f);
request.setResolution(1);
request.setSubSampleAlpha(.5);
request.setWalkLength(1);
request.setWalkNum(1);
List<Table> tables = client.node2Vec(request);

LINE算法(large information network embedding)

LINERequest request = new LINERequest();
request.setDimension(1);
request.setEdgePropertyName("rank");
request.setNegNum(1);
request.setResolution(1);
request.setStartAlpha(.5);
request.setTotalSample(1);
request.setTrainOrder(1);
List<Table> tables = client.line(request);

Struc2Vec算法

Struc2VecRequest request = new Struc2VecRequest();
request.setContextSize(1);
request.setDimension(1);
request.setK(1);
request.setLearningRate(.5);
request.setLoopNum(1);
request.setMinFrequency(1);
request.setMinLearningRate(.5);
request.setNegNum(1);
request.setResolution(1);
request.setStayProbability(.5f);
request.setSubSampleAlpha(.5);
request.setWalkLength(1);
request.setWalkNum(1);
request.setWindowSize(1);
List<Table> tables = client.struc2vec(request);