You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by zh...@apache.org on 2024/08/20 04:24:34 UTC
(incubator-hugegraph-computer) 01/01: Migrate project to computer directory
This is an automated email from the ASF dual-hosted git repository.
zhaocong pushed a commit to branch migrate_1
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git
commit f75d3fc087e86394d29151ee3514ed4647e68802
Author: coderzc <zh...@apache.org>
AuthorDate: Tue Aug 20 12:24:08 2024 +0800
Migrate project to computer directory
---
.github/workflows/ci.yml | 1 +
computer-algorithm/pom.xml | 78 -
.../betweenness/BetweennessCentrality.java | 190 -
.../betweenness/BetweennessCentralityParams.java | 46 -
.../centrality/betweenness/BetweennessMessage.java | 88 -
.../centrality/betweenness/BetweennessValue.java | 71 -
.../centrality/closeness/ClosenessCentrality.java | 166 -
.../closeness/ClosenessCentralityParams.java | 45 -
.../centrality/closeness/ClosenessMessage.java | 87 -
.../centrality/closeness/ClosenessValue.java | 42 -
.../centrality/degree/DegreeCentrality.java | 124 -
.../centrality/degree/DegreeCentralityParams.java | 45 -
.../algorithm/centrality/pagerank/PageRank.java | 153 -
.../centrality/pagerank/PageRank4Master.java | 101 -
.../centrality/pagerank/PageRankParams.java | 44 -
.../community/cc/ClusteringCoefficientOutput.java | 61 -
.../community/cc/ClusteringCoefficientParams.java | 42 -
.../community/cc/ClusteringCoefficientValue.java | 92 -
.../computer/algorithm/community/kcore/Kcore.java | 122 -
.../algorithm/community/kcore/KcoreParams.java | 41 -
.../algorithm/community/kcore/KcoreValue.java | 100 -
.../computer/algorithm/community/lpa/Lpa.java | 99 -
.../algorithm/community/lpa/LpaParams.java | 38 -
.../community/trianglecount/TriangleCount.java | 116 -
.../trianglecount/TriangleCountParams.java | 42 -
.../algorithm/community/wcc/WccParams.java | 41 -
.../algorithm/path/rings/RingsDetection.java | 114 -
.../algorithm/path/rings/RingsDetectionOutput.java | 48 -
.../path/rings/filter/FilterDescribe.java | 83 -
.../path/rings/filter/RingsDetectionMessage.java | 76 -
.../rings/filter/RingsDetectionWithFilter.java | 121 -
.../filter/RingsDetectionWithFilterParams.java | 42 -
.../algorithm/path/rings/filter/SpreadFilter.java | 155 -
.../algorithm/path/shortest/QuantityType.java | 25 -
.../path/shortest/SingleSourceShortestPath.java | 285 --
.../shortest/SingleSourceShortestPathCombiner.java | 30 -
.../shortest/SingleSourceShortestPathMaster.java | 47 -
.../shortest/SingleSourceShortestPathOutput.java | 56 -
.../shortest/SingleSourceShortestPathValue.java | 103 -
.../computer/algorithm/sampling/RandomWalk.java | 389 --
.../algorithm/sampling/RandomWalkMessage.java | 96 -
.../algorithm/sampling/RandomWalkOutput.java | 48 -
.../algorithm/sampling/RandomWalkParams.java | 44 -
computer-api/pom.xml | 41 -
.../computer/algorithm/AlgorithmParams.java | 75 -
.../computer/core/aggregator/Aggregator.java | 91 -
.../core/aggregator/Aggregator4Master.java | 78 -
.../core/aggregator/Aggregator4Worker.java | 65 -
.../computer/core/allocator/Allocator.java | 32 -
.../computer/core/allocator/Recyclable.java | 21 -
.../computer/core/allocator/RecyclerReference.java | 43 -
.../hugegraph/computer/core/combiner/Combiner.java | 53 -
.../core/combiner/DoubleValueSumCombiner.java | 33 -
.../core/combiner/FloatValueSumCombiner.java | 33 -
.../core/combiner/IdListMergeCombiner.java | 39 -
.../computer/core/combiner/IdSetMergeCombiner.java | 30 -
.../core/combiner/IntValueSumCombiner.java | 33 -
.../core/combiner/LongValueSumCombiner.java | 33 -
.../core/combiner/MergeNewPropertiesCombiner.java | 53 -
.../core/combiner/MergeOldPropertiesCombiner.java | 53 -
.../computer/core/combiner/OverwriteCombiner.java | 33 -
.../core/combiner/OverwritePropertiesCombiner.java | 39 -
.../computer/core/combiner/ValueMaxCombiner.java | 37 -
.../computer/core/combiner/ValueMinCombiner.java | 37 -
.../hugegraph/computer/core/common/Constants.java | 75 -
.../hugegraph/computer/core/common/SerialEnum.java | 53 -
.../core/common/exception/ComputerException.java | 54 -
.../computer/core/config/ComputerOptions.java | 1024 ------
.../hugegraph/computer/core/config/Config.java | 50 -
.../computer/core/config/DefaultConfig.java | 203 --
.../computer/core/config/EdgeFrequency.java | 42 -
.../hugegraph/computer/core/config/HotConfig.java | 49 -
.../hugegraph/computer/core/config/Null.java | 30 -
.../computer/core/graph/GraphFactory.java | 76 -
.../hugegraph/computer/core/graph/edge/Edge.java | 44 -
.../hugegraph/computer/core/graph/edge/Edges.java | 25 -
.../hugegraph/computer/core/graph/id/Id.java | 29 -
.../computer/core/graph/id/IdFactory.java | 107 -
.../core/graph/properties/DefaultProperties.java | 129 -
.../computer/core/graph/properties/Properties.java | 41 -
.../computer/core/graph/value/BooleanValue.java | 109 -
.../computer/core/graph/value/DoubleValue.java | 132 -
.../computer/core/graph/value/IdList.java | 55 -
.../hugegraph/computer/core/graph/value/IdSet.java | 114 -
.../computer/core/graph/value/IntValue.java | 132 -
.../computer/core/graph/value/ListValue.java | 248 --
.../computer/core/graph/value/LongValue.java | 132 -
.../computer/core/graph/value/MapValue.java | 166 -
.../computer/core/graph/value/NullValue.java | 101 -
.../computer/core/graph/value/StringValue.java | 102 -
.../hugegraph/computer/core/graph/value/Value.java | 106 -
.../computer/core/graph/value/ValueType.java | 70 -
.../computer/core/graph/vertex/Vertex.java | 60 -
.../hugegraph/computer/core/input/InputFilter.java | 32 -
.../hugegraph/computer/core/io/BytesInput.java | 21 -
.../hugegraph/computer/core/io/BytesOutput.java | 33 -
.../computer/core/io/GraphComputeInput.java | 36 -
.../computer/core/io/GraphComputeOutput.java | 37 -
.../hugegraph/computer/core/io/GraphInput.java | 21 -
.../hugegraph/computer/core/io/GraphOutput.java | 22 -
.../computer/core/io/GraphWritebackOutput.java | 36 -
.../computer/core/io/RandomAccessInput.java | 78 -
.../computer/core/io/RandomAccessOutput.java | 67 -
.../hugegraph/computer/core/io/Readable.java | 25 -
.../hugegraph/computer/core/io/Writable.java | 25 -
.../core/master/DefaultMasterComputation.java | 43 -
.../computer/core/master/MasterComputation.java | 53 -
.../core/master/MasterComputationContext.java | 60 -
.../computer/core/master/MasterContext.java | 26 -
.../core/output/AbstractComputerOutput.java | 52 -
.../computer/core/output/ComputerOutput.java | 66 -
.../computer/core/output/hg/HugeGraphOutput.java | 104 -
.../output/hg/exceptions/WriteBackException.java | 39 -
.../core/output/hg/metrics/LoadMetrics.java | 47 -
.../core/output/hg/metrics/LoadReport.java | 40 -
.../core/output/hg/metrics/LoadSummary.java | 71 -
.../computer/core/output/hg/metrics/Printer.java | 56 -
.../core/output/hg/task/BatchInsertTask.java | 101 -
.../computer/core/output/hg/task/InsertTask.java | 79 -
.../core/output/hg/task/SingleInsertTask.java | 60 -
.../computer/core/output/hg/task/TaskManager.java | 187 -
.../hugegraph/computer/core/util/BytesUtil.java | 76 -
.../hugegraph/computer/core/util/CoderUtil.java | 157 -
.../hugegraph/computer/core/util/IdUtil.java | 53 -
.../hugegraph/computer/core/util/JsonUtilExt.java | 46 -
.../computer/core/worker/ComputationContext.java | 134 -
.../computer/core/worker/FilterComputation.java | 111 -
.../computer/core/worker/ReduceComputation.java | 97 -
.../computer/core/worker/WorkerContext.java | 36 -
computer-core/pom.xml | 81 -
.../computer/core/aggregator/Aggregators.java | 79 -
.../core/aggregator/DefaultAggregator.java | 169 -
.../core/aggregator/MasterAggrManager.java | 154 -
.../core/aggregator/RegisterAggregators.java | 73 -
.../computer/core/allocator/DefaultAllocator.java | 81 -
.../computer/core/allocator/RecycleHandler.java | 35 -
.../hugegraph/computer/core/bsp/Bsp4Master.java | 220 --
.../hugegraph/computer/core/bsp/Bsp4Worker.java | 256 --
.../hugegraph/computer/core/bsp/BspBase.java | 141 -
.../hugegraph/computer/core/bsp/BspClient.java | 76 -
.../hugegraph/computer/core/bsp/BspEvent.java | 54 -
.../hugegraph/computer/core/bsp/EtcdBspClient.java | 81 -
.../hugegraph/computer/core/bsp/EtcdClient.java | 457 ---
.../core/combiner/AbstractPointerCombiner.java | 71 -
.../computer/core/combiner/EdgeValueCombiner.java | 32 -
.../core/combiner/MessageValueCombiner.java | 34 -
.../computer/core/common/ContainerInfo.java | 135 -
.../core/common/exception/IllegalArgException.java | 43 -
.../core/common/exception/TransportException.java | 69 -
.../core/common/exception/WriteException.java | 39 -
.../computer/core/compute/ComputeManager.java | 206 --
.../computer/core/compute/FileGraphPartition.java | 445 ---
.../computer/core/compute/input/MessageInput.java | 125 -
.../core/compute/input/ReusablePointer.java | 104 -
.../computer/core/compute/input/VertexInput.java | 87 -
.../computer/core/graph/BuiltinGraphFactory.java | 199 -
.../computer/core/graph/SuperstepStat.java | 170 -
.../computer/core/graph/edge/DefaultEdge.java | 118 -
.../computer/core/graph/edge/DefaultEdges.java | 70 -
.../hugegraph/computer/core/graph/id/BytesId.java | 212 --
.../core/graph/partition/HashPartitioner.java | 51 -
.../core/graph/partition/PartitionStat.java | 151 -
.../computer/core/graph/partition/Partitioner.java | 39 -
.../computer/core/graph/vertex/DefaultVertex.java | 166 -
.../hugegraph/computer/core/input/EdgeFetcher.java | 29 -
.../computer/core/input/ElementFetcher.java | 29 -
.../computer/core/input/GraphFetcher.java | 31 -
.../computer/core/input/HugeConverter.java | 99 -
.../hugegraph/computer/core/input/IdUtil.java | 66 -
.../computer/core/input/InputSourceFactory.java | 55 -
.../computer/core/input/InputSplitFetcher.java | 40 -
.../computer/core/input/MasterInputHandler.java | 65 -
.../computer/core/input/MasterInputManager.java | 62 -
.../computer/core/input/VertexFetcher.java | 29 -
.../computer/core/input/WorkerInputManager.java | 155 -
.../core/input/filter/DefaultInputFilter.java | 37 -
.../filter/ExtractAllPropertyInputFilter.java | 35 -
.../computer/core/input/hg/HugeEdgeFetcher.java | 46 -
.../computer/core/input/hg/HugeElementFetcher.java | 88 -
.../computer/core/input/hg/HugeGraphFetcher.java | 72 -
.../core/input/hg/HugeInputSplitFetcher.java | 83 -
.../computer/core/input/hg/HugeVertexFetcher.java | 47 -
.../core/input/loader/FileEdgeFetcher.java | 71 -
.../core/input/loader/FileElementFetcher.java | 139 -
.../computer/core/input/loader/FileInputSplit.java | 84 -
.../input/loader/LoaderFileInputSplitFetcher.java | 207 --
.../core/input/loader/LoaderGraphFetcher.java | 64 -
.../core/io/AbstractBufferedFileInput.java | 161 -
.../core/io/AbstractBufferedFileOutput.java | 103 -
.../computer/core/io/BufferedFileInput.java | 109 -
.../computer/core/io/BufferedFileOutput.java | 99 -
.../computer/core/io/BufferedStreamInput.java | 180 -
.../computer/core/io/BufferedStreamOutput.java | 191 -
.../computer/core/io/CsvStructGraphOutput.java | 138 -
.../hugegraph/computer/core/io/IOFactory.java | 88 -
.../computer/core/io/JsonStructGraphOutput.java | 168 -
.../computer/core/io/OptimizedBytesInput.java | 235 --
.../computer/core/io/OptimizedBytesOutput.java | 213 --
.../hugegraph/computer/core/io/OutputFormat.java | 27 -
.../computer/core/io/StreamGraphInput.java | 162 -
.../computer/core/io/StreamGraphOutput.java | 142 -
.../computer/core/io/StructGraphOutput.java | 116 -
.../computer/core/io/StructRandomAccessOutput.java | 166 -
.../computer/core/io/UnsafeBytesInput.java | 284 --
.../computer/core/io/UnsafeBytesOutput.java | 267 --
.../hugegraph/computer/core/manager/Manager.java | 76 -
.../hugegraph/computer/core/manager/Managers.java | 86 -
.../computer/core/master/MasterService.java | 507 ---
.../computer/core/network/ClientHandler.java | 27 -
.../computer/core/network/ConnectionId.java | 110 -
.../computer/core/network/DataClientManager.java | 126 -
.../computer/core/network/DataServerManager.java | 65 -
.../hugegraph/computer/core/network/IOMode.java | 28 -
.../computer/core/network/MessageHandler.java | 47 -
.../computer/core/network/TransportClient.java | 95 -
.../computer/core/network/TransportConf.java | 213 --
.../computer/core/network/TransportHandler.java | 42 -
.../computer/core/network/TransportProvider.java | 25 -
.../computer/core/network/TransportServer.java | 59 -
.../computer/core/network/TransportState.java | 28 -
.../computer/core/network/TransportUtil.java | 167 -
.../computer/core/network/buffer/NettyBuffer.java | 75 -
.../core/network/buffer/NetworkBuffer.java | 73 -
.../computer/core/network/buffer/NioBuffer.java | 74 -
.../core/network/connection/ConnectionManager.java | 87 -
.../connection/TransportConnectionManager.java | 151 -
.../core/network/message/AbstractMessage.java | 197 -
.../computer/core/network/message/AckMessage.java | 44 -
.../computer/core/network/message/DataMessage.java | 69 -
.../computer/core/network/message/FailMessage.java | 86 -
.../core/network/message/FinishMessage.java | 42 -
.../computer/core/network/message/Message.java | 65 -
.../computer/core/network/message/MessageType.java | 72 -
.../computer/core/network/message/PingMessage.java | 38 -
.../computer/core/network/message/PongMessage.java | 38 -
.../core/network/message/RequestMessage.java | 25 -
.../core/network/message/ResponseMessage.java | 25 -
.../core/network/message/StartMessage.java | 44 -
.../core/network/netty/AbstractNettyHandler.java | 144 -
.../core/network/netty/BufAllocatorFactory.java | 29 -
.../netty/ChannelFutureListenerOnWrite.java | 78 -
.../core/network/netty/HeartbeatHandler.java | 89 -
.../core/network/netty/NettyClientFactory.java | 228 --
.../core/network/netty/NettyClientHandler.java | 116 -
.../core/network/netty/NettyEventLoopUtil.java | 109 -
.../computer/core/network/netty/NettyProtocol.java | 203 --
.../core/network/netty/NettyServerHandler.java | 235 --
.../core/network/netty/NettyTransportClient.java | 196 -
.../core/network/netty/NettyTransportProvider.java | 42 -
.../core/network/netty/NettyTransportServer.java | 226 --
.../core/network/netty/ServerIdleHandler.java | 58 -
.../core/network/netty/codec/FrameDecoder.java | 73 -
.../core/network/netty/codec/MessageDecoder.java | 97 -
.../core/network/netty/codec/MessageEncoder.java | 90 -
.../network/netty/codec/PreciseFrameDecoder.java | 98 -
.../core/network/session/ClientSession.java | 275 --
.../core/network/session/ServerSession.java | 141 -
.../computer/core/output/LimitedLogOutput.java | 56 -
.../hugegraph/computer/core/output/LogOutput.java | 42 -
.../computer/core/output/hdfs/HdfsOutput.java | 174 -
.../core/output/hdfs/HdfsOutputMerger.java | 88 -
.../core/output/hg/HugeGraphDoubleOutput.java | 30 -
.../core/output/hg/HugeGraphFloatOutput.java | 30 -
.../computer/core/output/hg/HugeGraphIdOutput.java | 37 -
.../core/output/hg/HugeGraphIntOutput.java | 30 -
.../core/output/hg/HugeGraphLongOutput.java | 30 -
.../core/output/hg/HugeGraphStringOutput.java | 30 -
.../computer/core/receiver/MessageRecvBuffers.java | 120 -
.../computer/core/receiver/MessageRecvManager.java | 260 --
.../core/receiver/MessageRecvPartition.java | 230 --
.../core/receiver/MessageRecvPartitions.java | 120 -
.../computer/core/receiver/MessageStat.java | 49 -
.../receiver/edge/EdgeMessageRecvPartition.java | 61 -
.../receiver/edge/EdgeMessageRecvPartitions.java | 51 -
.../message/ComputeMessageRecvPartition.java | 66 -
.../message/ComputeMessageRecvPartitions.java | 48 -
.../vertex/VertexMessageRecvPartition.java | 55 -
.../vertex/VertexMessageRecvPartitions.java | 52 -
.../computer/core/rpc/AggregateRpcService.java | 37 -
.../computer/core/rpc/InputSplitRpcService.java | 27 -
.../computer/core/rpc/MasterRpcManager.java | 73 -
.../computer/core/rpc/WorkerRpcManager.java | 70 -
.../computer/core/sender/MessageQueue.java | 58 -
.../computer/core/sender/MessageSendBuffers.java | 83 -
.../computer/core/sender/MessageSendManager.java | 294 --
.../computer/core/sender/MessageSendPartition.java | 76 -
.../computer/core/sender/MessageSender.java | 48 -
.../computer/core/sender/QueuedMessage.java | 47 -
.../computer/core/sender/QueuedMessageSender.java | 313 --
.../computer/core/sender/WriteBuffer.java | 95 -
.../computer/core/sender/WriteBuffers.java | 133 -
.../computer/core/snapshot/SnapshotManager.java | 271 --
.../computer/core/sort/BufferFileSorter.java | 105 -
.../computer/core/sort/DefaultSorter.java | 83 -
.../computer/core/sort/HgkvFileSorter.java | 108 -
.../hugegraph/computer/core/sort/Sorter.java | 111 -
.../core/sort/flusher/CombinableSorterFlusher.java | 67 -
.../sort/flusher/CombineKvInnerSortFlusher.java | 42 -
.../sort/flusher/CombineKvOuterSortFlusher.java | 47 -
.../sort/flusher/CombineSubKvInnerSortFlusher.java | 162 -
.../core/sort/flusher/InnerSortFlusher.java | 49 -
.../core/sort/flusher/KvInnerSortFlusher.java | 50 -
.../core/sort/flusher/KvOuterSortFlusher.java | 40 -
.../core/sort/flusher/OuterSortFlusher.java | 53 -
.../core/sort/flusher/PeekableIterator.java | 63 -
.../core/sort/flusher/PeekableIteratorAdaptor.java | 75 -
.../computer/core/sort/merge/FileMerger.java | 40 -
.../computer/core/sort/merge/FileMergerImpl.java | 120 -
.../computer/core/sort/sorter/InputSorter.java | 31 -
.../computer/core/sort/sorter/InputsSorter.java | 31 -
.../core/sort/sorter/InputsSorterImpl.java | 68 -
.../computer/core/sort/sorter/JavaInputSorter.java | 48 -
.../computer/core/sort/sorter/SubKvSorter.java | 130 -
.../core/sort/sorting/AbstractInputsSorting.java | 47 -
.../core/sort/sorting/HeapInputsSorting.java | 130 -
.../computer/core/sort/sorting/InputsSorting.java | 22 -
.../core/sort/sorting/LoserTreeInputsSorting.java | 146 -
.../core/sort/sorting/RecvSortManager.java | 57 -
.../core/sort/sorting/SendSortManager.java | 41 -
.../computer/core/sort/sorting/SortManager.java | 229 --
.../computer/core/sort/sorting/SortingFactory.java | 57 -
.../computer/core/sort/sorting/SortingMode.java | 27 -
.../computer/core/store/EntryIterator.java | 30 -
.../computer/core/store/FileGenerator.java | 66 -
.../computer/core/store/KvEntryFileReader.java | 22 -
.../computer/core/store/KvEntryFileWriter.java | 37 -
.../core/store/SuperstepFileGenerator.java | 50 -
.../computer/core/store/buffer/KvEntriesInput.java | 68 -
.../store/buffer/KvEntriesWithFirstSubKvInput.java | 51 -
.../core/store/buffer/SubKvEntriesInput.java | 73 -
.../computer/core/store/entry/AbstractKvEntry.java | 44 -
.../computer/core/store/entry/CachedPointer.java | 79 -
.../computer/core/store/entry/DefaultKvEntry.java | 37 -
.../computer/core/store/entry/EntriesUtil.java | 168 -
.../computer/core/store/entry/EntryInputImpl.java | 54 -
.../computer/core/store/entry/EntryOutput.java | 44 -
.../computer/core/store/entry/EntryOutputImpl.java | 65 -
.../computer/core/store/entry/InlinePointer.java | 78 -
.../computer/core/store/entry/KvEntry.java | 27 -
.../core/store/entry/KvEntryReaderImpl.java | 59 -
.../core/store/entry/KvEntryWithFirstSubKv.java | 40 -
.../computer/core/store/entry/KvEntryWriter.java | 29 -
.../computer/core/store/entry/Pointer.java | 32 -
.../hugegraph/computer/core/store/entry/Range.java | 25 -
.../file/bufferfile/BufferFileEntryBuilder.java | 56 -
.../file/bufferfile/BufferFileEntryReader.java | 87 -
.../file/bufferfile/BufferFileSubEntryReader.java | 81 -
.../core/store/file/hgkvfile/AbstractHgkvFile.java | 80 -
.../computer/core/store/file/hgkvfile/HgkvDir.java | 33 -
.../core/store/file/hgkvfile/HgkvDirImpl.java | 163 -
.../core/store/file/hgkvfile/HgkvFile.java | 66 -
.../store/file/hgkvfile/builder/BlockBuilder.java | 35 -
.../hgkvfile/builder/DataBlockBuilderImpl.java | 63 -
.../file/hgkvfile/builder/HgkvDirBuilderImpl.java | 107 -
.../file/hgkvfile/builder/HgkvFileBuilder.java | 56 -
.../file/hgkvfile/builder/HgkvFileBuilderImpl.java | 172 -
.../file/hgkvfile/builder/IndexBlockBuilder.java | 29 -
.../hgkvfile/builder/IndexBlockBuilderImpl.java | 50 -
.../hgkvfile/reader/HgkvDir4SubKvReaderImpl.java | 69 -
.../file/hgkvfile/reader/HgkvDirReaderImpl.java | 136 -
.../file/hgkvfile/reader/HgkvFileReaderImpl.java | 108 -
.../store/file/select/DefaultSelectedFiles.java | 43 -
.../store/file/select/DisperseEvenlySelector.java | 199 -
.../core/store/file/select/InputFilesSelector.java | 39 -
.../core/store/file/select/SelectedFiles.java | 27 -
.../core/store/file/seqfile/BitsFileReader.java | 33 -
.../store/file/seqfile/BitsFileReaderImpl.java | 64 -
.../core/store/file/seqfile/BitsFileWriter.java | 42 -
.../store/file/seqfile/BitsFileWriterImpl.java | 74 -
.../core/store/file/seqfile/ValueFile.java | 79 -
.../core/store/file/seqfile/ValueFileInput.java | 202 --
.../core/store/file/seqfile/ValueFileOutput.java | 192 -
.../computer/core/util/ComputerContextUtil.java | 89 -
.../hugegraph/computer/core/util/Consumers.java | 214 --
.../hugegraph/computer/core/util/FileUtil.java | 36 -
.../hugegraph/computer/core/util/JsonUtil.java | 63 -
.../computer/core/util/SerializeUtil.java | 84 -
.../computer/core/util/StringEncodeUtil.java | 52 -
.../computer/core/worker/WorkerService.java | 471 ---
.../hugegraph/computer/core/worker/WorkerStat.java | 109 -
.../computer/core/worker/load/LoadService.java | 248 --
computer-dist/Dockerfile | 26 -
computer-dist/pom.xml | 131 -
computer-dist/release-docs/LICENSE | 491 ---
computer-dist/release-docs/NOTICE | 3824 --------------------
.../licenses/LICENSE-accessors-smart.txt | 202 --
.../release-docs/licenses/LICENSE-activation.txt | 119 -
.../LICENSE-animal-sniffer-annotations.txt | 8 -
.../licenses/LICENSE-apiguardian-api.txt | 201 -
.../licenses/LICENSE-audience-annotations.txt | 202 --
.../licenses/LICENSE-auto-service-annotations.txt | 202 --
.../release-docs/licenses/LICENSE-automaton.txt | 24 -
.../release-docs/licenses/LICENSE-avro.txt | 387 --
.../licenses/LICENSE-bcprov-jdk18on.txt | 22 -
.../release-docs/licenses/LICENSE-bolt.txt | 201 -
.../licenses/LICENSE-builder-annotations.txt | 201 -
.../release-docs/licenses/LICENSE-byte-buddy.txt | 180 -
.../release-docs/licenses/LICENSE-checker-qual.txt | 22 -
.../licenses/LICENSE-commons-beanutils.txt | 202 --
.../release-docs/licenses/LICENSE-commons-cli.txt | 202 --
.../licenses/LICENSE-commons-codec.txt | 202 --
.../licenses/LICENSE-commons-collections.txt | 202 --
.../licenses/LICENSE-commons-compress.txt | 387 --
.../licenses/LICENSE-commons-configuration.txt | 202 --
.../licenses/LICENSE-commons-configuration2.txt | 202 --
.../licenses/LICENSE-commons-crypto.txt | 202 --
.../release-docs/licenses/LICENSE-commons-io.txt | 203 --
.../release-docs/licenses/LICENSE-commons-lang.txt | 202 --
.../licenses/LICENSE-commons-lang3.txt | 387 --
.../licenses/LICENSE-commons-logging.txt | 202 --
.../licenses/LICENSE-commons-math3.txt | 387 --
.../release-docs/licenses/LICENSE-commons-text.txt | 202 --
.../licenses/LICENSE-curator-client.txt | 202 --
.../licenses/LICENSE-curator-recipes.txt | 202 --
.../release-docs/licenses/LICENSE-disruptor.txt | 202 --
.../licenses/LICENSE-error_prone_annotations.txt | 202 --
.../release-docs/licenses/LICENSE-failsafe.txt | 202 --
.../licenses/LICENSE-findbugs-annotations.txt | 202 --
.../release-docs/licenses/LICENSE-generex.txt | 201 -
.../release-docs/licenses/LICENSE-groovy-all.txt | 250 --
.../release-docs/licenses/LICENSE-grpc-api.txt | 202 --
.../release-docs/licenses/LICENSE-grpc-context.txt | 202 --
.../release-docs/licenses/LICENSE-grpc-grpclb.txt | 202 --
.../release-docs/licenses/LICENSE-grpc-netty.txt | 202 --
.../licenses/LICENSE-grpc-protobuf-lite.txt | 202 --
.../licenses/LICENSE-grpc-protobuf.txt | 202 --
.../release-docs/licenses/LICENSE-grpc-stub.txt | 202 --
.../release-docs/licenses/LICENSE-gson.txt | 202 --
.../release-docs/licenses/LICENSE-guava.txt | 202 --
.../licenses/LICENSE-hadoop-annotations.txt | 1834 ----------
.../licenses/LICENSE-hadoop-common.txt | 1834 ----------
.../licenses/LICENSE-hadoop-hdfs-client.txt | 1834 ----------
.../licenses/LICENSE-hamcrest-core.txt | 27 -
.../release-docs/licenses/LICENSE-hbase-client.txt | 202 --
.../release-docs/licenses/LICENSE-hbase-common.txt | 202 --
.../licenses/LICENSE-hbase-hadoop-compat.txt | 202 --
.../licenses/LICENSE-hbase-hadoop2-compat.txt | 202 --
.../release-docs/licenses/LICENSE-hbase-http.txt | 202 --
.../licenses/LICENSE-hbase-metrics-api.txt | 202 --
.../licenses/LICENSE-hbase-metrics.txt | 202 --
.../licenses/LICENSE-hbase-protocol-shaded.txt | 202 --
.../licenses/LICENSE-hbase-replication.txt | 202 --
.../release-docs/licenses/LICENSE-hbase-server.txt | 202 --
.../LICENSE-hbase-shaded-client-byo-hadoop.txt | 202 --
.../LICENSE-hbase-shaded-miscellaneous.txt | 202 --
.../licenses/LICENSE-hbase-shaded-netty.txt | 202 --
.../licenses/LICENSE-hbase-shaded-protobuf.txt | 202 --
.../licenses/LICENSE-hbase-zookeeper.txt | 202 --
.../release-docs/licenses/LICENSE-hessian.txt | 201 -
.../release-docs/licenses/LICENSE-htrace-core4.txt | 202 --
.../licenses/LICENSE-hugegraph-client.txt | 202 --
.../licenses/LICENSE-hugegraph-common.txt | 202 --
.../licenses/LICENSE-hugegraph-loader.txt | 202 --
.../licenses/LICENSE-hugegraph-rpc.txt | 202 --
.../licenses/LICENSE-j2objc-annotations.txt | 202 --
.../licenses/LICENSE-jackson-core-asl.txt | 13 -
.../release-docs/licenses/LICENSE-jackson-core.txt | 202 --
.../licenses/LICENSE-jackson-dataformat-yaml.txt | 8 -
.../licenses/LICENSE-jackson-datatype-jsr310.txt | 8 -
.../licenses/LICENSE-jackson-jaxrs-base.txt | 8 -
.../LICENSE-jackson-jaxrs-json-provider.txt | 8 -
.../licenses/LICENSE-jackson-jaxrs.txt | 13 -
.../licenses/LICENSE-jackson-mapper-asl.txt | 13 -
.../LICENSE-jackson-module-jaxb-annotations.txt | 8 -
.../release-docs/licenses/LICENSE-jackson-xc.txt | 202 --
.../licenses/LICENSE-jakarta.activation-api.txt | 29 -
.../licenses/LICENSE-jakarta.activation.txt | 29 -
.../licenses/LICENSE-jamon-runtime.txt | 151 -
.../release-docs/licenses/LICENSE-javassist.txt | 137 -
.../licenses/LICENSE-javax.annotation-api.txt | 124 -
.../release-docs/licenses/LICENSE-javax.el.txt | 356 --
.../release-docs/licenses/LICENSE-javax.inject.txt | 348 --
.../release-docs/licenses/LICENSE-javax.json.txt | 362 --
.../licenses/LICENSE-javax.servlet-api.txt | 124 -
.../licenses/LICENSE-javax.servlet.jsp-api.txt | 356 --
.../licenses/LICENSE-javax.servlet.jsp.txt | 356 --
.../release-docs/licenses/LICENSE-jaxb-core.txt | 28 -
.../release-docs/licenses/LICENSE-jaxb-impl.txt | 335 --
.../licenses/LICENSE-jcip-annotations.txt | 202 --
.../release-docs/licenses/LICENSE-jcodings.txt | 17 -
.../release-docs/licenses/LICENSE-jcommander.txt | 202 --
.../release-docs/licenses/LICENSE-jersey-core.txt | 350 --
.../release-docs/licenses/LICENSE-jersey-json.txt | 350 --
.../licenses/LICENSE-jersey-servlet.txt | 350 --
.../release-docs/licenses/LICENSE-jetcd-common.txt | 202 --
.../release-docs/licenses/LICENSE-jetcd-core.txt | 202 --
.../release-docs/licenses/LICENSE-jettison.txt | 192 -
.../release-docs/licenses/LICENSE-jetty-http.txt | 290 --
.../release-docs/licenses/LICENSE-jetty-io.txt | 290 --
.../licenses/LICENSE-jetty-security.txt | 290 --
.../release-docs/licenses/LICENSE-jetty-server.txt | 290 --
.../licenses/LICENSE-jetty-servlet.txt | 290 --
.../licenses/LICENSE-jetty-util-ajax.txt | 292 --
.../release-docs/licenses/LICENSE-jetty-util.txt | 290 --
.../release-docs/licenses/LICENSE-jetty-webapp.txt | 290 --
.../release-docs/licenses/LICENSE-jetty-xml.txt | 290 --
.../release-docs/licenses/LICENSE-jline.txt | 32 -
.../release-docs/licenses/LICENSE-joda-time.txt | 202 --
.../release-docs/licenses/LICENSE-joni.txt | 21 -
.../release-docs/licenses/LICENSE-jsch.txt | 26 -
.../release-docs/licenses/LICENSE-json-smart.txt | 202 --
.../release-docs/licenses/LICENSE-jsr305.txt | 202 --
.../release-docs/licenses/LICENSE-junit.txt | 214 --
.../release-docs/licenses/LICENSE-kerb-admin.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-client.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-common.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-core.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-crypto.txt | 202 --
.../licenses/LICENSE-kerb-identity.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-server.txt | 202 --
.../licenses/LICENSE-kerb-simplekdc.txt | 202 --
.../release-docs/licenses/LICENSE-kerb-util.txt | 202 --
.../release-docs/licenses/LICENSE-kerby-asn1.txt | 202 --
.../release-docs/licenses/LICENSE-kerby-pkix.txt | 202 --
.../release-docs/licenses/LICENSE-kerby-util.txt | 202 --
.../release-docs/licenses/LICENSE-kerby-xdr.txt | 202 --
.../licenses/LICENSE-kotlin-stdlib-common.txt | 202 --
.../licenses/LICENSE-kotlin-stdlib-jdk7.txt | 202 --
.../licenses/LICENSE-kotlin-stdlib-jdk8.txt | 202 --
.../licenses/LICENSE-kubernetes-client.txt | 201 -
...ENSE-kubernetes-model-admissionregistration.txt | 201 -
.../licenses/LICENSE-kubernetes-model-apps.txt | 201 -
.../licenses/LICENSE-kubernetes-model-batch.txt | 201 -
.../LICENSE-kubernetes-model-certificates.txt | 201 -
.../licenses/LICENSE-kubernetes-model-common.txt | 201 -
.../LICENSE-kubernetes-model-coordination.txt | 201 -
.../licenses/LICENSE-kubernetes-model-core.txt | 201 -
.../LICENSE-kubernetes-model-discovery.txt | 201 -
.../licenses/LICENSE-kubernetes-model-events.txt | 201 -
.../LICENSE-kubernetes-model-extensions.txt | 201 -
.../LICENSE-kubernetes-model-flowcontrol.txt | 201 -
.../LICENSE-kubernetes-model-networking.txt | 201 -
.../licenses/LICENSE-kubernetes-model-node.txt | 201 -
.../licenses/LICENSE-kubernetes-model-policy.txt | 201 -
.../licenses/LICENSE-kubernetes-model-rbac.txt | 201 -
.../LICENSE-kubernetes-model-scheduling.txt | 201 -
.../LICENSE-kubernetes-model-storageclass.txt | 201 -
.../licenses/LICENSE-kubernetes-server-mock.txt | 201 -
.../licenses/LICENSE-lightning-csv.txt | 21 -
.../licenses/LICENSE-listenablefuture.txt | 202 --
.../release-docs/licenses/LICENSE-log4j-api.txt | 202 --
.../release-docs/licenses/LICENSE-log4j-core.txt | 202 --
.../licenses/LICENSE-log4j-slf4j-impl.txt | 202 --
.../release-docs/licenses/LICENSE-log4j.txt | 202 --
.../licenses/LICENSE-logging-interceptor.txt | 201 -
.../release-docs/licenses/LICENSE-lookout-api.txt | 202 --
.../release-docs/licenses/LICENSE-lz4-java.txt | 202 --
.../release-docs/licenses/LICENSE-minio.txt | 202 --
.../release-docs/licenses/LICENSE-mockito-core.txt | 21 -
.../release-docs/licenses/LICENSE-mvel2.txt | 201 -
.../release-docs/licenses/LICENSE-netty-all.txt | 202 --
.../release-docs/licenses/LICENSE-netty.txt | 202 --
.../licenses/LICENSE-nimbus-jose-jwt.txt | 202 --
.../release-docs/licenses/LICENSE-objenesis.txt | 202 --
.../release-docs/licenses/LICENSE-okhttp.txt | 202 --
.../release-docs/licenses/LICENSE-okio-jvm.txt | 202 --
.../release-docs/licenses/LICENSE-okio.txt | 202 --
.../licenses/LICENSE-opentracing-mock.txt | 202 --
.../licenses/LICENSE-opentracing-noop.txt | 202 --
.../licenses/LICENSE-opentracing-util.txt | 202 --
.../release-docs/licenses/LICENSE-ow2-asm.txt | 29 -
.../release-docs/licenses/LICENSE-paranamer.txt | 29 -
.../release-docs/licenses/LICENSE-perfmark-api.txt | 202 --
.../LICENSE-proto-google-common-protos.txt | 202 --
.../licenses/LICENSE-protobuf-java-util.txt | 32 -
.../licenses/LICENSE-protobuf-java.txt | 32 -
.../release-docs/licenses/LICENSE-re2j.txt | 27 -
.../licenses/LICENSE-resourcecify-annotations.txt | 201 -
.../licenses/LICENSE-sfm-converter.txt | 21 -
.../release-docs/licenses/LICENSE-sfm-map.txt | 21 -
.../release-docs/licenses/LICENSE-sfm-reflect.txt | 21 -
.../release-docs/licenses/LICENSE-sfm-tuples.txt | 21 -
.../release-docs/licenses/LICENSE-sfm-util.txt | 21 -
.../licenses/LICENSE-simple-xml-safe.txt | 201 -
.../release-docs/licenses/LICENSE-slf4j-api.txt | 21 -
.../release-docs/licenses/LICENSE-snakeyaml.txt | 202 --
.../release-docs/licenses/LICENSE-snappy-java.txt | 202 --
.../licenses/LICENSE-sofa-common-tools.txt | 202 --
.../release-docs/licenses/LICENSE-stax2-api.txt | 13 -
.../licenses/LICENSE-sundr-codegen.txt | 202 --
.../release-docs/licenses/LICENSE-sundr-core.txt | 201 -
.../licenses/LICENSE-swagger-annotations.txt | 202 --
.../release-docs/licenses/LICENSE-swagger-core.txt | 202 --
.../licenses/LICENSE-token-provider.txt | 202 --
.../release-docs/licenses/LICENSE-tracer-core.txt | 201 -
.../licenses/LICENSE-validation-api.txt | 202 --
.../licenses/LICENSE-woodstox-core.txt | 202 --
.../release-docs/licenses/LICENSE-zjsonpatch.txt | 201 -
.../release-docs/licenses/LICENSE-zookeeper.txt | 202 --
computer-dist/scripts/apache-release.sh | 104 -
.../scripts/dependency/check_dependencies.sh | 32 -
.../scripts/dependency/known-dependencies.txt | 276 --
.../dependency/regenerate_known_dependencies.sh | 33 -
computer-dist/src/assembly/dataset/schema.groovy | 47 -
computer-dist/src/assembly/dataset/struct.json | 211 --
computer-dist/src/assembly/descriptor/assembly.xml | 77 -
.../src/assembly/static/bin/start-computer.sh | 233 --
.../src/assembly/static/conf/computer.properties | 37 -
computer-dist/src/assembly/static/conf/log4j2.xml | 66 -
computer-dist/src/assembly/travis/build-images.sh | 33 -
computer-dist/src/assembly/travis/install-env.sh | 23 -
computer-dist/src/assembly/travis/install-hdfs.sh | 65 -
.../travis/install-hugegraph-from-source.sh | 46 -
.../assembly/travis/load-data-into-hugegraph.sh | 63 -
computer-dist/src/assembly/travis/start-etcd.sh | 31 -
.../hugegraph/computer/dist/HugeGraphComputer.java | 151 -
computer-driver/pom.xml | 38 -
.../computer/driver/ComputerDriverException.java | 55 -
.../hugegraph/computer/driver/DefaultJobState.java | 145 -
.../hugegraph/computer/driver/JobObserver.java | 26 -
.../apache/hugegraph/computer/driver/JobState.java | 42 -
.../hugegraph/computer/driver/JobStatus.java | 39 -
.../hugegraph/computer/driver/SuperstepStat.java | 120 -
.../computer/driver/config/DriverConfigOption.java | 73 -
.../hugegraph/computer/driver/util/JsonUtil.java | 59 -
computer-k8s-operator/Dockerfile | 21 -
computer-k8s-operator/crd-generate/.dockerignore | 20 -
computer-k8s-operator/crd-generate/.gitignore | 26 -
computer-k8s-operator/crd-generate/Dockerfile | 49 -
computer-k8s-operator/crd-generate/Makefile | 186 -
computer-k8s-operator/crd-generate/PROJECT | 41 -
computer-k8s-operator/crd-generate/README.md | 94 -
.../crd-generate/api/v1/groupversion_info.go | 59 -
.../api/v1/hugegraphcomputerjob_types.go | 182 -
.../api/v1/hugegraphcomputerjob_webhook.go | 103 -
.../crd-generate/api/v1/webhook_suite_test.go | 133 -
computer-k8s-operator/crd-generate/cmd/generate.go | 101 -
computer-k8s-operator/crd-generate/cmd/main.go | 98 -
.../config/certmanager/certificate.yaml | 41 -
.../config/certmanager/kustomization.yaml | 21 -
.../config/certmanager/kustomizeconfig.yaml | 32 -
.../crd-generate/config/crd/kustomization.yaml | 38 -
.../crd-generate/config/crd/kustomizeconfig.yaml | 35 -
.../cainjection_in_hugegraphcomputerjobs.yaml | 23 -
.../patches/webhook_in_hugegraphcomputerjobs.yaml | 32 -
.../crd-generate/config/default/kustomization.yaml | 90 -
.../config/default/manager_config_patch.yaml | 36 -
.../config/default/manager_webhook_patch.yaml | 39 -
.../config/default/webhookcainjection_patch.yaml | 31 -
.../crd-generate/config/etcd/etcd_server.yaml | 101 -
.../crd-generate/config/etcd/kustomization.yaml | 27 -
.../config/manager/controller_manager_config.yaml | 27 -
.../crd-generate/config/manager/kustomization.yaml | 38 -
.../crd-generate/config/manager/manager.yaml | 111 -
.../crd-generate/config/minio/kustomization.yaml | 27 -
.../crd-generate/config/minio/minio_server.yaml | 108 -
.../config/prometheus/kustomization.yaml | 18 -
.../crd-generate/config/prometheus/monitor.yaml | 36 -
.../config/rbac/auth_proxy_client_clusterrole.yaml | 25 -
.../crd-generate/config/rbac/auth_proxy_role.yaml | 33 -
.../config/rbac/auth_proxy_role_binding.yaml | 28 -
.../config/rbac/auth_proxy_service.yaml | 29 -
.../rbac/hugegraphcomputerjob_viewer_role.yaml | 36 -
.../crd-generate/config/rbac/kustomization.yaml | 38 -
.../config/rbac/leader_election_role.yaml | 53 -
.../config/rbac/leader_election_role_binding.yaml | 28 -
.../crd-generate/config/rbac/role.yaml | 205 --
.../crd-generate/config/rbac/role_binding.yaml | 28 -
.../crd-generate/config/rbac/service_account.yaml | 21 -
.../crd-generate/config/samples/kustomization.yaml | 20 -
.../samples/operator_v1_hugegraphcomputerjob.yaml | 22 -
.../crd-generate/config/webhook/kustomization.yaml | 22 -
.../config/webhook/kustomizeconfig.yaml | 41 -
.../crd-generate/config/webhook/service.yaml | 28 -
computer-k8s-operator/crd-generate/go.mod | 71 -
.../crd-generate/hack/boilerplate.go.txt | 15 -
.../manifest/hugegraph-computer-crd.v1beta1.yaml | 1091 ------
.../manifest/hugegraph-computer-operator.yaml | 806 -----
computer-k8s-operator/pom.xml | 73 -
.../computer/k8s/operator/OperatorEntrypoint.java | 248 --
.../k8s/operator/common/AbstractController.java | 438 ---
.../computer/k8s/operator/common/MatchWithMsg.java | 39 -
.../k8s/operator/common/OperatorRequest.java | 111 -
.../computer/k8s/operator/common/WorkQueue.java | 118 -
.../k8s/operator/config/OperatorOptions.java | 153 -
.../operator/controller/ComputerJobComponent.java | 84 -
.../operator/controller/ComputerJobController.java | 562 ---
.../operator/controller/ComputerJobDeployer.java | 650 ----
.../src/main/resources/log4j2.xml | 48 -
computer-k8s/schema/crd-schema.json | 320 --
computer-k8s/schema/enum-schema.json | 73 -
.../apache/hugegraph/computer/k8s/Constants.java | 65 -
.../computer/k8s/config/KubeDriverOptions.java | 157 -
.../k8s/crd/model/HugeGraphComputerJob.java | 60 -
.../k8s/crd/model/HugeGraphComputerJobList.java | 26 -
.../computer/k8s/driver/KubernetesDriver.java | 578 ---
.../hugegraph/computer/k8s/util/KubeUtil.java | 278 --
computer-k8s/src/main/resources/docker_push.sh | 87 -
computer-test/conf/images/docker_push_test.sh | 89 -
computer-test/conf/log4j2-test.xml | 42 -
computer-test/pom.xml | 208 --
.../computer/algorithm/AlgorithmTestBase.java | 150 -
.../computer/algorithm/AlgorithmTestSuite.java | 53 -
.../betweenness/BetweennessCentralityTest.java | 142 -
.../closeness/ClosenessCentralityTest.java | 163 -
.../centrality/degree/DegreeCentralityTest.java | 100 -
.../centrality/pagerank/PageRankTest.java | 29 -
.../community/cc/ClusteringCoefficientTest.java | 131 -
.../algorithm/community/kcore/KcoreTest.java | 29 -
.../community/trianglecount/TriangleCountTest.java | 132 -
.../computer/algorithm/community/wcc/WccTest.java | 35 -
.../algorithm/path/rings/RingsDetectionTest.java | 139 -
.../path/rings/RingsDetectionWithFilterTest.java | 134 -
.../shortest/SingleSourceShortestPathTest.java | 148 -
.../algorithm/sampling/RandomWalkTest.java | 180 -
.../core/allocator/AllocatorTestSuite.java | 29 -
.../core/allocator/DefaultAllocatorTest.java | 165 -
.../computer/core/allocator/RecyclersTest.java | 177 -
.../hugegraph/computer/core/bsp/BspEventTest.java | 42 -
.../hugegraph/computer/core/bsp/BspTestSuite.java | 29 -
.../hugegraph/computer/core/bsp/EtcdBspTest.java | 187 -
.../computer/core/bsp/EtcdClientTest.java | 265 --
.../computer/core/combiner/CombinerTestSuite.java | 37 -
.../core/combiner/DoubleValueSumCombinerTest.java | 63 -
.../core/combiner/FloatValueSumCombinerTest.java | 63 -
.../core/combiner/IntValueSumCombinerTest.java | 63 -
.../core/combiner/LongValueSumCombinerTest.java | 63 -
.../combiner/MergeNewPropertiesCombinerTest.java | 82 -
.../combiner/MergeOldPropertiesCombinerTest.java | 82 -
.../core/combiner/OverwriteCombinerTest.java | 64 -
.../core/combiner/PointerCombinerTest.java | 173 -
.../core/combiner/ValueMaxCombinerTest.java | 63 -
.../core/combiner/ValueMinCombinerTest.java | 56 -
.../computer/core/common/CommonTestSuite.java | 29 -
.../computer/core/common/ContainerInfoTest.java | 70 -
.../computer/core/common/ExceptionTest.java | 74 -
.../core/common/FakeMasterComputation.java | 46 -
.../computer/core/compute/ComputeManagerTest.java | 238 --
.../computer/core/compute/ComputeTestSuite.java | 34 -
.../computer/core/compute/MockComputation.java | 82 -
.../computer/core/compute/MockMessageSender.java | 46 -
.../core/compute/input/EdgesInputTest.java | 288 --
.../core/compute/input/MessageInputTest.java | 180 -
.../core/compute/input/ResuablePointerTest.java | 52 -
.../computer/core/config/ConfigTestSuite.java | 28 -
.../computer/core/config/DefaultConfigTest.java | 187 -
.../core/graph/BuiltinGraphFactoryTest.java | 102 -
.../computer/core/graph/DefaultEdgeTest.java | 88 -
.../computer/core/graph/DefaultPropertiesTest.java | 94 -
.../computer/core/graph/GraphTestSuite.java | 68 -
.../computer/core/graph/SuperstepStatTest.java | 162 -
.../computer/core/graph/id/BytesIdTest.java | 177 -
.../computer/core/graph/id/IdFactoryTest.java | 62 -
.../computer/core/graph/id/IdTypeTest.java | 49 -
.../core/graph/partition/HashPartitionerTest.java | 208 --
.../core/graph/partition/PartitionStatTest.java | 148 -
.../computer/core/graph/value/DoubleValueTest.java | 250 --
.../computer/core/graph/value/IdListListTest.java | 101 -
.../computer/core/graph/value/IdValueListTest.java | 85 -
.../computer/core/graph/value/IdValueTest.java | 216 --
.../computer/core/graph/value/IntValueTest.java | 256 --
.../computer/core/graph/value/ListValueTest.java | 458 ---
.../computer/core/graph/value/LongValueTest.java | 222 --
.../computer/core/graph/value/NullValueTest.java | 149 -
.../computer/core/graph/value/StringValueTest.java | 158 -
.../computer/core/input/FileInputSplitTest.java | 65 -
.../computer/core/input/HugeConverterTest.java | 129 -
.../computer/core/input/InputSplitDataTest.java | 97 -
.../computer/core/input/InputSplitTest.java | 51 -
.../computer/core/input/InputTestSuite.java | 31 -
.../core/input/MockMasterInputManager.java | 58 -
.../computer/core/input/MockRpcClient.java | 39 -
.../core/input/MockWorkerInputManager.java | 114 -
.../computer/core/io/BufferedFileTest.java | 751 ----
.../computer/core/io/BufferedStreamTest.java | 407 ---
.../computer/core/io/CsvStructGraphOutputTest.java | 163 -
.../hugegraph/computer/core/io/IOTestSuite.java | 36 -
.../core/io/JsonStructGraphOutputTest.java | 174 -
.../computer/core/io/MockRankComputation.java | 50 -
.../computer/core/io/OptimizedUnsafeBytesTest.java | 189 -
.../core/io/StreamGraphOutputInputTest.java | 268 --
.../computer/core/io/UnsafeBytesTest.java | 610 ----
.../computer/core/network/ConnectionIdTest.java | 75 -
.../computer/core/network/MockClientHandler.java | 50 -
.../computer/core/network/MockMessageHandler.java | 86 -
.../computer/core/network/MockUnDecodeMessage.java | 47 -
.../computer/core/network/NetworkTestSuite.java | 46 -
.../computer/core/network/TransportUtilTest.java | 126 -
.../core/network/buffer/NetworkBufferTest.java | 154 -
.../network/connection/ConnectionManagerTest.java | 144 -
.../core/network/netty/AbstractNetworkTest.java | 142 -
.../core/network/netty/NettyClientFactoryTest.java | 133 -
.../network/netty/NettyTransportClientTest.java | 332 --
.../network/netty/NettyTransportServerTest.java | 242 --
.../core/network/session/TransportSessionTest.java | 341 --
.../core/receiver/MessageRecvBuffersTest.java | 184 -
.../core/receiver/MessageRecvManagerTest.java | 154 -
.../computer/core/receiver/ReceiverTestSuite.java | 35 -
.../computer/core/receiver/ReceiverUtil.java | 80 -
.../edge/EdgeMessageRecvPartitionTest.java | 277 --
.../vertex/VertexMessageRecvPartitionTest.java | 276 --
.../computer/core/sender/MessageQueueTest.java | 63 -
.../core/sender/MessageSendBuffersTest.java | 63 -
.../core/sender/MessageSendManagerTest.java | 28 -
.../computer/core/sender/MockTransportClient.java | 92 -
.../computer/core/sender/MultiQueueTest.java | 247 --
.../core/sender/QueuedMessageSenderTest.java | 67 -
.../computer/core/sender/QueuedMessageTest.java | 36 -
.../computer/core/sender/SenderTestSuite.java | 35 -
.../computer/core/sender/WriteBufferTest.java | 192 -
.../computer/core/sender/WriteBuffersTest.java | 260 --
.../computer/core/sort/SorterTestUtil.java | 176 -
.../core/sort/combiner/MockIntSumCombiner.java | 29 -
.../core/sort/sorter/EmptyFlusherTest.java | 47 -
.../core/sort/sorter/SortLargeDataTest.java | 331 --
.../computer/core/sort/sorter/SorterTest.java | 489 ---
.../computer/core/sort/sorter/SorterTestSuite.java | 31 -
.../core/sort/sorting/InputsSortingTest.java | 73 -
.../core/sort/sorting/SortingTestSuite.java | 29 -
.../computer/core/sort/sorting/TestData.java | 141 -
.../hugegraph/computer/core/store/BitFileTest.java | 92 -
.../computer/core/store/EntriesUtilTest.java | 113 -
.../computer/core/store/EntryOutputTest.java | 183 -
.../computer/core/store/FileManagerTest.java | 107 -
.../hugegraph/computer/core/store/HgkvDirTest.java | 144 -
.../computer/core/store/StoreTestSuite.java | 35 -
.../computer/core/store/StoreTestUtil.java | 184 -
.../computer/core/store/ValueFileTest.java | 489 ---
.../core/util/ComputerContextUtilTest.java | 72 -
.../hugegraph/computer/core/util/IdUtilTest.java | 56 -
.../hugegraph/computer/core/util/JsonUtilTest.java | 51 -
.../computer/core/util/SerializeUtilTest.java | 53 -
.../computer/core/util/UtilTestSuite.java | 30 -
.../computer/core/worker/MockComputation.java | 405 ---
.../computer/core/worker/MockComputation2.java | 55 -
.../core/worker/MockComputationParams.java | 45 -
.../core/worker/MockMasterComputation.java | 389 --
.../core/worker/MockMasterComputation2.java | 94 -
.../computer/core/worker/MockWorkerService.java | 31 -
.../computer/core/worker/WorkerServiceTest.java | 242 --
.../computer/core/worker/WorkerStatTest.java | 115 -
.../computer/core/worker/WorkerTestSuite.java | 29 -
.../computer/dist/ComputerDistTestSuite.java | 27 -
.../computer/dist/HugeGraphComputerTest.java | 103 -
.../computer/driver/ComputerOptionsTest.java | 88 -
.../hugegraph/computer/driver/DriverTest.java | 85 -
.../hugegraph/computer/driver/DriverTestSuite.java | 29 -
.../hugegraph/computer/k8s/AbstractK8sTest.java | 210 --
.../hugegraph/computer/k8s/K8sTestSuite.java | 30 -
.../computer/k8s/KubernetesDriverTest.java | 309 --
.../suite/integrate/IntegrateTestSuite.java | 57 -
.../suite/integrate/SenderIntegrateTest.java | 456 ---
.../computer/suite/unit/UnitTestBase.java | 306 --
.../computer/suite/unit/UnitTestSuite.java | 69 -
.../src/main/resources/computer.properties | 31 -
.../main/resources/hdfs_input_test/core-site.xml | 23 -
.../src/main/resources/hdfs_input_test/struct.json | 224 --
computer-test/src/main/resources/log4j2.xml | 66 -
computer-yarn/pom.xml | 33 -
computer/README.md | 44 +
.../community/cc/ClusteringCoefficient.java | 0
.../trianglecount/TriangleCountValue.java | 0
.../computer/algorithm/community/wcc/Wcc.java | 0
.../algorithm/path/rings/RingsDetectionParams.java | 0
.../shortest/SingleSourceShortestPathParams.java | 0
.../computer/core/combiner/PropertiesCombiner.java | 0
.../computer/core/common/ComputerContext.java | 0
.../hugegraph/computer/core/graph/id/IdType.java | 0
.../computer/core/graph/value/FloatValue.java | 0
.../computer/core/graph/value/IdListList.java | 0
.../computer/core/worker/Computation.java | 0
.../core/aggregator/WorkerAggrManager.java | 0
.../computer/core/combiner/PointerCombiner.java | 0
.../core/combiner/VertexValueCombiner.java | 0
.../core/common/exception/ReadException.java | 0
.../computer/core/compute/input/EdgesInput.java | 0
.../hugegraph/computer/core/input/InputSplit.java | 0
.../core/input/loader/FileVertxFetcher.java | 0
.../computer/core/network/ClientFactory.java | 0
.../core/network/buffer/FileRegionBuffer.java | 0
.../core/network/session/TransportSession.java | 0
.../hugegraph/computer/core/sender/MultiQueue.java | 0
.../sort/flusher/CombineSubKvOuterSortFlusher.java | 0
.../hugegraph/computer/core/store/FileManager.java | 0
.../computer/core/store/StoreManager.java | 0
.../computer/core/store/entry/EntryInput.java | 2 -
.../computer/core/store/entry/KvEntryReader.java | 2 -
.../core/store/entry/KvEntryWriterImpl.java | 0
.../core/store/file/hgkvfile/HgkvFileImpl.java | 0
.../hugegraph/computer/core/util/ShutdownHook.java | 0
.../release-docs/licenses/LICENSE-annotations.txt | 0
.../release-docs/licenses/LICENSE-asm.txt | 0
.../release-docs/licenses/LICENSE-commons-net.txt | 0
.../licenses/LICENSE-curator-framework.txt | 0
.../release-docs/licenses/LICENSE-grpc-core.txt | 0
.../release-docs/licenses/LICENSE-hadoop-auth.txt | 0
.../licenses/LICENSE-hbase-mapreduce.txt | 0
.../licenses/LICENSE-hbase-procedure.txt | 0
.../licenses/LICENSE-hbase-protocol.txt | 0
.../licenses/LICENSE-jackson-annotations.txt | 0
.../licenses/LICENSE-jackson-databind.txt | 0
.../LICENSE-jersey-container-servlet-core.txt | 0
.../release-docs/licenses/LICENSE-kerby-config.txt | 0
.../licenses/LICENSE-kotlin-stdlib.txt | 0
.../LICENSE-kubernetes-model-apiextensions.txt | 0
.../LICENSE-kubernetes-model-autoscaling.txt | 0
.../licenses/LICENSE-kubernetes-model-metrics.txt | 0
.../release-docs/licenses/LICENSE-metrics-core.txt | 0
.../licenses/LICENSE-opentracing-api.txt | 0
.../release-docs/licenses/LICENSE-sfm-csv.txt | 0
.../licenses/LICENSE-slf4j-log4j12.txt | 0
.../release-docs/licenses/LICENSE-sofa-rpc-all.txt | 0
.../licenses/LICENSE-swagger-models.txt | 0
.../src/assembly/dataset/load-movie-data.groovy | 0
.../src/assembly/travis/install-k8s.sh | 0
.../hugegraph/computer/driver/ComputerDriver.java | 0
.../config/default/manager_auth_proxy_patch.yaml | 0
.../rbac/hugegraphcomputerjob_editor_role.yaml | 0
.../crd-generate/config/webhook/manifests.yaml | 0
.../computer-k8s-operator}/crd-generate/go.sum | 0
.../manifest/hugegraph-computer-crd.v1.yaml | 0
.../k8s/operator/common/OperatorResult.java | 0
{computer-k8s => computer/computer-k8s}/pom.xml | 0
.../computer/k8s/config/KubeSpecOptions.java | 0
.../computer/algorithm/community/lpa/LpaTest.java | 4 +-
.../core/graph/value/BooleanValueTest.java | 0
.../computer/core/graph/value/FloatValueTest.java | 0
.../computer/core/graph/value/ValueTypeTest.java | 0
.../core/io/StructRandomAccessOutputTest.java | 0
.../core/network/DataServerManagerTest.java | 0
.../core/network/netty/HeartbeatHandlerTest.java | 0
.../netty/NettyEncodeDecodeHandlerTest.java | 0
.../message/ComputeMessageRecvPartitionTest.java | 0
.../computer/core/sort/sorter/FlusherTest.java | 0
.../computer/core/store/HgkvFileTest.java | 0
.../hugegraph/computer/core/store/PointerTest.java | 0
.../hugegraph/computer/k8s/MiniKubeTest.java | 0
.../hugegraph/computer/k8s/OperatorTest.java | 0
.../computer/suite/integrate/MockComputation.java | 0
.../src/main/resources/hdfs_input_test/schema.json | 0
pom.xml => computer/pom.xml | 0
931 files changed, 47 insertions(+), 115149 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5cfd38a1..dbca0803 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,6 +22,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
+ path: computer
fetch-depth: 2
- name: Install JDK 8 for HDFS
diff --git a/computer-algorithm/pom.xml b/computer-algorithm/pom.xml
deleted file mode 100644
index f7e60644..00000000
--- a/computer-algorithm/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>hugegraph-computer</artifactId>
- <groupId>org.apache.hugegraph</groupId>
- <version>${revision}</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>computer-algorithm</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.hugegraph</groupId>
- <artifactId>computer-api</artifactId>
- <version>${revision}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mvel</groupId>
- <artifactId>mvel2</artifactId>
- <version>2.4.13.Final</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.4</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>*:*</include>
- </includes>
- </artifactSet>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/*.SF</exclude>
- <exclude>META-INF/*.DSA</exclude>
- <exclude>META-INF/*.RSA</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentrality.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentrality.java
deleted file mode 100644
index 5b5cc2d5..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentrality.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.betweenness;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-public class BetweennessCentrality implements Computation<BetweennessMessage> {
-
- private static final Logger LOG = Log.logger(BetweennessCentrality.class);
-
- public static final String OPTION_SAMPLE_RATE =
- "betweenness_centrality.sample_rate";
-
- private double sampleRate;
- /*
- * Record the number of shortest paths for intermediate vertex, suppose
- * there are two shortest paths from A(source vertex) to E(current vertex),
- * [A -> B -> C -> E] and [A -> B -> D -> E]
- *
- * The saved data is as follows
- * A: B:2
- * C:1
- * D:1
- * totalCount:2
- */
- private Map<Id, SeqCount> seqTable;
-
- @Override
- public String name() {
- return "betweenness_centrality";
- }
-
- @Override
- public String category() {
- return "centrality";
- }
-
- @Override
- public void init(Config config) {
- this.sampleRate = config.getDouble(OPTION_SAMPLE_RATE, 1.0D);
- if (this.sampleRate <= 0.0D || this.sampleRate > 1.0D) {
- throw new ComputerException("The param %s must be in (0.0, 1.0], " +
- "actual got '%s'",
- OPTION_SAMPLE_RATE, this.sampleRate);
- }
- this.seqTable = new HashMap<>();
- }
-
- @Override
- public void close(Config config) {
- // pass
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- // First superstep is special, we just send vertex id to its neighbors
- BetweennessValue initialValue = new BetweennessValue(0.0D);
- initialValue.arrivedVertices().add(vertex.id());
- vertex.value(initialValue);
- if (vertex.numEdges() == 0) {
- return;
- }
-
- IdList sequence = new IdList();
- sequence.add(vertex.id());
- context.sendMessageToAllEdges(vertex, new BetweennessMessage(sequence));
- LOG.info("Finished compute-0 step");
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<BetweennessMessage> messages) {
- BetweennessValue value = vertex.value();
- // The betweenness value to be updated
- DoubleValue betweenness = value.betweenness();
- // Collect the vertices sent here this time
- IdSet arrivingVertices = new IdSet();
- while (messages.hasNext()) {
- BetweennessMessage message = messages.next();
- // The value contributed to the intermediate node on the path
- DoubleValue vote = message.vote();
- betweenness.value(betweenness.value() + vote.value());
-
- this.forward(context, vertex, message.sequence(), arrivingVertices);
- }
- value.arrivedVertices().addAll(arrivingVertices);
-
- boolean active = !this.seqTable.isEmpty();
- if (active) {
- this.sendMessage(context);
- this.seqTable.clear();
- } else {
- vertex.inactivate();
- }
- }
-
- private void forward(ComputationContext context, Vertex vertex,
- IdList sequence, IdSet arrivingVertices) {
- if (sequence.size() == 0) {
- return;
- }
-
- BetweennessValue value = vertex.value();
- IdSet arrivedVertices = value.arrivedVertices();
- Id source = sequence.getFirst();
- // The source vertex is arriving at first time
- if (!arrivedVertices.contains(source)) {
- arrivingVertices.add(source);
-
- SeqCount seqCount = this.seqTable.computeIfAbsent(
- source, k -> new SeqCount());
- seqCount.totalCount++;
- // Accumulate the number of shortest paths for intermediate vertices
- for (int i = 1; i < sequence.size(); i++) {
- Id id = sequence.get(i);
- Map<Id, Integer> idCounts = seqCount.idCount;
- idCounts.put(id, idCounts.getOrDefault(id, 0) + 1);
- }
-
- Id selfId = vertex.id();
- sequence.add(selfId);
- BetweennessMessage newMessage = new BetweennessMessage(sequence);
- for (Edge edge : vertex.edges()) {
- Id targetId = edge.targetId();
- if (this.sample(selfId, targetId, edge) &&
- !sequence.contains(targetId)) {
- context.sendMessage(targetId, newMessage);
- }
- }
- }
- }
-
- private void sendMessage(ComputationContext context) {
- for (SeqCount seqCount : this.seqTable.values()) {
- for (Map.Entry<Id, Integer> entry : seqCount.idCount.entrySet()) {
- double vote = (double) entry.getValue() / seqCount.totalCount;
- BetweennessMessage voteMessage = new BetweennessMessage(
- new DoubleValue(vote));
-
- context.sendMessage(entry.getKey(), voteMessage);
- }
- }
- }
-
- private boolean sample(Id sourceId, Id targetId, Edge edge) {
- // Now just use the simplest way
- return Math.random() <= this.sampleRate;
- }
-
- private static class SeqCount {
-
- private final Map<Id, Integer> idCount;
- private int totalCount;
-
- public SeqCount() {
- this.idCount = new HashMap<>();
- this.totalCount = 0;
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentralityParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentralityParams.java
deleted file mode 100644
index 55e63996..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessCentralityParams.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.betweenness;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.algorithm.centrality.closeness.ClosenessCentrality;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.master.DefaultMasterComputation;
-
-public class BetweennessCentralityParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.MASTER_COMPUTATION_CLASS,
- DefaultMasterComputation.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- BetweennessCentrality.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- BetweennessValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- BetweennessMessage.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_DOUBLE_OUTPUT_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.INPUT_FILTER_CLASS,
- EXTRACTALLPROPERTYINPUTFILTER_CLASS_NAME);
- this.setIfAbsent(params, ClosenessCentrality.OPTION_SAMPLE_RATE,
- "0.5D");
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessMessage.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessMessage.java
deleted file mode 100644
index 1522f355..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessMessage.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.betweenness;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.value.Value.CustomizeValue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class BetweennessMessage implements CustomizeValue<BetweennessMessage> {
-
- private final IdList sequence;
- private final DoubleValue vote;
-
- public BetweennessMessage() {
- this.sequence = new IdList();
- this.vote = new DoubleValue(0.0D);
- }
-
- public BetweennessMessage(IdList sequence) {
- this.sequence = sequence;
- this.vote = new DoubleValue();
- }
-
- public BetweennessMessage(DoubleValue betweenness) {
- this.sequence = new IdList();
- this.vote = betweenness;
- }
-
- public IdList sequence() {
- return this.sequence;
- }
-
- public DoubleValue vote() {
- return this.vote;
- }
-
- @Override
- public BetweennessMessage value() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.sequence.read(in);
- this.vote.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.sequence.write(out);
- this.vote.write(out);
- }
-
- @Override
- public int compareTo(Value value) {
- E.checkArgument(value instanceof BetweennessMessage,
- "The BetweennessMessage can't compare with class '%s'",
- value.getClass());
- BetweennessMessage other = (BetweennessMessage) value;
- E.checkArgument(this.sequence.size() != 0, "Sequence can't be empty");
- E.checkArgument(other.sequence.size() != 0, "Sequence can't be empty");
- Id selfSourceId = this.sequence.getFirst();
- Id otherSourceId = other.sequence.getFirst();
- return selfSourceId.compareTo(otherSourceId);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessValue.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessValue.java
deleted file mode 100644
index 06e8db38..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/betweenness/BetweennessValue.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.betweenness;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-import org.apache.hugegraph.computer.core.graph.value.Value.CustomizeValue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class BetweennessValue implements CustomizeValue<Double> {
-
- private final DoubleValue betweenness;
- private final IdSet arrivedVertices;
-
- public BetweennessValue() {
- this(0.0D);
- }
-
- public BetweennessValue(double betweenness) {
- this.betweenness = new DoubleValue(betweenness);
- this.arrivedVertices = new IdSet();
- }
-
- public DoubleValue betweenness() {
- return this.betweenness;
- }
-
- public IdSet arrivedVertices() {
- return this.arrivedVertices;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.betweenness.read(in);
- this.arrivedVertices.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.betweenness.write(out);
- this.arrivedVertices.write(out);
- }
-
- @Override
- public Double value() {
- return this.betweenness.value();
- }
-
- @Override
- public String string() {
- return this.value().toString();
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentrality.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentrality.java
deleted file mode 100644
index c4ed974e..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentrality.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.closeness;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.util.Log;
-import org.apache.hugegraph.util.NumericUtil;
-import org.slf4j.Logger;
-
-public class ClosenessCentrality implements Computation<ClosenessMessage> {
-
- private static final Logger LOG = Log.logger(ClosenessCentrality.class);
-
- public static final String OPTION_WEIGHT_PROPERTY =
- "closeness_centrality.weight_property";
- public static final String OPTION_SAMPLE_RATE =
- "closeness_centrality.sample_rate";
-
- private String weightProp;
- private double sampleRate;
-
- @Override
- public String name() {
- return "closeness_centrality";
- }
-
- @Override
- public String category() {
- return "centrality";
- }
-
- @Override
- public void init(Config config) {
- this.weightProp = config.getString(OPTION_WEIGHT_PROPERTY, "");
- this.sampleRate = config.getDouble(OPTION_SAMPLE_RATE, 1.0D);
- if (this.sampleRate <= 0.0D || this.sampleRate > 1.0D) {
- throw new ComputerException("The param %s must be in (0.0, 1.0], " +
- "actual got '%s'",
- OPTION_SAMPLE_RATE, this.sampleRate);
- }
- }
-
- @Override
- public void close(Config config) {
- // pass
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- // Set empty map as initial value
- vertex.value(new ClosenessValue());
-
- // Send messages to adjacent edges
- for (Edge edge : vertex.edges()) {
- Id senderId = vertex.id();
- // Get property value
- double value = this.weightValue(edge.property(this.weightProp));
- DoubleValue distance = new DoubleValue(value);
- ClosenessMessage message = new ClosenessMessage(senderId, senderId,
- distance);
- context.sendMessage(edge.targetId(), message);
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<ClosenessMessage> messages) {
- Id selfId = vertex.id();
- // Save the distance from other vertices to self
- ClosenessValue localValue = vertex.value();
- boolean active = false;
- while (messages.hasNext()) {
- active = true;
- ClosenessMessage message = messages.next();
- Id senderId = message.senderId();
- // In theory, it won't happen, defensive programming
- if (selfId.equals(senderId)) {
- continue;
- }
- Id startId = message.startId();
- if (selfId.equals(startId)) {
- continue;
- }
-
- DoubleValue oldValue = localValue.get(startId);
- DoubleValue newValue = message.distance();
- // If the id already exists and the new value >= old value, skip it
- if (oldValue != null && newValue.compareTo(oldValue) >= 0) {
- continue;
- }
- // Update local saved values (take smaller value)
- localValue.put(startId, newValue);
- // Send this smaller value to neighbors
- this.sendMessage(context, vertex, senderId, startId, newValue);
- }
- if (!active) {
- vertex.inactivate();
- }
- }
-
- private void sendMessage(ComputationContext context, Vertex vertex,
- Id senderId, Id startId, DoubleValue newValue) {
- Id selfId = vertex.id();
- double baseNewValue = this.weightValue(newValue);
- for (Edge edge : vertex.edges()) {
- Id targetId = edge.targetId();
- if (senderId.equals(targetId) || startId.equals(targetId)) {
- continue;
- }
- if (!sample(selfId, targetId, edge)) {
- continue;
- }
- // Update distance information
- double updatedValue = baseNewValue + this.weightValue(edge.property(
- this.weightProp));
- DoubleValue newDistance = new DoubleValue(updatedValue);
- ClosenessMessage message = new ClosenessMessage(selfId, startId,
- newDistance);
- context.sendMessage(targetId, message);
- }
- }
-
- private boolean sample(Id sourceId, Id targetId, Edge edge) {
- // Now just use the simplest way
- return Math.random() <= this.sampleRate;
- }
-
- private double weightValue(Value rawValue) {
- if (rawValue == null) {
- return 1.0D;
- }
- if (rawValue.isNumber()) {
- return NumericUtil.convertToNumber(rawValue).doubleValue();
- } else {
- throw new ComputerException("The weight property can only be " +
- "either Long or Int or Double or " +
- "Float, but got %s",
- rawValue.valueType());
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentralityParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentralityParams.java
deleted file mode 100644
index abc74c54..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessCentralityParams.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.closeness;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.master.DefaultMasterComputation;
-
-public class ClosenessCentralityParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.MASTER_COMPUTATION_CLASS,
- DefaultMasterComputation.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- ClosenessCentrality.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- ClosenessValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- ClosenessMessage.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_DOUBLE_OUTPUT_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.INPUT_FILTER_CLASS,
- EXTRACTALLPROPERTYINPUTFILTER_CLASS_NAME);
- this.setIfAbsent(params, ClosenessCentrality.OPTION_SAMPLE_RATE,
- "0.5D");
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessMessage.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessMessage.java
deleted file mode 100644
index 925b3683..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessMessage.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.closeness;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.id.IdFactory;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.Value.CustomizeValue;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class ClosenessMessage implements CustomizeValue<ClosenessMessage> {
-
- private final GraphFactory graphFactory;
-
- private Id senderId;
- private Id startId;
- private DoubleValue distance;
-
- public ClosenessMessage() {
- this(IdFactory.createId(), IdFactory.createId(), new DoubleValue(0.0D));
- }
-
- public ClosenessMessage(Id senderId, Id startId, DoubleValue distance) {
- this.graphFactory = ComputerContext.instance().graphFactory();
- this.senderId = senderId;
- this.startId = startId;
- this.distance = distance;
- }
-
- public Id senderId() {
- return this.senderId;
- }
-
- public Id startId() {
- return this.startId;
- }
-
- public DoubleValue distance() {
- return this.distance;
- }
-
- @Override
- public ClosenessMessage value() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.senderId = this.graphFactory.createId();
- this.senderId.read(in);
-
- this.startId = this.graphFactory.createId();
- this.startId.read(in);
-
- this.distance = (DoubleValue) this.graphFactory.createValue(
- ValueType.DOUBLE);
- this.distance.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.senderId.write(out);
- this.startId.write(out);
- this.distance.write(out);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessValue.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessValue.java
deleted file mode 100644
index 9c126755..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/closeness/ClosenessValue.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.closeness;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.MapValue;
-
-public class ClosenessValue extends MapValue<DoubleValue> {
-
- @Override
- public Double value() {
- // Cumulative distance
- double centrality = 0;
- for (Map.Entry<Id, DoubleValue> entry : this.entrySet()) {
- centrality += 1.0D / entry.getValue().value();
- }
- return centrality;
- }
-
- @Override
- public String string() {
- return this.value().toString();
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentrality.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentrality.java
deleted file mode 100644
index a4649e06..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentrality.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.degree;
-
-import java.util.Iterator;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.NullValue;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.computer.core.worker.WorkerContext;
-import org.apache.hugegraph.util.NumericUtil;
-
-public class DegreeCentrality implements Computation<NullValue> {
-
- public static final String OPTION_WEIGHT_PROPERTY = "degree_centrality.weight_property";
-
- private boolean calculateByWeightProperty;
- private String weightProperty;
-
- @Override
- public String name() {
- return "degree_centrality";
- }
-
- @Override
- public String category() {
- return "centrality";
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- if (!this.calculateByWeightProperty) {
- vertex.value(new DoubleValue(vertex.numEdges()));
- } else {
- /*
- * TODO: Here we use doubleValue type now, we will use BigDecimal
- * and output "BigDecimalValue" to resolve double type overflow
- * int the future;
- */
- double totalWeight = 0.0;
- for (Edge edge : vertex.edges()) {
- double weight = weightValue(edge.property(this.weightProperty));
- totalWeight += weight;
- if (Double.isInfinite(totalWeight)) {
- throw new ComputerException("Calculate weight overflow, " +
- "current is %s, edge '%s' " +
- "is %s", totalWeight, edge, weight);
- }
- }
- vertex.value(new DoubleValue(totalWeight));
- }
- vertex.inactivate();
- }
-
- private static double weightValue(Value value) {
- if (value == null) {
- return 1.0;
- }
-
- switch (value.valueType()) {
- case LONG:
- case INT:
- case DOUBLE:
- case FLOAT:
- return NumericUtil.convertToNumber(value).doubleValue();
- default:
- throw new ComputerException("The weight property can only be " +
- "either Long or Int or Double or " +
- "Float, but got %s",
- value.valueType());
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<NullValue> messages) {
- // pass
- }
-
- @Override
- public void init(Config config) {
- this.weightProperty = config.getString(
- OPTION_WEIGHT_PROPERTY, "");
- this.calculateByWeightProperty = StringUtils.isNotEmpty(
- this.weightProperty);
- }
-
- @Override
- public void close(Config config) {
- // pass
- }
-
- @Override
- public void beforeSuperstep(WorkerContext context) {
- // pass
- }
-
- @Override
- public void afterSuperstep(WorkerContext context) {
- // pass
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentralityParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentralityParams.java
deleted file mode 100644
index 23a09b4f..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/degree/DegreeCentralityParams.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.degree;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.combiner.DoubleValueSumCombiner;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.master.DefaultMasterComputation;
-
-public class DegreeCentralityParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.MASTER_COMPUTATION_CLASS,
- DefaultMasterComputation.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- DegreeCentrality.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- DoubleValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- DoubleValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMBINER_CLASS,
- DoubleValueSumCombiner.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_DOUBLE_OUTPUT_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank.java
deleted file mode 100644
index 1141649c..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.pagerank;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.aggregator.Aggregator;
-import org.apache.hugegraph.computer.core.combiner.Combiner;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.LongValue;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.computer.core.worker.WorkerContext;
-
-public class PageRank implements Computation<DoubleValue> {
-
- public static final String OPTION_ALPHA = "page_rank.alpha";
-
- public static final double ALPHA_DEFAULT_VALUE = 0.15;
-
- private double alpha;
- private double danglingRank;
- private double initialRankInSuperstep;
- private double cumulativeRank;
-
- private Aggregator<DoubleValue> l1DiffAggr;
- private Aggregator<DoubleValue> cumulativeRankAggr;
- private Aggregator<LongValue> danglingVertexNumAggr;
- private Aggregator<DoubleValue> danglingCumulativeAggr;
-
- // Initial value in superstep 0.
- private DoubleValue initialValue;
- private DoubleValue contribValue;
-
- @Override
- public String name() {
- return "page_rank";
- }
-
- @Override
- public String category() {
- return "centrality";
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- vertex.value(this.initialValue);
- this.cumulativeRankAggr.aggregateValue(this.initialValue.value());
- int edgeCount = vertex.numEdges();
- if (edgeCount == 0) {
- this.danglingVertexNumAggr.aggregateValue(1L);
- this.danglingCumulativeAggr.aggregateValue(
- this.initialValue.value());
- } else {
- this.contribValue.value(this.initialValue.value() / edgeCount);
- context.sendMessageToAllEdges(vertex, this.contribValue);
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<DoubleValue> messages) {
- DoubleValue message = Combiner.combineAll(context.combiner(), messages);
- double rankFromNeighbors = 0.0;
- if (message != null) {
- rankFromNeighbors = message.value();
- }
- double rank = (this.danglingRank + rankFromNeighbors) *
- (1.0 - this.alpha) + this.initialRankInSuperstep;
- rank /= this.cumulativeRank;
- DoubleValue oldRank = vertex.value();
- vertex.value(new DoubleValue(rank));
- this.l1DiffAggr.aggregateValue(Math.abs(oldRank.value() - rank));
- this.cumulativeRankAggr.aggregateValue(rank);
- int edgeCount = vertex.numEdges();
- if (edgeCount == 0) {
- this.danglingVertexNumAggr.aggregateValue(1L);
- this.danglingCumulativeAggr.aggregateValue(rank);
- } else {
- this.contribValue.value(rank / edgeCount);
- context.sendMessageToAllEdges(vertex, this.contribValue);
- }
- }
-
- @Override
- public void init(Config config) {
- this.alpha = config.getDouble(OPTION_ALPHA, ALPHA_DEFAULT_VALUE);
- this.contribValue = new DoubleValue();
- }
-
- @Override
- public void close(Config config) {
- // pass
- }
-
- @Override
- public void beforeSuperstep(WorkerContext context) {
- // Get aggregator values for computation
- DoubleValue danglingTotalRank = context.aggregatedValue(
- PageRank4Master.AGGR_COMULATIVE_DANGLING_PROBABILITY);
- DoubleValue cumulativeRank = context.aggregatedValue(
- PageRank4Master.AGGR_COMULATIVE_PROBABILITY);
- long totalVertex = context.totalVertexCount();
-
- this.danglingRank = danglingTotalRank.value() / totalVertex;
- this.initialRankInSuperstep = this.alpha / totalVertex;
- this.cumulativeRank = cumulativeRank.value();
- this.initialValue = new DoubleValue(1.0 / totalVertex);
-
- // Create aggregators
- this.l1DiffAggr = context.createAggregator(
- PageRank4Master.AGGR_L1_NORM_DIFFERENCE_KEY);
- this.cumulativeRankAggr = context.createAggregator(
- PageRank4Master.AGGR_COMULATIVE_PROBABILITY);
- this.danglingVertexNumAggr = context.createAggregator(
- PageRank4Master.AGGR_DANGLING_VERTICES_NUM);
- this.danglingCumulativeAggr = context.createAggregator(
- PageRank4Master.AGGR_COMULATIVE_DANGLING_PROBABILITY);
- }
-
- @Override
- public void afterSuperstep(WorkerContext context) {
- context.aggregateValue(
- PageRank4Master.AGGR_COMULATIVE_PROBABILITY,
- this.cumulativeRankAggr.aggregatedValue());
- context.aggregateValue(
- PageRank4Master.AGGR_L1_NORM_DIFFERENCE_KEY,
- this.l1DiffAggr.aggregatedValue());
- context.aggregateValue(
- PageRank4Master.AGGR_DANGLING_VERTICES_NUM,
- this.danglingVertexNumAggr.aggregatedValue());
- context.aggregateValue(
- PageRank4Master.AGGR_COMULATIVE_DANGLING_PROBABILITY,
- this.danglingCumulativeAggr.aggregatedValue());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank4Master.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank4Master.java
deleted file mode 100644
index 14a57eab..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRank4Master.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.pagerank;
-
-import org.apache.hugegraph.computer.core.combiner.DoubleValueSumCombiner;
-import org.apache.hugegraph.computer.core.combiner.LongValueSumCombiner;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.LongValue;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-import org.apache.hugegraph.computer.core.master.MasterComputation;
-import org.apache.hugegraph.computer.core.master.MasterComputationContext;
-import org.apache.hugegraph.computer.core.master.MasterContext;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-public class PageRank4Master implements MasterComputation {
-
- private static final Logger LOG = Log.logger(PageRank4Master.class);
-
- public static final String CONF_L1_NORM_DIFFERENCE_THRESHOLD_KEY =
- "pagerank.l1DiffThreshold";
- public static final double CONF_L1_DIFF_THRESHOLD_DEFAULT = 0.00001D;
-
- public static final String AGGR_L1_NORM_DIFFERENCE_KEY =
- "pagerank.aggr_l1_norm_difference";
- public static final String AGGR_DANGLING_VERTICES_NUM =
- "pagerank.dangling_vertices_num";
- public static final String AGGR_COMULATIVE_DANGLING_PROBABILITY =
- "pagerank.comulative_dangling_probability";
- public static final String AGGR_COMULATIVE_PROBABILITY =
- "pagerank.comulative_probability";
-
- private double l1DiffThreshold;
-
- @Override
- public void init(MasterContext context) {
- this.l1DiffThreshold = context.config().getDouble(
- CONF_L1_NORM_DIFFERENCE_THRESHOLD_KEY,
- CONF_L1_DIFF_THRESHOLD_DEFAULT);
- context.registerAggregator(AGGR_DANGLING_VERTICES_NUM,
- ValueType.LONG,
- LongValueSumCombiner.class);
- context.registerAggregator(AGGR_COMULATIVE_DANGLING_PROBABILITY,
- ValueType.DOUBLE,
- DoubleValueSumCombiner.class);
- context.registerAggregator(AGGR_COMULATIVE_PROBABILITY,
- ValueType.DOUBLE,
- DoubleValueSumCombiner.class);
- context.registerAggregator(AGGR_L1_NORM_DIFFERENCE_KEY,
- ValueType.DOUBLE,
- DoubleValueSumCombiner.class);
- }
-
- @Override
- public void close(MasterContext context) {
- // pass
- }
-
- @Override
- public boolean compute(MasterComputationContext context) {
- LongValue danglingVerticesNum = context.aggregatedValue(
- AGGR_DANGLING_VERTICES_NUM);
- DoubleValue danglingProbability = context.aggregatedValue(
- AGGR_COMULATIVE_DANGLING_PROBABILITY);
- DoubleValue cumulativeProbability = context.aggregatedValue(
- AGGR_COMULATIVE_PROBABILITY);
- DoubleValue l1NormDifference = context.aggregatedValue(
- AGGR_L1_NORM_DIFFERENCE_KEY);
-
- StringBuilder sb = new StringBuilder();
- sb.append("[Superstep ").append(context.superstep()).append("]")
- .append(", dangling vertices num = ").append(danglingVerticesNum)
- .append(", cumulative dangling probability = ")
- .append(danglingProbability.value())
- .append(", cumulative probability = ").append(cumulativeProbability)
- .append(", l1 norm difference = ").append(l1NormDifference.value());
-
- LOG.info("PageRank running status: {}", sb);
- double l1Diff = l1NormDifference.value();
- if (context.superstep() > 1 && l1Diff <= this.l1DiffThreshold) {
- return false;
- } else {
- return true;
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRankParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRankParams.java
deleted file mode 100644
index d308051f..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/centrality/pagerank/PageRankParams.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.centrality.pagerank;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.combiner.DoubleValueSumCombiner;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-
-public class PageRankParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.MASTER_COMPUTATION_CLASS,
- PageRank4Master.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- PageRank.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- DoubleValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- DoubleValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.WORKER_COMBINER_CLASS,
- DoubleValueSumCombiner.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_DOUBLE_OUTPUT_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientOutput.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientOutput.java
deleted file mode 100644
index 40a11de3..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientOutput.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.cc;
-
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.output.hg.HugeGraphOutput;
-import org.apache.hugegraph.structure.constant.WriteType;
-
-/**
- * Offer 2 ways to output: write-back + hdfs-file(TODO)
- */
-public class ClusteringCoefficientOutput extends HugeGraphOutput<Float> {
-
- @Override
- public String name() {
- return "clustering_coefficient";
- }
-
- @Override
- public void prepareSchema() {
- this.client().schema().propertyKey(this.name())
- .asFloat()
- .writeType(WriteType.OLAP_RANGE)
- .ifNotExist()
- .create();
- }
-
- @Override
- protected org.apache.hugegraph.structure.graph.Vertex constructHugeVertex(Vertex vertex) {
- org.apache.hugegraph.structure.graph.Vertex hugeVertex =
- new org.apache.hugegraph.structure.graph.Vertex(null);
- hugeVertex.id(vertex.id().asObject());
- float triangle = ((ClusteringCoefficientValue) vertex.value()).count();
- int degree = ((ClusteringCoefficientValue) vertex.value()).idSet().value().size();
- hugeVertex.property(this.name(), 2 * triangle / degree / (degree - 1));
- return hugeVertex;
- }
-
- /* TODO: enhance it
- @Override
- protected Float value(Vertex vertex) {
- float triangle = ((ClusteringCoefficientValue) vertex.value()).count();
- int degree = ((ClusteringCoefficientValue) vertex.value()).idList().size();
- return 2 * triangle / degree / (degree - 1);
- }*/
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientParams.java
deleted file mode 100644
index ed3b09fa..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientParams.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.cc;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.config.EdgeFrequency;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-
-public class ClusteringCoefficientParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- ClusteringCoefficient.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- IdList.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- ClusteringCoefficientValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- ClusteringCoefficientOutput.class.getName());
- this.setIfAbsent(params, ComputerOptions.INPUT_EDGE_FREQ.name(),
- EdgeFrequency.SINGLE.name());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientValue.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientValue.java
deleted file mode 100644
index 056093d3..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/cc/ClusteringCoefficientValue.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.cc;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-import org.apache.hugegraph.computer.core.graph.value.IntValue;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-/**
- * TODO: We could reuse triangle's result to simplify it (and avoid logical differences)
- */
-public class ClusteringCoefficientValue implements Value.CustomizeValue<Integer> {
-
- private IdSet idSet;
- private IntValue count;
- private final IntValue degree;
-
- public ClusteringCoefficientValue() {
- this.idSet = new IdSet();
- this.count = new IntValue();
- this.degree = new IntValue();
- }
-
- public IdSet idSet() {
- return this.idSet;
- }
-
- public int count() {
- return this.count.intValue();
- }
-
- public void count(Integer count) {
- this.count.value(count);
- }
-
- public int degree() {
- return this.degree.value();
- }
-
- public void degree(Integer degree) {
- this.degree.value(degree);
- }
-
- @Override
- public ClusteringCoefficientValue copy() {
- ClusteringCoefficientValue ccValue = new ClusteringCoefficientValue();
- ccValue.idSet = this.idSet.copy();
- ccValue.count = this.count.copy();
- return ccValue;
- }
-
- @Override
- public Integer value() {
- return this.count.value();
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.idSet.read(in);
- this.count.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.idSet.write(out);
- this.count.write(out);
- }
-
- @Override
- public String toString() {
- return String.valueOf(count);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/Kcore.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/Kcore.java
deleted file mode 100644
index eeffe832..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/Kcore.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.kcore;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.combiner.Combiner;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-
-import com.google.common.collect.Iterators;
-
-public class Kcore implements Computation<Id> {
-
- public static final String OPTION_K = "kcore.k";
- public static final int K_DEFAULT_VALUE = 3;
-
- private final KcoreValue initValue = new KcoreValue();
-
- private int k = 0;
-
- @Override
- public String name() {
- return "kcore";
- }
-
- @Override
- public String category() {
- return "community";
- }
-
- @Override
- public void init(Config config) {
- this.k = config.getInt(OPTION_K, K_DEFAULT_VALUE);
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- KcoreValue value = this.initValue;
- value.core((Id) vertex.id().copy());
- vertex.value(value);
-
- if (vertex.numEdges() < this.k) {
- value.degree(0);
- /*
- * TODO: send int type message at phase 1, it's different from id
- * type of phase 2 (wcc message), need support switch message type.
- */
- context.sendMessageToAllEdges(vertex, vertex.id());
- vertex.inactivate();
- } else {
- value.degree(vertex.numEdges());
- assert vertex.active();
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<Id> messages) {
- KcoreValue value = vertex.value();
- if (!value.active()) {
- // Ignore messages of deleted vertex
- vertex.inactivate();
- return;
- }
-
- int superstep = context.superstep();
- if (superstep <= 2) {
- int deleted = Iterators.size(messages);
- assert value.active();
- if (value.decreaseDegree(deleted) < this.k) {
- // From active to inactive, delete self vertex
- value.degree(0);
- if (superstep == 1) {
- context.sendMessageToAllEdges(vertex, vertex.id());
- }
- vertex.inactivate();
- } else {
- // From active to active, do wcc from superstep 2
- if (superstep == 2) {
- // Start wcc
- context.sendMessageToAllEdgesIf(vertex, vertex.id(),
- (source, target) -> {
- return source.compareTo(target) < 0;
- });
- vertex.inactivate();
- } else {
- // Keep active at superstep 1 to continue superstep 2
- assert superstep == 1;
- assert vertex.active();
- }
- }
- } else {
- // Do wcc
- assert superstep > 2;
- Id message = Combiner.combineAll(context.combiner(), messages);
- if (value.core().compareTo(message) > 0) {
- value.core(message);
- context.sendMessageToAllEdges(vertex, message);
- }
- vertex.inactivate();
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreParams.java
deleted file mode 100644
index fa4c532b..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreParams.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.kcore;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.combiner.ValueMinCombiner;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-
-public class KcoreParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- Kcore.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- KcoreValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- BYTESID_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.WORKER_COMBINER_CLASS,
- ValueMinCombiner.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_ID_OUTPUT_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreValue.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreValue.java
deleted file mode 100644
index d00cbe6c..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/kcore/KcoreValue.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.kcore;
-
-import java.io.IOException;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.id.IdFactory;
-import org.apache.hugegraph.computer.core.graph.value.Value.CustomizeValue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class KcoreValue implements CustomizeValue<Object> {
-
- private int degree;
- private Id core;
-
- public KcoreValue() {
- this.degree = 0;
- this.core = IdFactory.createId();
- }
-
- public void degree(int degree) {
- assert degree >= 0;
- this.degree = degree;
- }
-
- public int degree() {
- return this.degree;
- }
-
- public int decreaseDegree(int decrease) {
- assert decrease <= this.degree;
- this.degree -= decrease;
- return this.degree;
- }
-
- public boolean active() {
- return this.degree > 0;
- }
-
- public void core(Id core) {
- this.core = core;
- }
-
- public Id core() {
- E.checkNotNull(this.core, "core");
- return this.core;
- }
-
- @Override
- public KcoreValue copy() {
- KcoreValue kcoreValue = new KcoreValue();
- kcoreValue.core = (Id) this.core.copy();
- kcoreValue.degree = this.degree;
- return kcoreValue;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.core.read(in);
- this.degree = in.readInt();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.core.write(out);
- out.writeInt(this.degree);
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .append("core", this.core)
- .append("degree", this.degree)
- .toString();
- }
-
- @Override
- public Object value() {
- return this.core.value();
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/Lpa.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/Lpa.java
deleted file mode 100644
index 1bb34413..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/Lpa.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.lpa;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import org.apache.commons.lang3.mutable.MutableInt;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-
-public class Lpa implements Computation<Id> {
-
- private final Random random = new Random();
-
- @Override
- public String name() {
- return "lpa";
- }
-
- @Override
- public String category() {
- return "community";
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- Id value = vertex.id();
- vertex.value(value);
- vertex.inactivate();
- context.sendMessageToAllEdges(vertex, value);
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<Id> messages) {
- Id label = this.voteLabel(messages);
- Id value = vertex.value();
- if (!value.equals(label)) {
- vertex.value(label);
- context.sendMessageToAllEdges(vertex, label);
- }
- vertex.inactivate();
- }
-
- private Id voteLabel(Iterator<Id> messages) {
- // Calculate label frequency
- Map<Id, MutableInt> labels = new HashMap<>();
- assert messages.hasNext();
- while (messages.hasNext()) {
- Id label = messages.next();
- MutableInt labelCount = labels.get(label);
- if (labelCount != null) {
- labelCount.increment();
- } else {
- labels.put(label, new MutableInt(1));
- }
- }
-
- // Calculate the labels with maximum frequency
- List<Id> maxLabels = new ArrayList<>();
- int maxFreq = 1;
- for (Map.Entry<Id, MutableInt> e : labels.entrySet()) {
- int value = e.getValue().intValue();
- if (value > maxFreq) {
- maxFreq = value;
- maxLabels.clear();
- }
- if (value == maxFreq) {
- maxLabels.add(e.getKey());
- }
- }
-
- // Random choice
- int selected = this.random.nextInt(maxLabels.size());
- return maxLabels.get(selected);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/LpaParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/LpaParams.java
deleted file mode 100644
index f5700a74..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/lpa/LpaParams.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.lpa;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-
-public class LpaParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- Lpa.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- BYTESID_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- BYTESID_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_ID_OUTPUT_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCount.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCount.java
deleted file mode 100644
index 89aa9b84..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCount.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.trianglecount;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.edge.Edges;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-
-public class TriangleCount implements Computation<IdList> {
-
- @Override
- public String name() {
- return "triangle_count";
- }
-
- @Override
- public String category() {
- return "community";
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- IdSet selfId = new IdSet();
- selfId.add(vertex.id());
-
- context.sendMessageToAllEdgesIf(vertex, selfId, (ids, targetId) -> {
- return !vertex.id().equals(targetId);
- });
- vertex.value(new TriangleCountValue());
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<IdList> messages) {
- IdSet neighbors = ((TriangleCountValue) vertex.value()).idSet();
- Integer count = this.triangleCount(context, vertex, messages, neighbors);
- if (count != null) {
- ((TriangleCountValue) vertex.value()).count(count);
- vertex.inactivate();
- }
- }
-
- protected Integer triangleCount(ComputationContext context, Vertex vertex,
- Iterator<IdList> messages, IdSet neighbors) {
- if (context.superstep() == 1) {
- // Collect outgoing neighbors
- Set<Id> outNeighbors = getOutNeighbors(vertex);
- neighbors.addAll(outNeighbors);
-
- // Collect incoming neighbors
- while (messages.hasNext()) {
- IdList idList = messages.next();
- assert idList.size() == 1;
- Id inId = idList.getFirst();
- if (!outNeighbors.contains(inId)) {
- neighbors.add(inId);
- }
- }
-
- // Send all neighbors to neighbors
- for (Id targetId : neighbors.value()) {
- context.sendMessage(targetId, neighbors);
- }
- } else if (context.superstep() == 2) {
- int count = 0;
-
- while (messages.hasNext()) {
- IdList twoDegreeNeighbors = messages.next();
- for (Id twoDegreeNeighbor : twoDegreeNeighbors.values()) {
- if (neighbors.contains(twoDegreeNeighbor)) {
- count++;
- }
- }
- }
-
- return count >> 1;
- }
- return null;
- }
-
- private static Set<Id> getOutNeighbors(Vertex vertex) {
- Set<Id> outNeighbors = new HashSet<>();
- Edges edges = vertex.edges();
- for (Edge edge : edges) {
- Id targetId = edge.targetId();
- if (!vertex.id().equals(targetId)) {
- outNeighbors.add(targetId);
- }
- }
- return outNeighbors;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCountParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCountParams.java
deleted file mode 100644
index 93ed3c27..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/trianglecount/TriangleCountParams.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.trianglecount;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.config.EdgeFrequency;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-
-public class TriangleCountParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- TriangleCount.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- IdList.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- TriangleCountValue.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_INT_OUTPUT_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.INPUT_EDGE_FREQ.name(),
- EdgeFrequency.SINGLE.name());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/wcc/WccParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/wcc/WccParams.java
deleted file mode 100644
index b01c32e4..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/community/wcc/WccParams.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.community.wcc;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.combiner.ValueMinCombiner;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-
-public class WccParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- Wcc.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- BYTESID_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- BYTESID_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.WORKER_COMBINER_CLASS,
- ValueMinCombiner.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- HUGEGRAPH_ID_OUTPUT_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java
deleted file mode 100644
index ba5cbc74..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-
-public class RingsDetection implements Computation<IdList> {
-
- @Override
- public String name() {
- return "rings";
- }
-
- @Override
- public String category() {
- return "path";
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- vertex.value(new IdListList());
- if (vertex.edges().size() == 0) {
- return;
- }
-
- // Init path
- Id id = vertex.id();
- IdList path = new IdList();
- path.add(id);
-
- for (Edge edge : vertex.edges()) {
- /*
- * Only send path to vertex whose id is larger than
- * or equals current vertex id
- */
- if (id.compareTo(edge.targetId()) <= 0) {
- context.sendMessage(edge.targetId(), path);
- }
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<IdList> messages) {
- Id id = vertex.id();
- boolean halt = true;
- while (messages.hasNext()) {
- halt = false;
- IdList sequence = messages.next();
- if (id.equals(sequence.getFirst())) {
- // Use the smallest vertex record ring
- boolean isMin = true;
- for (int i = 1; i < sequence.size(); i++) {
- Id pathVertexValue = sequence.get(i);
- if (id.compareTo(pathVertexValue) > 0) {
- isMin = false;
- break;
- }
- }
- if (isMin) {
- sequence.add(id);
- IdListList sequences = vertex.value();
- sequences.add(sequence.copy());
- }
- } else {
- boolean contains = false;
- // Drop sequence if path contains this vertex
- for (int i = 0; i < sequence.size(); i++) {
- Id pathVertexValue = sequence.get(i);
- if (pathVertexValue.equals(vertex.id())) {
- contains = true;
- break;
- }
- }
- // Field ringId is smallest vertex id in path
- Id ringId = sequence.getFirst();
- if (!contains) {
- sequence.add(vertex.id());
- for (Edge edge : vertex.edges()) {
- if (ringId.compareTo(edge.targetId()) <= 0) {
- context.sendMessage(edge.targetId(), sequence);
- }
- }
- }
- }
- }
- if (halt) {
- vertex.inactivate();
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionOutput.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionOutput.java
deleted file mode 100644
index d16b499a..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionOutput.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.output.hg.HugeGraphOutput;
-
-public class RingsDetectionOutput extends HugeGraphOutput<List<String>> {
-
- @Override
- protected void prepareSchema() {
- this.client().schema().propertyKey(this.name())
- .asText()
- .writeType(this.writeType())
- .valueList()
- .ifNotExist()
- .create();
- }
-
- @Override
- protected List<String> value(Vertex vertex) {
- IdListList value = vertex.value();
- List<String> propValues = new ArrayList<>();
- for (int i = 0; i < value.size(); i++) {
- propValues.add(value.get(i).toString());
- }
- return propValues;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/FilterDescribe.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/FilterDescribe.java
deleted file mode 100644
index be60a05b..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/FilterDescribe.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings.filter;
-
-import java.util.List;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.hugegraph.util.JsonUtil;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableList;
-
-public class FilterDescribe {
-
- private final List<DescribeItem> vertexFilter;
- private final List<DescribeItem> edgeFilter;
-
- @JsonCreator
- private FilterDescribe(@JsonProperty("vertex_filter")
- List<DescribeItem> vertexFilter,
- @JsonProperty("edge_filter")
- List<DescribeItem> edgeFilter) {
- this.vertexFilter = CollectionUtils.isEmpty(vertexFilter) ?
- ImmutableList.of() :
- ImmutableList.copyOf(vertexFilter);
- this.edgeFilter = CollectionUtils.isEmpty(edgeFilter) ?
- ImmutableList.of() :
- ImmutableList.copyOf(edgeFilter);
- }
-
- public static FilterDescribe of(String describe) {
- return JsonUtil.fromJson(describe, FilterDescribe.class);
- }
-
- public List<DescribeItem> vertexFilter() {
- return this.vertexFilter;
- }
-
- public List<DescribeItem> edgeFilter() {
- return this.edgeFilter;
- }
-
- public static class DescribeItem {
-
- private final String label;
- private final String propertyFilter;
-
- @JsonCreator
- private DescribeItem(@JsonProperty(value = "label",
- required = true)
- String label,
- @JsonProperty(value = "property_filter",
- required = true)
- String propertyFilter) {
- this.label = label;
- this.propertyFilter = propertyFilter;
- }
-
- public String label() {
- return this.label;
- }
-
- public String propertyFilter() {
- return this.propertyFilter;
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionMessage.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionMessage.java
deleted file mode 100644
index eb3c20ef..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionMessage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings.filter;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.properties.DefaultProperties;
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.Value.CustomizeValue;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class RingsDetectionMessage implements CustomizeValue<List<Object>> {
-
- private final IdList path;
- private Properties walkEdgeProps;
-
- public RingsDetectionMessage() {
- GraphFactory graphFactory = ComputerContext.instance().graphFactory();
- this.path = new IdList();
- this.walkEdgeProps = new DefaultProperties(graphFactory);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.path.read(in);
- this.walkEdgeProps.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.path.write(out);
- this.walkEdgeProps.write(out);
- }
-
- public IdList path() {
- return this.path;
- }
-
- public void addPath(Vertex vertex) {
- this.path.add(vertex.id());
- }
-
- public Properties walkEdgeProp() {
- return this.walkEdgeProps;
- }
-
- public void walkEdgeProp(Properties properties) {
- this.walkEdgeProps = properties;
- }
-
- @Override
- public List<Object> value() {
- return this.path.value();
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilter.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilter.java
deleted file mode 100644
index 81e58a5d..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilter.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings.filter;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-
-public class RingsDetectionWithFilter
- implements Computation<RingsDetectionMessage> {
-
- public static final String OPTION_FILTER = "rings.property_filter";
-
- private SpreadFilter filter;
-
- @Override
- public String name() {
- return "rings_with_filter";
- }
-
- @Override
- public String category() {
- return "path";
- }
-
- @Override
- public void init(Config config) {
- this.filter = new SpreadFilter(config.getString(OPTION_FILTER, "{}"));
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- vertex.value(new IdListList());
- if (vertex.edges().size() == 0 || !this.filter.filter(vertex)) {
- return;
- }
-
- RingsDetectionMessage message = new RingsDetectionMessage();
- message.addPath(vertex);
- for (Edge edge : vertex.edges()) {
- if (this.filter.filter(edge)) {
- message.walkEdgeProp(edge.properties());
- context.sendMessage(edge.targetId(), message);
- }
- }
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<RingsDetectionMessage> messages) {
- boolean halt = true;
- if (this.filter.filter(vertex)) {
- Id vertexId = vertex.id();
- while (messages.hasNext()) {
- halt = false;
- RingsDetectionMessage message = messages.next();
- IdList path = message.path();
- if (vertexId.equals(path.getFirst())) {
- // Use the smallest vertex record ring
- boolean isMin = true;
- for (int i = 0; i < path.size(); i++) {
- Id pathVertexValue = path.get(i);
- if (vertexId.compareTo(pathVertexValue) > 0) {
- isMin = false;
- break;
- }
- }
- if (isMin) {
- path.add(vertexId);
- IdListList value = vertex.value();
- value.add(path.copy());
- }
- } else {
- boolean contains = false;
- // Drop sequence if path contains this vertex
- for (int i = 0; i < path.size(); i++) {
- Id pathVertexValue = path.get(i);
- if (pathVertexValue.equals(vertex.id())) {
- contains = true;
- break;
- }
- }
- if (!contains) {
- path.add(vertex.id());
- for (Edge edge : vertex.edges()) {
- if (this.filter.filter(edge, message)) {
- message.walkEdgeProp(edge.properties());
- context.sendMessage(edge.targetId(), message);
- }
- }
- }
- }
- }
- }
- if (halt) {
- vertex.inactivate();
- }
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilterParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilterParams.java
deleted file mode 100644
index 9cfdc3a6..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/RingsDetectionWithFilterParams.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings.filter;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.algorithm.path.rings.RingsDetectionOutput;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-
-public class RingsDetectionWithFilterParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- RingsDetectionWithFilter.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- IdListList.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- RingsDetectionMessage.class.getName());
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- RingsDetectionOutput.class.getName());
- this.setIfAbsent(params, ComputerOptions.INPUT_FILTER_CLASS,
- EXTRACTALLPROPERTYINPUTFILTER_CLASS_NAME);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/SpreadFilter.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/SpreadFilter.java
deleted file mode 100644
index 9fdccbb5..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/filter/SpreadFilter.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/* * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.rings.filter;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Predicate;
-
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.mvel2.MVEL;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-public class SpreadFilter {
-
- private static final String ALL = "*";
- private static final String MESSAGE = "$message";
- private static final String ELEMENT = "$element";
- private static final List<Serializable> PASS = ImmutableList.of();
-
- private final Map<String, Serializable> vertexFilter;
- private final Map<String, Serializable> edgeSpreadFilter;
- private final Map<String, Serializable> edgeFilter;
-
- public SpreadFilter(String describe) {
- FilterDescribe des = FilterDescribe.of(describe);
-
- this.vertexFilter = new HashMap<>();
- this.edgeSpreadFilter = new HashMap<>();
- this.edgeFilter = new HashMap<>();
-
- this.init(this.vertexFilter, des.vertexFilter(), expression -> true);
- this.init(this.edgeSpreadFilter, des.edgeFilter(), expression -> true);
- // TODO: Use a better scheme to parse expressions with only $element
- this.init(this.edgeFilter, des.edgeFilter(), expression -> {
- return !expression.contains(MESSAGE);
- });
- }
-
- private void init(Map<String, Serializable> filter,
- List<FilterDescribe.DescribeItem> describes,
- Predicate<? super String> predicate) {
- for (FilterDescribe.DescribeItem describe : describes) {
- String labelName = describe.label();
- String propertyFilter = describe.propertyFilter();
- if (predicate.test(propertyFilter) || ALL.equals(labelName)) {
- Serializable expression = MVEL.compileExpression(
- describe.propertyFilter());
- filter.put(labelName, expression);
- }
- }
- }
-
- public boolean filter(Vertex vertex) {
- String label = vertex.label();
- List<Serializable> expressions = expressions(this.vertexFilter, label);
-
- if (expressions == PASS) {
- return true;
- }
-
- Map<String, Map<String, Value>> params =
- ImmutableMap.of(ELEMENT, vertex.properties().get());
- return filter(params, expressions);
- }
-
- public boolean filter(Edge edge) {
- String label = edge.label();
- List<Serializable> expressions = expressions(this.edgeFilter, label);
-
- if (expressions == PASS) {
- return true;
- }
-
- Map<String, Map<String, Value>> params =
- ImmutableMap.of(ELEMENT, edge.properties().get());
- return filter(params, expressions);
- }
-
- public boolean filter(Edge edge, RingsDetectionMessage message) {
- String label = edge.label();
- List<Serializable> expressions = expressions(this.edgeSpreadFilter,
- label);
-
- if (expressions == PASS) {
- return true;
- }
-
- Map<String, Map<String, Value>> params =
- ImmutableMap.of(ELEMENT, edge.properties().get(),
- MESSAGE, message.walkEdgeProp().get());
- return filter(params, expressions);
- }
-
- private static boolean filter(Map<String, Map<String, Value>> params,
- List<Serializable> expressions) {
- Map<String, Object> map = convertParamsValueToObject(params);
- return expressions.stream()
- .allMatch(expression -> {
- return (Boolean) MVEL.executeExpression(
- expression, map);
- });
- }
-
- private static List<Serializable> expressions(
- Map<String, Serializable> filter,
- String label) {
- if (filter.size() == 0) {
- return PASS;
- }
- List<Serializable> expressions = new ArrayList<>();
- if (filter.containsKey(ALL)) {
- expressions.add(filter.get(ALL));
- }
- if (filter.containsKey(label)) {
- expressions.add(filter.get(label));
- }
-
- return expressions;
- }
-
- private static Map<String, Object> convertParamsValueToObject(
- Map<String, Map<String, Value>> params) {
- Map<String, Object> result = new HashMap<>();
- for (Map.Entry<String, Map<String, Value>> entry : params.entrySet()) {
- Map<String, Object> subKv = new HashMap<>();
- Map<String, Value> param = entry.getValue();
- for (Map.Entry<String, Value> paramItem : param.entrySet()) {
- subKv.put(paramItem.getKey(), paramItem.getValue().value());
- }
- result.put(entry.getKey(), subKv);
- }
- return result;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/QuantityType.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/QuantityType.java
deleted file mode 100644
index 7cf722e7..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/QuantityType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-public enum QuantityType {
-
- SINGLE,
- MULTIPLE,
- ALL
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPath.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPath.java
deleted file mode 100644
index b9b1f12b..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPath.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.util.IdUtil;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.computer.core.worker.WorkerContext;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-public class SingleSourceShortestPath implements Computation<SingleSourceShortestPathValue> {
-
- private static final Logger LOG = Log.logger(SingleSourceShortestPath.class);
-
- public static final String OPTION_SOURCE_ID = "single_source_shortest_path.source_id";
- public static final String OPTION_TARGET_ID = "single_source_shortest_path.target_id";
- public static final String OPTION_WEIGHT_PROPERTY =
- "single_source_shortest_path.weight_property";
- public static final String OPTION_DEFAULT_WEIGHT =
- "single_source_shortest_path.default_weight";
-
- /**
- * source vertex id.
- */
- private Id sourceId;
-
- /**
- * target vertex id.
- * 1. single target: A
- * 2. multiple target: A, B, C
- * 3. all: *
- */
- private IdSet targetIdSet; // empty when targetId is all
- /**
- * target quantity type
- */
- private QuantityType targetQuantityType;
-
- /**
- * weight property.
- * weight value must be a positive number.
- */
- private String weightProperty;
-
- /**
- * default weight.
- * default 1
- */
- private Double defaultWeight;
-
- //****************** global data ******************//
- /**
- * reached targets
- */
- private IdSet reachedTargets; // empty when targetId is all
-
- @Override
- public String category() {
- return "path";
- }
-
- @Override
- public String name() {
- return "single_source_shortest_path";
- }
-
- @Override
- public void init(Config config) {
- String sourceIdStr = config.getString(OPTION_SOURCE_ID, "");
- if (StringUtils.isBlank(sourceIdStr)) {
- throw new ComputerException("The param '%s' must not be blank", OPTION_SOURCE_ID);
- }
- this.sourceId = IdUtil.parseId(sourceIdStr);
-
- String targetIdStr = config.getString(OPTION_TARGET_ID, "");
- if (StringUtils.isBlank(targetIdStr)) {
- throw new ComputerException("The param '%s' must not be blank", OPTION_TARGET_ID);
- }
- // remove spaces
- targetIdStr = Arrays.stream(targetIdStr.split(","))
- .map(e -> e.trim())
- .collect(Collectors.joining(","));
- this.targetQuantityType = this.getQuantityType(targetIdStr);
- if (this.targetQuantityType != QuantityType.ALL) {
- this.targetIdSet = new IdSet();
- for (String targetId : targetIdStr.split(",")) {
- targetIdSet.add(IdUtil.parseId(targetId));
- }
- }
-
- this.weightProperty = config.getString(OPTION_WEIGHT_PROPERTY, "");
-
- this.defaultWeight = config.getDouble(OPTION_DEFAULT_WEIGHT, 1);
- if (this.defaultWeight <= 0) {
- throw new ComputerException("The param '%s' must be greater than 0, " +
- "actual got '%s'",
- OPTION_DEFAULT_WEIGHT, this.defaultWeight);
- }
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- SingleSourceShortestPathValue value = new SingleSourceShortestPathValue();
- value.unreachable();
- vertex.value(value);
-
- // start from source vertex
- if (!this.sourceId.equals(vertex.id())) {
- vertex.inactivate();
- return;
- }
- value.zeroDistance(); // source vertex
-
- // single target && source == target
- if (this.targetQuantityType == QuantityType.SINGLE &&
- this.targetIdSet.contains(this.sourceId)) {
- LOG.debug("source vertex equals target vertex: {}", this.sourceId);
- vertex.inactivate();
- return;
- }
-
- if (vertex.numEdges() <= 0) {
- // isolated vertex
- LOG.debug("The source vertex is isolated: {}", this.sourceId);
- vertex.inactivate();
- return;
- }
-
- vertex.edges().forEach(edge -> {
- SingleSourceShortestPathValue message = new SingleSourceShortestPathValue();
- message.addToPath(vertex, this.getEdgeWeight(edge));
-
- context.sendMessage(edge.targetId(), message);
- });
-
- vertex.inactivate();
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<SingleSourceShortestPathValue> messages) {
- if (this.isTarget(vertex) && !this.reachedTargets.contains(vertex.id())) {
- // reached targets
- this.reachedTargets.add(vertex.id());
- }
-
- while (messages.hasNext()) {
- SingleSourceShortestPathValue message = messages.next();
- SingleSourceShortestPathValue value = vertex.value();
-
- if (message.totalWeight() < value.totalWeight()) {
- // find a shorter path
- value.shorterPath(vertex, message.path(), message.totalWeight());
- } else {
- continue;
- }
-
- // target vertex finds all targets reached or nowhere to go
- if ((this.isTarget(vertex) && this.isAllTargetsReached(vertex)) ||
- vertex.numEdges() <= 0) {
- continue;
- }
-
- vertex.edges().forEach(edge -> {
- SingleSourceShortestPathValue forwardMessage = new SingleSourceShortestPathValue();
- forwardMessage.addToPath(value.path(),
- value.totalWeight() + this.getEdgeWeight(edge));
-
- context.sendMessage(edge.targetId(), forwardMessage);
- });
- }
-
- vertex.inactivate();
- }
-
- @Override
- public void beforeSuperstep(WorkerContext context) {
- this.reachedTargets = context.aggregatedValue(
- SingleSourceShortestPathMaster.SINGLE_SOURCE_SHORTEST_PATH_REACHED_TARGETS);
- }
-
- @Override
- public void afterSuperstep(WorkerContext context) {
- context.aggregateValue(
- SingleSourceShortestPathMaster.SINGLE_SOURCE_SHORTEST_PATH_REACHED_TARGETS,
- this.reachedTargets);
- }
-
- /**
- * get quantityType by targetId
- */
- private QuantityType getQuantityType(String targetIdStr) {
- if (targetIdStr.equals("*")) {
- return QuantityType.ALL;
- } else if (targetIdStr.contains(",")) {
- return QuantityType.MULTIPLE;
- } else {
- return QuantityType.SINGLE;
- }
- }
-
- /**
- * get the weight of an edge by its weight property
- */
- private double getEdgeWeight(Edge edge) {
- double weight = this.defaultWeight;
-
- Value property = edge.property(this.weightProperty);
- if (property != null) {
- if (!property.isNumber()) {
- throw new ComputerException("The value of %s must be a numeric value, " +
- "actual got '%s'",
- this.weightProperty, property.string());
- }
-
- weight = ((DoubleValue) property).doubleValue();
- if (weight <= 0) {
- throw new ComputerException("The value of %s must be greater than 0, " +
- "actual got '%s'",
- this.weightProperty, property.string());
- }
- }
- return weight;
- }
-
- /**
- * determine whether vertex is one of the target
- */
- private boolean isTarget(Vertex vertex) {
- return this.targetQuantityType != QuantityType.ALL &&
- this.targetIdSet.contains(vertex.id());
- }
-
- /**
- * determine whether all targets reached
- */
- private boolean isAllTargetsReached(Vertex vertex) {
- if (this.targetQuantityType == QuantityType.ALL) {
- return false;
- }
-
- if (this.targetIdSet.size() == this.reachedTargets.size()) {
- for (Id targetId : this.targetIdSet.value()) {
- if (!this.reachedTargets.contains(targetId)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- public IdSet getTargetIdSet() {
- return this.targetIdSet;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathCombiner.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathCombiner.java
deleted file mode 100644
index 78ea2cd2..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathCombiner.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-import org.apache.hugegraph.computer.core.combiner.Combiner;
-
-public class SingleSourceShortestPathCombiner implements Combiner<SingleSourceShortestPathValue> {
-
- @Override
- public void combine(SingleSourceShortestPathValue v1, SingleSourceShortestPathValue v2,
- SingleSourceShortestPathValue result) {
- SingleSourceShortestPathValue shorter = v2.totalWeight() < v1.totalWeight() ? v2 : v1;
- result.copy(shorter);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathMaster.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathMaster.java
deleted file mode 100644
index 358d77ad..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathMaster.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-import org.apache.hugegraph.computer.core.combiner.IdSetMergeCombiner;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-import org.apache.hugegraph.computer.core.master.MasterComputation;
-import org.apache.hugegraph.computer.core.master.MasterComputationContext;
-import org.apache.hugegraph.computer.core.master.MasterContext;
-
-public class SingleSourceShortestPathMaster implements MasterComputation {
-
- public static final String SINGLE_SOURCE_SHORTEST_PATH_REACHED_TARGETS =
- "single_source_shortest_path.reached_targets";
-
- @Override
- public void init(MasterContext context) {
- context.registerAggregator(SINGLE_SOURCE_SHORTEST_PATH_REACHED_TARGETS,
- ValueType.ID_SET,
- IdSetMergeCombiner.class);
- }
-
- @Override
- public void close(MasterContext context) {
- // pass
- }
-
- @Override
- public boolean compute(MasterComputationContext context) {
- return true;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathOutput.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathOutput.java
deleted file mode 100644
index 943babb2..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathOutput.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.output.hg.HugeGraphOutput;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.util.JsonUtil;
-
-public class SingleSourceShortestPathOutput extends HugeGraphOutput<String> {
-
- @Override
- protected void prepareSchema() {
- this.client().schema().propertyKey(this.name())
- .asText()
- .writeType(this.writeType())
- .valueList()
- .ifNotExist()
- .create();
- }
-
- @Override
- protected String value(Vertex vertex) {
- SingleSourceShortestPathValue value = vertex.value();
-
- Map map = new HashMap();
- map.put("path", value.path().toString());
- map.put("total_weight", value.totalWeight());
- return JsonUtil.toJson(map);
- }
-
- @Override
- public boolean filter(Config config, Computation computation, Vertex vertex) {
- SingleSourceShortestPath sssp = (SingleSourceShortestPath) computation;
- return sssp.getTargetIdSet() == null || sssp.getTargetIdSet().contains(vertex.id());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathValue.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathValue.java
deleted file mode 100644
index f6ca1c16..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/shortest/SingleSourceShortestPathValue.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.path.shortest;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class SingleSourceShortestPathValue implements Value.CustomizeValue<List<Object>> {
-
- /**
- * path
- */
- private final IdList path;
-
- /**
- * total weight.
- * infinity means unreachable.
- */
- private final DoubleValue totalWeight;
-
- public SingleSourceShortestPathValue() {
- this.path = new IdList();
- this.totalWeight = new DoubleValue(0);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.path.read(in);
- this.totalWeight.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.path.write(out);
- this.totalWeight.write(out);
- }
-
- @Override
- public List<Object> value() {
- return this.path.value();
- }
-
- public void unreachable() {
- this.totalWeight.value(Double.POSITIVE_INFINITY);
- }
-
- public void zeroDistance() {
- this.totalWeight.value(0);
- }
-
- public void shorterPath(Vertex vertex, IdList path, double weight) {
- this.path.clear();
- this.path.addAll(path.copy().values());
- this.path.add(vertex.id());
- this.totalWeight.value(weight);
- }
-
- public void addToPath(Vertex vertex, double weight) {
- this.path.add(vertex.id());
- this.totalWeight.value(weight);
- }
-
- public void addToPath(IdList path, double weight) {
- this.path.addAll(path.copy().values());
- this.totalWeight.value(weight);
- }
-
- public IdList path() {
- return this.path;
- }
-
- public double totalWeight() {
- return this.totalWeight.doubleValue();
- }
-
- public void copy(SingleSourceShortestPathValue value) {
- this.path.clear();
- this.path.addAll(value.path().copy().values());
- this.totalWeight.value(value.totalWeight());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalk.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalk.java
deleted file mode 100644
index 6401de4f..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalk.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.sampling;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.config.Config;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.edge.Edges;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.worker.Computation;
-import org.apache.hugegraph.computer.core.worker.ComputationContext;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-public class RandomWalk implements Computation<RandomWalkMessage> {
-
- private static final Logger LOG = Log.logger(RandomWalk.class);
-
- public static final String OPTION_WALK_PER_NODE = "random_walk.walk_per_node";
- public static final String OPTION_WALK_LENGTH = "random_walk.walk_length";
-
- public static final String OPTION_WEIGHT_PROPERTY = "random_walk.weight_property";
- public static final String OPTION_DEFAULT_WEIGHT = "random_walk.default_weight";
- public static final String OPTION_MIN_WEIGHT_THRESHOLD = "random_walk.min_weight_threshold";
- public static final String OPTION_MAX_WEIGHT_THRESHOLD = "random_walk.max_weight_threshold";
-
- public static final String OPTION_RETURN_FACTOR = "random_walk.return_factor";
- public static final String OPTION_INOUT_FACTOR = "random_walk.inout_factor";
-
- /**
- * Random
- */
- private Random random;
-
- /**
- * Number of times per vertex(source vertex) walks
- */
- private Integer walkPerNode;
-
- /**
- * Walk length
- */
- private Integer walkLength;
-
- /**
- * Weight property, related to the walking probability
- */
- private String weightProperty;
-
- /**
- * Biased walk
- * Default 1
- */
- private Double defaultWeight;
-
- /**
- * Weight less than this threshold will be truncated.
- * Default 0
- */
- private Double minWeightThreshold;
-
- /**
- * Weight greater than this threshold will be truncated.
- * Default Integer.MAX_VALUE
- */
- private Double maxWeightThreshold;
-
- /**
- * Controls the probability of re-walk to a previously walked vertex.
- * Default 1
- */
- private Double returnFactor;
-
- /**
- * Controls whether to walk inward or outward.
- * Default 1
- */
- private Double inOutFactor;
-
- @Override
- public String category() {
- return "sampling";
- }
-
- @Override
- public String name() {
- return "random_walk";
- }
-
- @Override
- public void init(Config config) {
- this.random = new Random();
-
- this.walkPerNode = config.getInt(OPTION_WALK_PER_NODE, 3);
- if (this.walkPerNode <= 0) {
- throw new ComputerException("The param %s must be greater than 0, " +
- "actual got '%s'",
- OPTION_WALK_PER_NODE, this.walkPerNode);
- }
-
- this.walkLength = config.getInt(OPTION_WALK_LENGTH, 3);
- if (this.walkLength <= 0) {
- throw new ComputerException("The param %s must be greater than 0, " +
- "actual got '%s'",
- OPTION_WALK_LENGTH, this.walkLength);
- }
-
- this.weightProperty = config.getString(OPTION_WEIGHT_PROPERTY, "");
-
- this.defaultWeight = config.getDouble(OPTION_DEFAULT_WEIGHT, 1);
- if (this.defaultWeight <= 0) {
- throw new ComputerException("The param %s must be greater than 0, " +
- "actual got '%s'",
- OPTION_DEFAULT_WEIGHT, this.defaultWeight);
- }
-
- this.minWeightThreshold = config.getDouble(OPTION_MIN_WEIGHT_THRESHOLD, 0.0);
- if (this.minWeightThreshold < 0) {
- throw new ComputerException("The param %s must be greater than or equal 0, " +
- "actual got '%s'",
- OPTION_MIN_WEIGHT_THRESHOLD, this.minWeightThreshold);
- }
-
- this.maxWeightThreshold = config.getDouble(OPTION_MAX_WEIGHT_THRESHOLD, Double.MAX_VALUE);
- if (this.maxWeightThreshold < 0) {
- throw new ComputerException("The param %s must be greater than or equal 0, " +
- "actual got '%s'",
- OPTION_MAX_WEIGHT_THRESHOLD, this.maxWeightThreshold);
- }
-
- if (this.minWeightThreshold > this.maxWeightThreshold) {
- throw new ComputerException("%s must be greater than or equal %s, ",
- OPTION_MAX_WEIGHT_THRESHOLD, OPTION_MIN_WEIGHT_THRESHOLD);
- }
-
- this.returnFactor = config.getDouble(OPTION_RETURN_FACTOR, 1);
- if (this.returnFactor <= 0) {
- throw new ComputerException("The param %s must be greater than 0, " +
- "actual got '%s'",
- OPTION_RETURN_FACTOR, this.returnFactor);
- }
-
- this.inOutFactor = config.getDouble(OPTION_INOUT_FACTOR, 1);
- if (this.inOutFactor <= 0) {
- throw new ComputerException("The param %s must be greater than 0, " +
- "actual got '%s'",
- OPTION_INOUT_FACTOR, this.inOutFactor);
- }
- }
-
- @Override
- public void compute0(ComputationContext context, Vertex vertex) {
- vertex.value(new IdListList());
-
- RandomWalkMessage message = new RandomWalkMessage();
- message.addToPath(vertex);
-
- if (vertex.numEdges() <= 0) {
- // isolated vertex
- this.savePath(vertex, message.path());
- vertex.inactivate();
- return;
- }
-
- vertex.edges().forEach(edge -> message.addToPreVertexAdjacence(edge.targetId()));
-
- for (int i = 0; i < walkPerNode; ++i) {
- // random select one edge and walk
- Edge selectedEdge = this.randomSelectEdge(null, null, vertex.edges());
- context.sendMessage(selectedEdge.targetId(), message);
- }
-
- vertex.inactivate();
- }
-
- @Override
- public void compute(ComputationContext context, Vertex vertex,
- Iterator<RandomWalkMessage> messages) {
- while (messages.hasNext()) {
- RandomWalkMessage message = messages.next();
- // the last id of path is the previous id
- Id preVertexId = message.path().getLast();
-
- if (message.isFinish()) {
- this.savePath(vertex, message.path());
-
- vertex.inactivate();
- continue;
- }
-
- message.addToPath(vertex);
-
- if (vertex.numEdges() <= 0) {
- // there is nowhere to walk, finish eariler
- message.finish();
- context.sendMessage(this.getSourceId(message.path()), message);
-
- vertex.inactivate();
- continue;
- }
-
- if (message.path().size() >= this.walkLength + 1) {
- message.finish();
- Id sourceId = this.getSourceId(message.path());
-
- if (vertex.id().equals(sourceId)) {
- // current vertex is the source vertex,no need to send message once more
- this.savePath(vertex, message.path());
- } else {
- context.sendMessage(sourceId, message);
- }
-
- vertex.inactivate();
- continue;
- }
-
- vertex.edges().forEach(edge -> message.addToPreVertexAdjacence(edge.targetId()));
-
- // random select one edge and walk
- Edge selectedEdge = this.randomSelectEdge(preVertexId, message.preVertexAdjacence(),
- vertex.edges());
- context.sendMessage(selectedEdge.targetId(), message);
- }
-
- vertex.inactivate();
- }
-
- /**
- * random select one edge
- */
- private Edge randomSelectEdge(Id preVertexId, IdList preVertexAdjacenceIdList, Edges edges) {
- // TODO: use primitive array instead, like DoubleArray,
- // in order to reduce memory fragmentation generated during calculations
- List<Double> weightList = new ArrayList<>();
-
- Iterator<Edge> iterator = edges.iterator();
- while (iterator.hasNext()) {
- Edge edge = iterator.next();
- // calculate edge weight
- double weight = this.getEdgeWeight(edge);
- double finalWeight = this.calculateEdgeWeight(preVertexId, preVertexAdjacenceIdList,
- edge.targetId(), weight);
- // TODO: improve to avoid OOM
- weightList.add(finalWeight);
- }
-
- int selectedIndex = this.randomSelectIndex(weightList);
- Edge selectedEdge = this.selectEdge(edges.iterator(), selectedIndex);
- return selectedEdge;
- }
-
- /**
- * get the weight of an edge by its weight property
- */
- private double getEdgeWeight(Edge edge) {
- double weight = this.defaultWeight;
-
- Value property = edge.property(this.weightProperty);
- if (property != null) {
- if (!property.isNumber()) {
- throw new ComputerException("The value of %s must be a numeric value, " +
- "actual got '%s'",
- this.weightProperty, property.string());
- }
-
- weight = ((DoubleValue) property).doubleValue();
- }
-
- // weight threshold truncation
- if (weight < this.minWeightThreshold) {
- weight = this.minWeightThreshold;
- }
- if (weight > this.maxWeightThreshold) {
- weight = this.maxWeightThreshold;
- }
- return weight;
- }
-
- /**
- * calculate edge weight
- */
- private double calculateEdgeWeight(Id preVertexId, IdList preVertexAdjacenceIdList,
- Id nextVertexId, double weight) {
- /*
- * 3 types of vertices.
- * 1. current vertex, called v
- * 2. previous vertex, called t
- * 3. current vertex outer vertex, called x(x1, x2.. xn)
- *
- * Definition of weight correction coefficient α:
- * if distance(t, x) = 0, then α = 1.0 / returnFactor
- * if distance(t, x) = 1, then α = 1.0
- * if distance(t, x) = 2, then α = 1.0 / inOutFactor
- *
- * Final edge weight π(v, x) = α * edgeWeight
- */
- double finalWeight = 0.0;
- if (preVertexId != null && preVertexId.equals(nextVertexId)) {
- // distance(t, x) = 0
- finalWeight = 1.0 / this.returnFactor * weight;
- } else if (preVertexAdjacenceIdList != null &&
- preVertexAdjacenceIdList.contains(nextVertexId)) {
- // distance(t, x) = 1
- finalWeight = 1.0 * weight;
- } else {
- // distance(t, x) = 2
- finalWeight = 1.0 / this.inOutFactor * weight;
- }
- return finalWeight;
- }
-
- /**
- * random select index
- */
- private int randomSelectIndex(List<Double> weightList) {
- int selectedIndex = 0;
- double totalWeight = weightList.stream().mapToDouble(Double::doubleValue).sum();
- double randomNum = random.nextDouble() * totalWeight; // [0, totalWeight)
-
- // determine which interval the random number falls into
- double cumulativeWeight = 0;
- for (int i = 0; i < weightList.size(); ++i) {
- cumulativeWeight += weightList.get(i);
- if (randomNum < cumulativeWeight) {
- selectedIndex = i;
- break;
- }
- }
- return selectedIndex;
- }
-
- /**
- * select edge from iterator by index
- */
- private Edge selectEdge(Iterator<Edge> iterator, int selectedIndex) {
- Edge selectedEdge = null;
-
- int index = 0;
- while (iterator.hasNext()) {
- selectedEdge = iterator.next();
- if (index == selectedIndex) {
- break;
- }
- index++;
- }
- return selectedEdge;
- }
-
- /**
- * get source id of path
- */
- private Id getSourceId(IdList path) {
- // the first id of path is the source id
- return path.getFirst();
- }
-
- /**
- * save path
- */
- private void savePath(Vertex sourceVertex, IdList path) {
- IdListList curValue = sourceVertex.value();
- curValue.add(path.copy());
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkMessage.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkMessage.java
deleted file mode 100644
index 6d92781a..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkMessage.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.sampling;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.BooleanValue;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class RandomWalkMessage implements Value.CustomizeValue<List<Object>> {
-
- /**
- * Previous vertex adjacent(out edge) vertex id list
- */
- private final IdList preVertexAdjacence;
-
- /**
- * Random walk path
- */
- private final IdList path;
-
- /**
- * Finish flag
- */
- private BooleanValue isFinish;
-
- public RandomWalkMessage() {
- this.preVertexAdjacence = new IdList();
- this.path = new IdList();
- this.isFinish = new BooleanValue(false);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.preVertexAdjacence.read(in);
- this.path.read(in);
- this.isFinish.read(in);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.preVertexAdjacence.write(out);
- this.path.write(out);
- this.isFinish.write(out);
- }
-
- @Override
- public List<Object> value() {
- return this.path.value();
- }
-
- public IdList preVertexAdjacence() {
- return this.preVertexAdjacence;
- }
-
- public void addToPreVertexAdjacence(Id vertexId) {
- this.preVertexAdjacence.add(vertexId);
- }
-
- public IdList path() {
- return this.path;
- }
-
- public void addToPath(Vertex vertex) {
- this.path.add(vertex.id());
- }
-
- public boolean isFinish() {
- return this.isFinish.boolValue();
- }
-
- public void finish() {
- this.isFinish = new BooleanValue(true);
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkOutput.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkOutput.java
deleted file mode 100644
index 47ef2d58..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkOutput.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.sampling;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-import org.apache.hugegraph.computer.core.output.hg.HugeGraphOutput;
-
-public class RandomWalkOutput extends HugeGraphOutput<List<String>> {
-
- @Override
- protected void prepareSchema() {
- this.client().schema().propertyKey(this.name())
- .asText()
- .writeType(this.writeType())
- .valueList()
- .ifNotExist()
- .create();
- }
-
- @Override
- protected List<String> value(Vertex vertex) {
- IdListList value = vertex.value();
- List<String> propValues = new ArrayList<>();
- for (int i = 0; i < value.size(); i++) {
- propValues.add(value.get(i).toString());
- }
- return propValues;
- }
-}
diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkParams.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkParams.java
deleted file mode 100644
index a8d9fd81..00000000
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalkParams.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm.sampling;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.algorithm.AlgorithmParams;
-import org.apache.hugegraph.computer.core.config.ComputerOptions;
-import org.apache.hugegraph.computer.core.graph.value.IdListList;
-
-public class RandomWalkParams implements AlgorithmParams {
-
- @Override
- public void setAlgorithmParameters(Map<String, String> params) {
- this.setIfAbsent(params, ComputerOptions.WORKER_COMPUTATION_CLASS,
- RandomWalk.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_MESSAGE_CLASS,
- RandomWalkMessage.class.getName());
- this.setIfAbsent(params, ComputerOptions.ALGORITHM_RESULT_CLASS,
- IdListList.class.getName());
- this.setIfAbsent(params, ComputerOptions.INPUT_FILTER_CLASS,
- EXTRACTALLPROPERTYINPUTFILTER_CLASS_NAME);
- this.setIfAbsent(params, ComputerOptions.OUTPUT_CLASS,
- RandomWalkOutput.class.getName());
-
- this.setIfAbsent(params, RandomWalk.OPTION_WALK_PER_NODE, "3");
- this.setIfAbsent(params, RandomWalk.OPTION_WALK_LENGTH, "3");
- }
-}
diff --git a/computer-api/pom.xml b/computer-api/pom.xml
deleted file mode 100644
index b3cf5c9f..00000000
--- a/computer-api/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>hugegraph-computer</artifactId>
- <groupId>org.apache.hugegraph</groupId>
- <version>${revision}</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>computer-api</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang3-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.hugegraph</groupId>
- <artifactId>hugegraph-client</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/algorithm/AlgorithmParams.java b/computer-api/src/main/java/org/apache/hugegraph/computer/algorithm/AlgorithmParams.java
deleted file mode 100644
index 4343e485..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/algorithm/AlgorithmParams.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.algorithm;
-
-import static org.apache.hugegraph.computer.core.config.ComputerOptions.COMPUTER_PROHIBIT_USER_OPTIONS;
-
-import java.util.Map;
-
-import org.apache.hugegraph.config.ConfigOption;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-public interface AlgorithmParams {
-
- Logger LOG = Log.logger(AlgorithmParams.class);
-
- String BYTESID_CLASS_NAME = "org.apache.hugegraph.computer.core.graph.id.BytesId";
- String HDFS_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core.output.hdfs.HdfsOutput";
- String HUGEGRAPH_ID_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphIdOutput";
- String LOG_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core.output.LogOutput";
- String HUGEGRAPH_DOUBLE_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphDoubleOutput";
- String HUGEGRAPH_FLOAT_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphFloatOutput";
- String HUGEGRAPH_INT_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphIntOutput";
- String HUGEGRAPH_LONG_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphLongOutput";
- String HUGEGRAPH_STRING_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphStringOutput";
- String HUGEGRAPH_LIST_OUTPUT_CLASS_NAME = "org.apache.hugegraph.computer.core" +
- ".output.hg.HugeGraphListOutput";
- String DEFAULTINPUTFILTER_CLASS_NAME = "org.apache.hugegraph.computer" +
- ".core.input.filter" +
- ".DefaultInputFilter";
- String EXTRACTALLPROPERTYINPUTFILTER_CLASS_NAME = "org.apache.hugegraph.computer" +
- ".core.input.filter" +
- ".ExtractAllPropertyInputFilter";
-
- /**
- * set algorithm's specific configuration
- * @param params
- */
- void setAlgorithmParameters(Map<String, String> params);
-
- default void setIfAbsent(Map<String, String> params, String key,
- String value) {
- if (!params.containsKey(key) && !COMPUTER_PROHIBIT_USER_OPTIONS.contains(key)) {
- LOG.debug("Put parameters key={}, value={}", key, value);
- params.put(key, value);
- }
- }
-
- default void setIfAbsent(Map<String, String> params,
- ConfigOption<?> keyOption,
- String value) {
- this.setIfAbsent(params, keyOption.name(), value);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator.java
deleted file mode 100644
index 85d35c66..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.aggregator;
-
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-
-public interface Aggregator<V extends Value> {
-
- /**
- * Used by worker to aggregate a new value when compute a vertex.
- * The combination method needs to be commutative and associative.
- * Can be called in worker computation compute() or afterSuperstep().
- * @param value The value to be aggregated
- */
- void aggregateValue(V value);
-
- /**
- * Used by worker to aggregate an int value. For performance reasons, it
- * can aggregate without create an IntValue object.
- */
- default void aggregateValue(int value) {
- throw new ComputerException("Not implemented: aggregateValue(int)");
- }
-
- /**
- * Used by worker to aggregate a long value. For performance reasons, it
- * can aggregate without create a LongValue object.
- */
- default void aggregateValue(long value) {
- throw new ComputerException("Not implemented: aggregateValue(long)");
- }
-
- /**
- * Used by worker to aggregate a float value. For performance reasons, it
- * can aggregate without create a FloatValue object.
- */
- default void aggregateValue(float value) {
- throw new ComputerException("Not implemented: aggregateValue(float)");
- }
-
- /**
- * Used by worker to aggregate a double value. For performance reasons,
- * it can aggregate without create a DoubleValue object.
- */
- default void aggregateValue(double value) {
- throw new ComputerException("Not implemented: aggregateValue(double)");
- }
-
- /**
- * Used by worker or master to get the aggregated value. The worker
- * get an aggregated value of previous superstep in current superstep.
- * The master can get an aggregated value of current superstep when
- * master-computation compute().
- */
- V aggregatedValue();
-
- /**
- * Used by worker or master to set current aggregated value directly. The
- * worker set aggregated value and then send to master for further
- * aggregation. The master set aggregated value and then used by workers in
- * the next superstep.
- */
- void aggregatedValue(V value);
-
- /**
- * Return cloned object of this instance.
- */
- Aggregator<V> copy();
-
- /**
- * Repair the object because some fields may not be deserialized.
- */
- void repair(ComputerContext context);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Master.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Master.java
deleted file mode 100644
index 251a9fff..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Master.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.aggregator;
-
-import org.apache.hugegraph.computer.core.combiner.Combiner;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-
-/**
- * Aggregator4Master used by algorithm's master-computation. The master must
- * register all aggregators before all supersteps start. Then the workers can
- * aggregate aggregators in superstep, send the aggregators to master when
- * superstep finish. The master aggregates the aggregators sent by workers.
- * The workers can get the aggregated values master aggregated at next
- * superstep. These values are identical among all workers.
- */
-public interface Aggregator4Master {
-
- /**
- * Register the aggregator with specified name. The name must be unique.
- * Used by algorithm's master-computation init() to register aggregators.
- */
- <V extends Value, C extends Aggregator<V>>
- void registerAggregator(String name, Class<C> aggregator);
-
- /**
- * Register aggregator with specified value type and a combiner which can
- * combine values with specified value type. The name must be unique.
- * Used by algorithm's master-computation init() to register aggregators.
- */
- <V extends Value, C extends Combiner<V>>
- void registerAggregator(String name, ValueType type, Class<C> combiner);
-
- /**
- * Register aggregator with specified default value(include type) and
- * a combiner which can combine values with specified value type.
- * The name must be unique.
- * Used by algorithm's master-computation init() to register aggregators.
- */
- <V extends Value, C extends Combiner<V>>
- void registerAggregator(String name, V defaultValue, Class<C> combiner);
-
- /**
- * Set the aggregated value by master-computation, generally users may not
- * need to explicitly set a aggregated value.
- * If the value is set, it will be received by workers at next superstep.
- * Throws ComputerException if master-computation does not register
- * aggregator with specified name.
- */
- <V extends Value> void aggregatedValue(String name, V value);
-
- /**
- * Get the aggregated value. Each worker aggregate the aggregator value
- * locally, then submit to master, then master aggregate the aggregators
- * value from all workers. master-computation can get the aggregated value
- * in master compute(), and worker-computation can get the aggregated value
- * in the next superstep.
- * Used by algorithm's master-computation compute()
- * Throws ComputerException if master-computation does not register
- * aggregator with the specified name.
- */
- <V extends Value> V aggregatedValue(String name);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Worker.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Worker.java
deleted file mode 100644
index ec63a2be..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/aggregator/Aggregator4Worker.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.aggregator;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-
-/**
- * Aggregator4Worker used by algorithm's computation. The computation can
- * only use the aggregator with specified name the master registered.
- * See {@link Aggregator4Master} for detailed information about aggregation
- * process.
- */
-public interface Aggregator4Worker {
-
- /**
- * Create aggregator by name in worker-computation, the aggregator is
- * registered by master-computation.
- * Used by algorithm's worker-computation beforeSuperstep(), can be called
- * in each superstep.
- * Throws ComputerException if master-computation does not register
- * aggregator with the specified name.
- */
- <V extends Value> Aggregator<V> createAggregator(String name);
-
- /**
- * Set aggregate value in worker. The value of aggregator will be
- * aggregated locally in worker first, and it would be sent to master when
- * the current superstep finish.
- * Used by algorithm's worker-computation afterSuperstep(), can be called
- * in each superstep.
- * Throws ComputerException if master-computation does not register
- * aggregator with the specified name.
- * @param value The value to be aggregated
- */
- <V extends Value> void aggregateValue(String name, V value);
-
- /**
- * Get the aggregated value in worker-computation, the value is aggregated
- * by master at previous superstep, it won't be changed in a superstep.
- * Each worker aggregate an aggregator value locally, then submit to master,
- * then master aggregate the aggregator values from all workers.
- * master-computation can get the aggregated value in master compute(), and
- * worker-computation can get the aggregated value in the next superstep.
- * Used by algorithm's worker-computation compute(), can be called in
- * each superstep.
- * Throws ComputerException if master-computation does not register
- * aggregator with the specified name.
- */
- <V extends Value> V aggregatedValue(String name);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Allocator.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Allocator.java
deleted file mode 100644
index d8bec76c..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Allocator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.allocator;
-
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-
-public interface Allocator {
-
- RecyclerReference<Vertex> newVertex();
-
- void freeVertex(RecyclerReference<Vertex> reference);
-
- RecyclerReference<Edge> newEdge();
-
- void freeEdge(RecyclerReference<Edge> reference);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Recyclable.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Recyclable.java
deleted file mode 100644
index 2506439e..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/Recyclable.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.allocator;
-
-public interface Recyclable {
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/RecyclerReference.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/RecyclerReference.java
deleted file mode 100644
index 77cf1c85..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/allocator/RecyclerReference.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.allocator;
-
-import java.lang.ref.SoftReference;
-
-public class RecyclerReference<T extends Recyclable> extends SoftReference<T>
- implements AutoCloseable {
-
- private final Handle<RecyclerReference<T>> handle;
-
- // TODO: create interface here and make parameter a interface.
- public RecyclerReference(T referent,
- Handle<RecyclerReference<T>> handle) {
- super(referent);
- this.handle = handle;
- }
-
- @Override
- public void close() {
- this.handle.recycle(this);
- }
-
- // Copy from io.netty.util.Recycler.Handle
- public interface Handle<O> {
- void recycle(O object);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/Combiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/Combiner.java
deleted file mode 100644
index a825a1b4..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/Combiner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import java.util.Iterator;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-
-public interface Combiner<T> {
-
- /**
- * @return The name of the combiner.
- * @return class name by default.
- */
- default String name() {
- return this.getClass().getName();
- }
-
- /**
- * Combine v1 and v2 to result. The combined value may
- * take use v1 or v2. The value of v1 and v2 may be updated. Should not
- * use v1 and v2 after combine them.
- */
- void combine(T v1, T v2, T result);
-
- @SuppressWarnings("unchecked")
- static <T extends Value> T combineAll(Combiner<T> combiner,
- Iterator<T> values) {
- if (!values.hasNext()) {
- return null;
- }
- T result = (T) values.next().copy();
- while (values.hasNext()) {
- combiner.combine(result, values.next(), result);
- }
- return result;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/DoubleValueSumCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/DoubleValueSumCombiner.java
deleted file mode 100644
index 490acedc..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/DoubleValueSumCombiner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.DoubleValue;
-import org.apache.hugegraph.util.E;
-
-public class DoubleValueSumCombiner implements Combiner<DoubleValue> {
-
- @Override
- public void combine(DoubleValue v1, DoubleValue v2, DoubleValue result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- result.value(v1.doubleValue() + v2.doubleValue());
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/FloatValueSumCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/FloatValueSumCombiner.java
deleted file mode 100644
index ce7a0b20..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/FloatValueSumCombiner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.FloatValue;
-import org.apache.hugegraph.util.E;
-
-public class FloatValueSumCombiner implements Combiner<FloatValue> {
-
- @Override
- public void combine(FloatValue v1, FloatValue v2, FloatValue result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- result.value(v1.floatValue() + v2.floatValue());
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdListMergeCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdListMergeCombiner.java
deleted file mode 100644
index 3cc18444..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdListMergeCombiner.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.IdList;
-
-public class IdListMergeCombiner implements Combiner<IdList> {
-
- @Override
- public void combine(IdList v1, IdList v2, IdList result) {
- // merge
- for (Id id : v1.values()) {
- if (!result.contains(id)) {
- result.add(id);
- }
- }
- for (Id id : v2.values()) {
- if (!result.contains(id)) {
- result.add(id);
- }
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdSetMergeCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdSetMergeCombiner.java
deleted file mode 100644
index 5698da94..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IdSetMergeCombiner.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.IdSet;
-
-public class IdSetMergeCombiner implements Combiner<IdSet> {
-
- @Override
- public void combine(IdSet v1, IdSet v2, IdSet result) {
- // merge
- result.addAll(v1);
- result.addAll(v2);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IntValueSumCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IntValueSumCombiner.java
deleted file mode 100644
index 48e2a784..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/IntValueSumCombiner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.IntValue;
-import org.apache.hugegraph.util.E;
-
-public class IntValueSumCombiner implements Combiner<IntValue> {
-
- @Override
- public void combine(IntValue v1, IntValue v2, IntValue result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- result.value(v1.intValue() + v2.intValue());
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/LongValueSumCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/LongValueSumCombiner.java
deleted file mode 100644
index a3e677ad..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/LongValueSumCombiner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.LongValue;
-import org.apache.hugegraph.util.E;
-
-public class LongValueSumCombiner implements Combiner<LongValue> {
-
- @Override
- public void combine(LongValue v1, LongValue v2, LongValue result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- result.value(v1.longValue() + v2.longValue());
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeNewPropertiesCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeNewPropertiesCombiner.java
deleted file mode 100644
index 13ca86a8..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeNewPropertiesCombiner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.util.E;
-
-public class MergeNewPropertiesCombiner implements PropertiesCombiner {
-
- /**
- * Merge properties v2 and v1 into result. If a property exists in both v1
- * and v2, remain the value in v1.
- */
- @Override
- public void combine(Properties v1, Properties v2, Properties result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- E.checkArgument(v1 != result && v2 != result,
- "The combine parameter result " +
- "can't same with v1 or v2");
-
- result.clear();
-
- Map<String, Value> v1Map = v1.get();
- for (Map.Entry<String, Value> entry : v1Map.entrySet()) {
- result.put(entry.getKey(), entry.getValue());
- }
- Map<String, Value> v2Map = v2.get();
- for (Map.Entry<String, Value> entry : v2Map.entrySet()) {
- result.putIfAbsent(entry.getKey(), entry.getValue());
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeOldPropertiesCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeOldPropertiesCombiner.java
deleted file mode 100644
index 46f89edd..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/MergeOldPropertiesCombiner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.util.E;
-
-public class MergeOldPropertiesCombiner implements PropertiesCombiner {
-
- /**
- * Merge properties v1 and v2 into result. If a property exists in both v1
- * and v2, remain the value in v2.
- */
- @Override
- public void combine(Properties v1, Properties v2, Properties result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- E.checkArgument(v1 != result && v2 != result,
- "The combine parameter result " +
- "can't same with v1 or v2");
-
- result.clear();
-
- Map<String, Value> v2Map = v2.get();
- for (Map.Entry<String, Value> entry : v2Map.entrySet()) {
- result.put(entry.getKey(), entry.getValue());
- }
- Map<String, Value> v1Map = v1.get();
- for (Map.Entry<String, Value> entry : v1Map.entrySet()) {
- result.putIfAbsent(entry.getKey(), entry.getValue());
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwriteCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwriteCombiner.java
deleted file mode 100644
index 9374264a..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwriteCombiner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.util.E;
-
-public class OverwriteCombiner<T extends Value> implements Combiner<T> {
-
- @Override
- public void combine(T v1, T v2, T result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- result.assign(v2);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwritePropertiesCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwritePropertiesCombiner.java
deleted file mode 100644
index 93b9621c..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/OverwritePropertiesCombiner.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.util.E;
-
-public class OverwritePropertiesCombiner implements PropertiesCombiner {
-
- @Override
- public void combine(Properties v1, Properties v2, Properties result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
-
- E.checkArgument(v1 != result && v2 != result,
- "The combine parameter result " +
- "can't same with v1 or v2");
-
- result.clear();
- result.putAll(v2.get());
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMaxCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMaxCombiner.java
deleted file mode 100644
index aa4d47ed..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMaxCombiner.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.util.E;
-
-public class ValueMaxCombiner<T extends Value> implements Combiner<T> {
-
- @Override
- public void combine(T v1, T v2, T result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- if (v1.compareTo(v2) >= 0) {
- result.assign(v1);
- } else {
- result.assign(v2);
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMinCombiner.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMinCombiner.java
deleted file mode 100644
index d8130d4f..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/combiner/ValueMinCombiner.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.combiner;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.util.E;
-
-public class ValueMinCombiner<T extends Value> implements Combiner<T> {
-
- @Override
- public void combine(T v1, T v2, T result) {
- E.checkArgumentNotNull(v1, "The combine parameter v1 can't be null");
- E.checkArgumentNotNull(v2, "The combine parameter v2 can't be null");
- E.checkArgumentNotNull(result,
- "The combine parameter result can't be null");
- if (v1.compareTo(v2) <= 0) {
- result.assign(v1);
- } else {
- result.assign(v2);
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/Constants.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/Constants.java
deleted file mode 100644
index 846ccaac..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/Constants.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.common;
-
-import org.apache.hugegraph.util.Bytes;
-
-public final class Constants {
-
- public static final byte[] EMPTY_BYTES = new byte[0];
-
- public static final int BOOLEAN_LEN = 1;
- public static final int BYTE_LEN = Byte.BYTES;
- public static final int SHORT_LEN = Short.BYTES;
- public static final int INT_LEN = Integer.BYTES;
- public static final int LONG_LEN = Long.BYTES;
- public static final int CHAR_LEN = Character.BYTES;
- public static final int FLOAT_LEN = Float.BYTES;
- public static final int DOUBLE_LEN = Double.BYTES;
-
- public static final int UINT8_MAX = 0xff;
- public static final int UINT16_MAX = 0xffff;
- public static final long UINT32_MAX = 0xffffffffL;
-
- /*
- * The small buffer size for buffered input & output,
- * mainly used in input & output of memory
- */
- public static final int SMALL_BUF_SIZE = 32;
-
- /*
- * The big buffer size for buffered input & output,
- * mainly used in input & output of file and stream
- */
- public static final int BIG_BUF_SIZE = (int) Bytes.KB * 8;
-
- /*
- * The capacity of message queue
- */
- public static final int QUEUE_CAPACITY = 128;
-
- /*
- * The timeout in second for asynchronous tasks
- */
- public static final int FUTURE_TIMEOUT = 300;
-
- /*
- * The timeout in millisecond for thread-pool shutdown
- */
- public static final long SHUTDOWN_TIMEOUT = 5000L;
-
- // The mode to read a file
- public static final String FILE_MODE_READ = "r";
-
- // The mode to write a file
- public static final String FILE_MODE_WRITE = "rw";
-
- public static final String EMPTY_STR = "";
-
- public static final int INPUT_SUPERSTEP = -1;
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/SerialEnum.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/SerialEnum.java
deleted file mode 100644
index 5f7cd389..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/SerialEnum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.common;
-
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.util.CollectionUtil;
-
-import com.google.common.collect.HashBasedTable;
-import com.google.common.collect.Table;
-
-public interface SerialEnum {
-
- byte code();
-
- Table<Class<?>, Byte, SerialEnum> TABLE = HashBasedTable.create();
-
- static void register(Class<? extends SerialEnum> clazz) {
- Object enums;
- try {
- enums = clazz.getMethod("values").invoke(null);
- } catch (Exception e) {
- throw new ComputerException("Call method values() error", e);
- }
- for (SerialEnum e : CollectionUtil.<SerialEnum>toList(enums)) {
- TABLE.put(clazz, e.code(), e);
- }
- }
-
- static <T extends SerialEnum> T fromCode(Class<T> clazz, byte code) {
- @SuppressWarnings("unchecked")
- T value = (T) TABLE.get(clazz, code);
- if (value == null) {
- throw new ComputerException("Can't construct %s from code %s",
- clazz.getSimpleName(), code);
- }
- return value;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/exception/ComputerException.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/exception/ComputerException.java
deleted file mode 100644
index 2165a6ea..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/common/exception/ComputerException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.common.exception;
-
-/**
- * The base class for all exception types
- */
-public class ComputerException extends RuntimeException {
-
- private static final long serialVersionUID = 3621207523020113277L;
-
- public ComputerException(String message) {
- super(message);
- }
-
- public ComputerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ComputerException(String message, Object... args) {
- super(String.format(message, args));
- }
-
- public ComputerException(String message, Throwable cause, Object... args) {
- super(String.format(message, args), cause);
- }
-
- public Throwable rootCause() {
- return rootCause(this);
- }
-
- public static Throwable rootCause(Throwable e) {
- Throwable cause = e;
- while (cause.getCause() != null) {
- cause = cause.getCause();
- }
- return cause;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/ComputerOptions.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/ComputerOptions.java
deleted file mode 100644
index 6978bf08..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/ComputerOptions.java
+++ /dev/null
@@ -1,1024 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-import static org.apache.hugegraph.computer.algorithm.AlgorithmParams.DEFAULTINPUTFILTER_CLASS_NAME;
-import static org.apache.hugegraph.computer.algorithm.AlgorithmParams.LOG_OUTPUT_CLASS_NAME;
-import static org.apache.hugegraph.config.OptionChecker.allowValues;
-import static org.apache.hugegraph.config.OptionChecker.disallowEmpty;
-import static org.apache.hugegraph.config.OptionChecker.nonNegativeInt;
-import static org.apache.hugegraph.config.OptionChecker.positiveInt;
-
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hugegraph.computer.core.combiner.OverwritePropertiesCombiner;
-import org.apache.hugegraph.computer.core.master.DefaultMasterComputation;
-import org.apache.hugegraph.config.ConfigConvOption;
-import org.apache.hugegraph.config.ConfigListOption;
-import org.apache.hugegraph.config.ConfigOption;
-import org.apache.hugegraph.config.OptionHolder;
-import org.apache.hugegraph.structure.constant.Direction;
-import org.apache.hugegraph.util.Bytes;
-import org.apache.hugegraph.util.Log;
-import org.slf4j.Logger;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-public class ComputerOptions extends OptionHolder {
-
- private static final Logger LOG = Log.logger(ComputerOptions.class);
-
- public static final int TRANSPORT_DEFAULT_THREADS = 4;
- public static final String RPC_SERVER_HOST_NAME = "rpc.server_host";
- public static final String RPC_SERVER_PORT_NAME = "rpc.server_port";
- public static final String RPC_REMOTE_URL_NAME = "rpc.remote_url";
-
- private ComputerOptions() {
- super();
- }
-
- private static volatile ComputerOptions INSTANCE;
-
- public static synchronized ComputerOptions instance() {
- if (INSTANCE == null) {
- INSTANCE = new ComputerOptions();
- // Should initialize all static members first, then register.
- INSTANCE.registerOptions();
- }
- return INSTANCE;
- }
-
- public static final ConfigOption<Class<?>> ALGORITHM_PARAMS_CLASS =
- new ConfigOption<>(
- "algorithm.params_class",
- "The class used to transfer algorithms' parameters " +
- "before algorithm been run.",
- disallowEmpty(),
- Null.class
- );
-
- public static final ConfigOption<Class<?>> ALGORITHM_RESULT_CLASS =
- new ConfigOption<>(
- "algorithm.result_class",
- "The class of vertex's value, the instance is used to " +
- "store computation result for the vertex.",
- disallowEmpty(),
- Null.class
- );
-
- public static final ConfigOption<Class<?>> ALGORITHM_MESSAGE_CLASS =
- new ConfigOption<>(
- "algorithm.message_class",
- "The class of message passed when compute vertex.",
- disallowEmpty(),
- Null.class
- );
-
- public static final ConfigOption<String> INPUT_SOURCE_TYPE =
- new ConfigOption<>(
- "input.source_type",
- "The source type to load input data",
- allowValues("hugegraph-server", "hugegraph-loader"),
- "hugegraph-server"
- );
-
- public static final ConfigOption<Integer> INPUT_SPLIT_FETCH_TIMEOUT =
- new ConfigOption<>(
- "input.split_fetch_timeout",
- "The timeout in seconds to fetch input splits",
- positiveInt(),
- 300
- );
-
- public static final ConfigOption<Long> INPUT_SPLITS_SIZE =
- new ConfigOption<>(
- "input.split_size",
- "The input split size in bytes",
- positiveInt(),
- 1024 * 1024L
- );
-
- public static final ConfigOption<Integer> INPUT_MAX_SPLITS =
- new ConfigOption<>(
- "input.split_max_splits",
- "The maximum number of input splits",
- positiveInt(),
- 10_000_000
- );
-
- public static final ConfigOption<Integer> INPUT_SPLIT_PAGE_SIZE =
- new ConfigOption<>(
- "input.split_page_size",
- "The page size for streamed load input split data",
- positiveInt(),
- 500
- );
-
- public static final ConfigOption<Class<?>> INPUT_FILTER_CLASS =
- new ConfigOption<>(
- "input.filter_class",
- "The class to create input-filter object, " +
- "input-filter is used to Filter vertex edges " +
- "according to user needs.",
- disallowEmpty(),
- loadClass(DEFAULTINPUTFILTER_CLASS_NAME)
- );
-
- public static final ConfigConvOption<String, Direction>
- INPUT_EDGE_DIRECTION = new ConfigConvOption<>(
- "input.edge_direction",
- "The data of the edge in which direction is loaded, " +
- "when the value is BOTH, the edges in both OUT and IN " +
- "direction will be loaded.",
- allowValues("OUT", "IN", "BOTH"),
- Direction::valueOf,
- "OUT"
- );
-
- public static final ConfigConvOption<String, EdgeFrequency>
- INPUT_EDGE_FREQ = new ConfigConvOption<>(
- "input.edge_freq",
- "The frequency of edges can exist between a pair of " +
- "vertices, allowed values: [SINGLE, SINGLE_PER_LABEL, " +
- "MULTIPLE]. SINGLE means that only one edge can exist " +
- "between a pair of vertices, use sourceId + targetId to " +
- "identify it; SINGLE_PER_LABEL means that each edge " +
- "label can exist one edge between a pair of vertices, " +
- "use sourceId + edgelabel + targetId to identify it; " +
- "MULTIPLE means that many edge can exist between a pair " +
- "of vertices, use sourceId + edgelabel + sortValues + " +
- "targetId to identify it.",
- allowValues("SINGLE", "SINGLE_PER_LABEL", "MULTIPLE"),
- EdgeFrequency::valueOf,
- "MULTIPLE"
- );
-
- public static final ConfigOption<Integer> INPUT_MAX_EDGES_IN_ONE_VERTEX =
- new ConfigOption<>(
- "input.max_edges_in_one_vertex",
- "The maximum number of adjacent edges allowed to be " +
- "attached to a vertex, the adjacent edges will be " +
- "stored and transferred together as a batch unit.",
- positiveInt(),
- 200
- );
-
- public static final ConfigOption<String> INPUT_LOADER_STRUCT_PATH =
- new ConfigOption<>(
- "input.loader_struct_path",
- "The struct path of loader input, only takes effect when " +
- "the input.source_type=loader is enabled",
- null,
- ""
- );
-
- public static final ConfigOption<String> INPUT_LOADER_SCHEMA_PATH =
- new ConfigOption<>(
- "input.loader_schema_path",
- "The schema path of loader input, only takes effect when " +
- "the input.source_type=loader is enabled",
- null,
- ""
- );
-
- public static final ConfigOption<Boolean> SNAPSHOT_WRITE =
- new ConfigOption<>(
- "snapshot.write",
- "Whether to write snapshot of input vertex/edge partitions.",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<Boolean> SNAPSHOT_LOAD =
- new ConfigOption<>(
- "snapshot.load",
- "Whether to load from snapshot of vertex/edge partitions.",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<String> SNAPSHOT_NAME =
- new ConfigOption<>(
- "snapshot.name",
- "The user-defined snapshot name.",
- null,
- ""
- );
-
- public static final ConfigOption<String> SNAPSHOT_MINIO_ENDPOINT =
- new ConfigOption<>(
- "snapshot.minio_endpoint",
- "The endpoint of MinIO, MinIO can be used to store snapshots.",
- null,
- ""
- );
-
- public static final ConfigOption<String> SNAPSHOT_MINIO_ACCESS_KEY =
- new ConfigOption<>(
- "snapshot.minio_access_key",
- "The access key of MinIO.",
- null,
- "minioadmin"
- );
-
- public static final ConfigOption<String> SNAPSHOT_MINIO_SECRET_KEY =
- new ConfigOption<>(
- "snapshot.minio_secret_key",
- "The secret key of MinIO.",
- null,
- "minioadmin"
- );
-
- public static final ConfigOption<String> SNAPSHOT_MINIO_BUCKET_NAME =
- new ConfigOption<>(
- "snapshot.minio_bucket_name",
- "The bucket name of MinIO.",
- null,
- ""
- );
-
- public static final ConfigOption<Integer> INPUT_SEND_THREAD_NUMS =
- new ConfigOption<>(
- "input.send_thread_nums",
- "The number of threads for parallel sending vertex or edge.",
- positiveInt(),
- 4
- );
-
- public static final ConfigOption<Integer> SORT_THREAD_NUMS =
- new ConfigOption<>(
- "sort.thread_nums",
- "The number of threads performing internal sorting.",
- positiveInt(),
- 4
- );
-
- public static final ConfigOption<Class<?>> OUTPUT_CLASS =
- new ConfigOption<>(
- "output.output_class",
- "The class to output the computation result of each " +
- "vertex. Be called after iteration computation.",
- disallowEmpty(),
- loadClass(LOG_OUTPUT_CLASS_NAME)
- );
-
- public static final ConfigOption<String> OUTPUT_RESULT_NAME =
- new ConfigOption<>(
- "output.result_name",
- "The value is assigned dynamically by #name() of " +
- "instance created by WORKER_COMPUTATION_CLASS.",
- disallowEmpty(),
- "value"
- );
-
- public static final ConfigOption<Boolean> OUTPUT_WITH_ADJACENT_EDGES =
- new ConfigOption<>(
- "output.with_adjacent_edges",
- "Output the adjacent edges of the vertex or not",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<Boolean> OUTPUT_WITH_VERTEX_PROPERTIES =
- new ConfigOption<>(
- "output.with_vertex_properties",
- "Output the properties of the vertex or not",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<Boolean> OUTPUT_WITH_EDGE_PROPERTIES =
- new ConfigOption<>(
- "output.with_edge_properties",
- "Output the properties of the edge or not",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<String> OUTPUT_RESULT_WRITE_TYPE =
- new ConfigOption<>(
- "output.result_write_type",
- "The result write-type to output to hugegraph, " +
- "allowed values are: " +
- "[OLAP_COMMON, OLAP_SECONDARY, OLAP_RANGE].",
- allowValues("OLAP_COMMON", "OLAP_SECONDARY", "OLAP_RANGE"),
- "OLAP_COMMON"
- );
-
- public static final ConfigOption<Integer> OUTPUT_BATCH_SIZE =
- new ConfigOption<>(
- "output.batch_size",
- "The batch size of output",
- positiveInt(),
- 500
- );
-
- public static final ConfigOption<Integer> OUTPUT_BATCH_THREADS =
- new ConfigOption<>(
- "output.batch_threads",
- "The threads number used to batch output",
- positiveInt(),
- 1
- );
-
- public static final ConfigOption<Integer> OUTPUT_SINGLE_THREADS =
- new ConfigOption<>(
- "output.single_threads",
- "The threads number used to single output",
- positiveInt(),
- 1
- );
-
- public static final ConfigOption<Integer>
- OUTPUT_THREAD_POOL_SHUTDOWN_TIMEOUT =
- new ConfigOption<>(
- "output.thread_pool_shutdown_timeout",
- "The timeout seconds of output threads pool shutdown",
- positiveInt(),
- 60
- );
-
- public static final ConfigOption<Integer> OUTPUT_RETRY_TIMES =
- new ConfigOption<>(
- "output.retry_times",
- "The retry times when output failed",
- positiveInt(),
- 3
- );
-
- public static final ConfigOption<Integer> OUTPUT_RETRY_INTERVAL =
- new ConfigOption<>(
- "output.retry_interval",
- "The retry interval when output failed",
- positiveInt(),
- 10
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_URL =
- new ConfigOption<>(
- "output.hdfs_url",
- "The hdfs url of output.",
- disallowEmpty(),
- "hdfs://127.0.0.1:9000"
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_USER =
- new ConfigOption<>(
- "output.hdfs_user",
- "The hdfs user of output.",
- disallowEmpty(),
- "hadoop"
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_CORE_SITE_PATH =
- new ConfigOption<>(
- "output.hdfs_core_site_path",
- "The hdfs core site path.",
- null,
- ""
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_SITE_PATH =
- new ConfigOption<>(
- "output.hdfs_site_path",
- "The hdfs site path.",
- null,
- ""
- );
-
- public static final ConfigOption<Short> OUTPUT_HDFS_REPLICATION =
- new ConfigOption<>(
- "output.hdfs_replication",
- "The replication number of hdfs.",
- positiveInt(),
- (short) 3
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_DIR =
- new ConfigOption<>(
- "output.hdfs_path_prefix",
- "The directory of hdfs output result.",
- disallowEmpty(),
- "/hugegraph-computer/results"
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_DELIMITER =
- new ConfigOption<>(
- "output.hdfs_delimiter",
- "The delimiter of hdfs output.",
- disallowEmpty(),
- ","
- );
-
- public static final ConfigOption<Boolean> OUTPUT_HDFS_MERGE =
- new ConfigOption<>(
- "output.hdfs_merge_partitions",
- "Whether merge output files of multiple partitions.",
- allowValues(true, false),
- true
- );
-
- public static final ConfigOption<Boolean> OUTPUT_HDFS_KERBEROS_ENABLE =
- new ConfigOption<>(
- "output.hdfs_kerberos_enable",
- "Is Kerberos authentication enabled for Hdfs.",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_KRB5_CONF =
- new ConfigOption<>(
- "output.hdfs_krb5_conf",
- "Kerberos configuration file.",
- disallowEmpty(),
- "/etc/krb5.conf"
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_KERBEROS_PRINCIPAL =
- new ConfigOption<>(
- "output.hdfs_kerberos_principal",
- "The Hdfs's principal for kerberos authentication.",
- null,
- ""
- );
-
- public static final ConfigOption<String> OUTPUT_HDFS_KERBEROS_KEYTAB =
- new ConfigOption<>(
- "output.hdfs_kerberos_keytab",
- "The Hdfs's key tab file for kerberos authentication.",
- null,
- ""
- );
-
- public static final ConfigOption<Integer>
- ALLOCATOR_MAX_VERTICES_PER_THREAD = new ConfigOption<>(
- "allocator.max_vertices_per_thread",
- "Maximum number of vertices per thread processed " +
- "in each memory allocator",
- positiveInt(),
- 10000
- );
-
- public static final ConfigOption<String> JOB_NAMESPACE =
- new ConfigOption<>(
- "job.namespace",
- "The job namespace can seperate different data source.",
- null,
- ""
- );
-
- public static final ConfigOption<String> JOB_ID =
- new ConfigOption<>(
- "job.id",
- "The job id on Yarn cluster or K8s cluster.",
- disallowEmpty(),
- "local_0001"
- );
-
- public static final ConfigOption<Integer> JOB_WORKERS_COUNT =
- new ConfigOption<>(
- "job.workers_count",
- "The workers count for computing one graph " +
- "algorithm job.",
- positiveInt(),
- 1
- );
-
- public static final ConfigOption<Integer> JOB_PARTITIONS_COUNT =
- new ConfigOption<>(
- "job.partitions_count",
- "The partitions count for computing one graph " +
- "algorithm job.",
- positiveInt(),
- 1
- );
-
- public static final ConfigOption<Integer> PARTITIONS_COMPUTE_THREAD_NUMS =
- new ConfigOption<>(
- "job.partitions_thread_nums",
- "The number of threads for partition parallel compute.",
- positiveInt(),
- 4
- );
-
- public static final ConfigOption<Integer> BSP_MAX_SUPER_STEP =
- new ConfigOption<>(
- "bsp.max_super_step",
- "The max super step of the algorithm.",
- positiveInt(),
- 10
- );
-
- public static final ConfigOption<String> BSP_ETCD_ENDPOINTS =
- new ConfigOption<>(
- "bsp.etcd_endpoints",
- "The end points to access etcd.",
- disallowEmpty(),
- "http://localhost:2379"
- );
-
- public static final ConfigOption<Long> BSP_REGISTER_TIMEOUT =
- new ConfigOption<>(
- "bsp.register_timeout",
- "The max timeout to wait for master and works to register.",
- positiveInt(),
- TimeUnit.MINUTES.toMillis(5L)
- );
-
- public static final ConfigOption<Long> BSP_WAIT_WORKERS_TIMEOUT =
- new ConfigOption<>(
- "bsp.wait_workers_timeout",
- "The max timeout to wait for workers bsp event.",
- positiveInt(),
- TimeUnit.HOURS.toMillis(24L)
- );
-
- public static final ConfigOption<Long> BSP_WAIT_MASTER_TIMEOUT =
- new ConfigOption<>(
- "bsp.wait_master_timeout",
- "The max timeout(in ms) to wait for master bsp event.",
- positiveInt(),
- TimeUnit.HOURS.toMillis(24L)
- );
-
- public static final ConfigOption<Long> BSP_LOG_INTERVAL =
- new ConfigOption<>(
- "bsp.log_interval",
- "The log interval(in ms) to print the log while " +
- "waiting bsp event.",
- positiveInt(),
- TimeUnit.SECONDS.toMillis(30L)
- );
-
- public static final ConfigOption<Class<?>> WORKER_PARTITIONER =
- new ConfigOption<>(
- "worker.partitioner",
- "The partitioner that decides which partition a vertex " +
- "should be in, and which worker a partition should be in.",
- disallowEmpty(),
- loadClass("org.apache.hugegraph.computer.core.graph.partition.HashPartitioner")
- );
-
- public static final ConfigOption<Class<?>> WORKER_COMPUTATION_CLASS =
- new ConfigOption<>(
- "worker.computation_class",
- "The class to create worker-computation object, " +
- "worker-computation is used to compute each vertex " +
- "in each superstep.",
- disallowEmpty(),
- Null.class
- );
-
- public static final ConfigOption<Class<?>> WORKER_COMBINER_CLASS =
- new ConfigOption<>(
- "worker.combiner_class",
- "Combiner can combine messages into one value for a " +
- "vertex, for example page-rank algorithm can combine " +
- "messages of a vertex to a sum value.",
- disallowEmpty(),
- Null.class
- );
-
- public static final ConfigOption<Class<?>>
- WORKER_VERTEX_PROPERTIES_COMBINER_CLASS =
- new ConfigOption<>(
- "worker.vertex_properties_combiner_class",
- "The combiner can combine several properties of the same " +
- "vertex into one properties at inputstep.",
- disallowEmpty(),
- OverwritePropertiesCombiner.class
- );
-
- public static final ConfigOption<Class<?>>
- WORKER_EDGE_PROPERTIES_COMBINER_CLASS =
- new ConfigOption<>(
- "worker.edge_properties_combiner_class",
- "The combiner can combine several properties of the same " +
- "edge into one properties at inputstep.",
- disallowEmpty(),
- OverwritePropertiesCombiner.class
- );
-
- public static final ConfigOption<Long> WORKER_RECEIVED_BUFFERS_BYTES_LIMIT =
- new ConfigOption<>(
- "worker.received_buffers_bytes_limit",
- "The limit bytes of buffers of received data, " +
- "the total size of all buffers can't excess this limit. " +
- "If received buffers reach this limit, they will be " +
- "merged into a file.",
- positiveInt(),
- 100 * Bytes.MB
- );
-
- public static final ConfigOption<Long> WORKER_WAIT_SORT_TIMEOUT =
- new ConfigOption<>(
- "worker.wait_sort_timeout",
- "The max timeout(in ms) message-handler wait for " +
- "sort-thread to sort one batch of buffers.",
- positiveInt(),
- TimeUnit.MINUTES.toMillis(10)
- );
-
- public static final ConfigOption<Long> WORKER_WAIT_FINISH_MESSAGES_TIMEOUT =
- new ConfigOption<>(
- "worker.wait_finish_messages_timeout",
- "The max timeout(in ms) message-handler wait for " +
- "finish-message of all workers.",
- positiveInt(),
- TimeUnit.HOURS.toMillis(24)
- );
-
- public static final ConfigListOption<String> WORKER_DATA_DIRS =
- new ConfigListOption<>(
- "worker.data_dirs",
- true,
- "The directories separated by ',' that received " +
- "vertices and messages can persist into.",
- disallowEmpty(),
- String.class,
- ImmutableList.of("jobs")
- );
-
- public static final ConfigOption<Integer> WORKER_WRITE_BUFFER_THRESHOLD =
- new ConfigOption<>(
- "worker.write_buffer_threshold",
- "The threshold of write buffer, exceeding it will " +
- "trigger sorting, the write buffer is used to store " +
- "vertex or message.",
- positiveInt(),
- (int) (50 * Bytes.MB)
- );
-
- public static final ConfigOption<Integer>
- WORKER_WRITE_BUFFER_INIT_CAPACITY = new ConfigOption<>(
- "worker.write_buffer_capacity",
- "The initial size of write buffer that used to store " +
- "vertex or message.",
- positiveInt(),
- (int) (50 * Bytes.MB)
- );
-
- public static final ConfigOption<Class<?>> MASTER_COMPUTATION_CLASS =
- new ConfigOption<>(
- "master.computation_class",
- "Master-computation is computation that can determine " +
- "whether to continue next superstep. It runs at the end " +
- "of each superstep on master.",
- disallowEmpty(),
- DefaultMasterComputation.class
- );
-
- public static final ConfigOption<String> HUGEGRAPH_URL =
- new ConfigOption<>(
- "hugegraph.url",
- "The hugegraph url to load data and write results back.",
- disallowEmpty(),
- "http://127.0.0.1:8080"
- );
-
- public static final ConfigOption<String> HUGEGRAPH_GRAPH_NAME =
- new ConfigOption<>(
- "hugegraph.name",
- "The graph name to load data and write results back.",
- disallowEmpty(),
- "hugegraph"
- );
-
- public static final ConfigOption<String> HUGEGRAPH_USERNAME =
- new ConfigOption<>(
- "hugegraph.username",
- "The username of graph for authentication.",
- null,
- ""
- );
-
- public static final ConfigOption<String> HUGEGRAPH_PASSWORD =
- new ConfigOption<>(
- "hugegraph.password",
- "The password of graph for authentication.",
- null,
- ""
- );
-
- public static final ConfigOption<String> TRANSPORT_SERVER_HOST =
- new ConfigOption<>(
- "transport.server_host",
- "The server hostname or ip to listen on to transfer data.",
- disallowEmpty(),
- "127.0.0.1"
- );
-
- public static final ConfigOption<Integer> TRANSPORT_SERVER_PORT =
- new ConfigOption<>(
- "transport.server_port",
- "The server port to listen on to transfer data. " +
- "The system will assign a random port if it's set to 0.",
- nonNegativeInt(),
- 0
- );
-
- public static final ConfigOption<Integer> TRANSPORT_SERVER_THREADS =
- new ConfigOption<>(
- "transport.server_threads",
- "The number of transport threads for server.",
- positiveInt(),
- TRANSPORT_DEFAULT_THREADS
- );
-
- public static final ConfigOption<Integer> TRANSPORT_CLIENT_THREADS =
- new ConfigOption<>(
- "transport.client_threads",
- "The number of transport threads for client.",
- positiveInt(),
- TRANSPORT_DEFAULT_THREADS
- );
-
- public static final ConfigOption<Class<?>> TRANSPORT_PROVIDER_CLASS =
- new ConfigOption<>(
- "transport.provider_class",
- "The transport provider, currently only supports Netty.",
- disallowEmpty(),
- loadClass("org.apache.hugegraph.computer.core.network.netty" +
- ".NettyTransportProvider")
- );
-
- public static final ConfigOption<String> TRANSPORT_IO_MODE =
- new ConfigOption<>(
- "transport.io_mode",
- "The network IO Mode, either 'NIO', 'EPOLL', 'AUTO', the " +
- "'AUTO' means selecting the property mode automatically.",
- allowValues("NIO", "EPOLL", "AUTO"),
- "AUTO"
- );
-
- public static final ConfigOption<Boolean> TRANSPORT_EPOLL_LT =
- new ConfigOption<>(
- "transport.transport_epoll_lt",
- "Whether enable EPOLL level-trigger.",
- allowValues(true, false),
- false
- );
-
- public static final ConfigOption<Boolean> TRANSPORT_RECV_FILE_MODE =
- new ConfigOption<>(
- "transport.recv_file_mode",
- "Whether enable receive buffer-file mode, it will " +
- "receive buffer write file from socket by " +
- "zero-copy if enable.",
- allowValues(true, false),
- true
- );
-
- public static final ConfigOption<Boolean> TRANSPORT_TCP_KEEP_ALIVE =
- new ConfigOption<>(
- "transport.tcp_keep_alive",
- "Whether enable TCP keep-alive.",
- allowValues(true, false),
- true
- );
-
- public static final ConfigOption<Integer> TRANSPORT_MAX_SYN_BACKLOG =
- new ConfigOption<>(
- "transport.max_syn_backlog",
- "The capacity of SYN queue on server side, 0 means using " +
- "system default value.",
- nonNegativeInt(),
- 511
- );
-
- public static final ConfigOption<Integer> TRANSPORT_RECEIVE_BUFFER_SIZE =
- new ConfigOption<>(
- "transport.receive_buffer_size",
- "The size of socket receive-buffer in bytes, 0 means " +
- "using system default value.",
- nonNegativeInt(),
- 0
- );
-
- public static final ConfigOption<Integer> TRANSPORT_SEND_BUFFER_SIZE =
- new ConfigOption<>(
- "transport.send_buffer_size",
- "The size of socket send-buffer in bytes, 0 means using " +
- "system default value.",
- nonNegativeInt(),
- // TODO: Test to get an best value
- 0
- );
-
- public static final ConfigOption<Long> TRANSPORT_CLIENT_CONNECT_TIMEOUT =
- new ConfigOption<>(
- "transport.client_connect_timeout",
- "The timeout(in ms) of client connect to server.",
- positiveInt(),
- 3000L
- );
-
- public static final ConfigOption<Long> TRANSPORT_CLOSE_TIMEOUT =
- new ConfigOption<>(
- "transport.close_timeout",
- "The timeout(in ms) of close server or close client.",
- positiveInt(),
- 10_000L
- );
-
- public static final ConfigOption<Long> TRANSPORT_SYNC_REQUEST_TIMEOUT =
- new ConfigOption<>(
- "transport.sync_request_timeout",
- "The timeout(in ms) to wait response after " +
- "sending sync-request.",
- positiveInt(),
- 10_000L
- );
-
- public static final ConfigOption<Long> TRANSPORT_FINISH_SESSION_TIMEOUT =
- new ConfigOption<>(
- "transport.finish_session_timeout",
- "The timeout(in ms) to finish session, " +
- "0 means using (transport.sync_request_timeout * " +
- "transport.max_pending_requests).",
- nonNegativeInt(),
- 0L
- );
-
- public static final ConfigOption<Long> TRANSPORT_WRITE_SOCKET_TIMEOUT =
- new ConfigOption<>(
- "transport.write_socket_timeout",
- "The timeout(in ms) to write data to socket buffer.",
- positiveInt(),
- 3000L
- );
-
- public static final ConfigOption<Integer> TRANSPORT_NETWORK_RETRIES =
- new ConfigOption<>(
- "transport.network_retries",
- "The number of retry attempts for network communication," +
- "if network unstable.",
- nonNegativeInt(),
- 3
- );
-
- public static final ConfigOption<Integer> TRANSPORT_WRITE_BUFFER_HIGH_MARK =
- new ConfigOption<>(
- "transport.write_buffer_high_mark",
- "The high water mark for write buffer in bytes, " +
- "it will trigger the sending unavailable if the number " +
- "of queued bytes > write_buffer_high_mark.",
- nonNegativeInt(),
- 64 * (int) Bytes.MB
- );
-
- public static final ConfigOption<Integer> TRANSPORT_WRITE_BUFFER_LOW_MARK =
- new ConfigOption<>(
- "transport.write_buffer_low_mark",
- "The low water mark for write buffer in bytes, it will " +
- "trigger the sending available if the number of queued " +
- "bytes < write_buffer_low_mark." +
- nonNegativeInt(),
- 32 * (int) Bytes.MB
- );
-
- public static final ConfigOption<Integer> TRANSPORT_MAX_PENDING_REQUESTS =
- new ConfigOption<>(
- "transport.max_pending_requests",
- "The max number of client unreceived ack, " +
- "it will trigger the sending unavailable if the number " +
- "of unreceived ack >= max_pending_requests.",
- positiveInt(),
- 8
- );
-
- public static final ConfigOption<Integer> TRANSPORT_MIN_PENDING_REQUESTS =
- new ConfigOption<>(
- "transport.min_pending_requests",
- "The minimum number of client unreceived ack, " +
- "it will trigger the sending available if the number of " +
- "unreceived ack < min_pending_requests.",
- positiveInt(),
- 6
- );
-
- public static final ConfigOption<Long> TRANSPORT_MIN_ACK_INTERVAL =
- new ConfigOption<>(
- "transport.min_ack_interval",
- "The minimum interval(in ms) of server reply ack.",
- positiveInt(),
- 200L
- );
-
- public static final ConfigOption<Long> TRANSPORT_SERVER_IDLE_TIMEOUT =
- new ConfigOption<>(
- "transport.server_idle_timeout",
- "The max timeout(in ms) of server idle.",
- positiveInt(),
- 360_000L
- );
-
- public static final ConfigOption<Long> TRANSPORT_HEARTBEAT_INTERVAL =
- new ConfigOption<>(
- "transport.heartbeat_interval",
- "The minimum interval(in ms) between heartbeats on " +
- "client side.",
- positiveInt(),
- 20_000L
- );
-
- public static final ConfigOption<Integer>
- TRANSPORT_MAX_TIMEOUT_HEARTBEAT_COUNT =
- new ConfigOption<>(
- "transport.max_timeout_heartbeat_count",
- "The maximum times of timeout heartbeat on client side, " +
- "if the number of timeouts waiting for heartbeat " +
- "response continuously > max_heartbeat_timeouts the " +
- "channel will be closed from client side.",
- positiveInt(),
- 120
- );
-
- public static final ConfigOption<Long> HGKV_MAX_FILE_SIZE =
- new ConfigOption<>(
- "hgkv.max_file_size",
- "The max number of bytes in each hgkv-file.",
- positiveInt(),
- Bytes.GB * 2
- );
-
- public static final ConfigOption<Long> HGKV_DATABLOCK_SIZE =
- new ConfigOption<>(
- "hgkv.max_data_block_size",
- "The max byte size of hgkv-file data block.",
- positiveInt(),
- Bytes.KB * 64
- );
-
- public static final ConfigOption<Integer> HGKV_MERGE_FILES_NUM =
- new ConfigOption<>(
- "hgkv.max_merge_files",
- "The max number of files to merge at one time.",
- positiveInt(),
- // TODO: test if the default value is appropriate.
- 10
- );
-
- public static final ConfigOption<String> HGKV_TEMP_DIR =
- new ConfigOption<>(
- "hgkv.temp_file_dir",
- "This folder is used to store temporary files, temporary " +
- "files will be generated during the file merging process.",
- disallowEmpty(),
- "/tmp/hgkv"
- );
-
- public static final ConfigOption<Long> VALUE_FILE_MAX_SEGMENT_SIZE =
- new ConfigOption<>(
- "valuefile.max_segment_size",
- "The max number of bytes in each segment of value-file.",
- positiveInt(),
- Bytes.GB
- );
-
- public static Set<String> REQUIRED_OPTIONS = ImmutableSet.of(
- );
-
- public static final Set<String> COMPUTER_PROHIBIT_USER_OPTIONS =
- ImmutableSet.of(
- ComputerOptions.BSP_ETCD_ENDPOINTS.name(),
- ComputerOptions.TRANSPORT_SERVER_HOST.name(),
- ComputerOptions.TRANSPORT_SERVER_PORT.name(),
- ComputerOptions.JOB_NAMESPACE.name(),
- ComputerOptions.JOB_ID.name(),
- ComputerOptions.JOB_WORKERS_COUNT.name(),
- ComputerOptions.RPC_SERVER_HOST_NAME,
- ComputerOptions.RPC_SERVER_PORT_NAME,
- ComputerOptions.RPC_REMOTE_URL_NAME
- );
-
- public static final Set<String> COMPUTER_REQUIRED_USER_OPTIONS = ImmutableSet.of(
- ComputerOptions.ALGORITHM_PARAMS_CLASS.name()
- );
-
- private static Class<?> loadClass(String className) {
- try {
- return Class.forName(className);
- } catch (ClassNotFoundException e) {
- LOG.warn("Load class {} failed, use Null.class", className);
- return Null.class;
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Config.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Config.java
deleted file mode 100644
index 5ad986b6..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Config.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-import org.apache.hugegraph.config.ConfigOption;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.config.TypedOption;
-
-public interface Config {
-
- HugeConfig hugeConfig();
-
- <R> R get(TypedOption<?, R> option);
-
- boolean getBoolean(String key, boolean defaultValue);
-
- int getInt(String key, int defaultValue);
-
- long getLong(String key, long defaultValue);
-
- double getDouble(String key, double defaultValue);
-
- String getString(String key, String defaultValue);
-
- <T> T createObject(ConfigOption<Class<?>> clazzOption);
-
- <T> T createObject(ConfigOption<Class<?>> clazzOption,
- boolean requiredNotNull);
-
- Boolean outputVertexAdjacentEdges();
-
- Boolean outputVertexProperties();
-
- Boolean outputEdgeProperties();
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/DefaultConfig.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/DefaultConfig.java
deleted file mode 100644
index 42b3bdf0..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/DefaultConfig.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-import java.util.Map;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.configuration2.MapConfiguration;
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-import org.apache.hugegraph.config.ConfigOption;
-import org.apache.hugegraph.config.HugeConfig;
-import org.apache.hugegraph.config.TypedOption;
-import org.apache.hugegraph.util.E;
-
-public final class DefaultConfig implements Config {
-
- private final HugeConfig allConfig;
- private final HotConfig hotConfig;
-
- public DefaultConfig(Map<String, String> options) {
- this.allConfig = this.parseOptions(options);
- this.hotConfig = this.extractHotConfig(this.allConfig);
- this.checkOptions();
- }
-
- private HugeConfig parseOptions(Map<String, String> options) {
- if (!options.keySet().containsAll(ComputerOptions.REQUIRED_OPTIONS)) {
- E.checkArgument(false,
- "All required options must be setted, " +
- "but missing these %s",
- CollectionUtils.subtract(
- ComputerOptions.REQUIRED_OPTIONS,
- options.keySet()));
- }
- MapConfiguration mapConfig = new MapConfiguration(options);
- return new HugeConfig(mapConfig);
- }
-
- private HotConfig extractHotConfig(HugeConfig allConfig) {
- // Populate high frequency accessed options into HotConfig
- HotConfig hotConfig = new HotConfig();
-
- hotConfig.outputVertexAdjacentEdges(
- allConfig.get(ComputerOptions.OUTPUT_WITH_ADJACENT_EDGES));
- hotConfig.outputVertexProperties(
- allConfig.get(ComputerOptions.OUTPUT_WITH_VERTEX_PROPERTIES));
- hotConfig.outputEdgeProperties(
- allConfig.get(ComputerOptions.OUTPUT_WITH_EDGE_PROPERTIES));
- return hotConfig;
- }
-
- private void checkOptions() {
- int partitionsCount = this.allConfig.get(
- ComputerOptions.JOB_PARTITIONS_COUNT);
- int workersCount = this.allConfig.get(
- ComputerOptions.JOB_WORKERS_COUNT);
- if (partitionsCount < workersCount) {
- throw new ComputerException("The partitions count must be >= " +
- "workers count, but got %s < %s",
- partitionsCount, workersCount);
- }
- }
-
- @Override
- public HugeConfig hugeConfig() {
- return this.allConfig;
- }
-
- @Override
- public <R> R get(TypedOption<?, R> option) {
- return this.allConfig.get(option);
- }
-
- @Override
- public boolean getBoolean(String key, boolean defaultValue) {
- String value = this.allConfig.getString(key);
- if (value == null) {
- return defaultValue;
- } else if (value.equalsIgnoreCase("true")) {
- return true;
- } else if (value.equalsIgnoreCase("false")) {
- return false;
- } else {
- throw new ComputerException(
- "Can't parse boolean value from '%s' for key '%s'",
- value, key);
- }
- }
-
- @Override
- public int getInt(String key, int defaultValue) {
- String value = this.allConfig.getString(key);
- if (value == null) {
- return defaultValue;
- } else {
- try {
- return Integer.parseInt(value);
- } catch (Exception e) {
- throw new ComputerException(
- "Can't parse int value from '%s' for key '%s'",
- value, key);
- }
- }
- }
-
- @Override
- public long getLong(String key, long defaultValue) {
- String value = this.allConfig.getString(key);
- if (value == null) {
- return defaultValue;
- } else {
- try {
- return Long.parseLong(value);
- } catch (Exception e) {
- throw new ComputerException(
- "Can't parse long value from '%s' for key '%s'",
- value, key);
- }
- }
- }
-
- @Override
- public double getDouble(String key, double defaultValue) {
- String value = this.allConfig.getString(key);
- if (value == null) {
- return defaultValue;
- } else {
- try {
- return Double.parseDouble(value);
- } catch (Exception e) {
- throw new ComputerException(
- "Can't parse double value from '%s' for key '%s'",
- value, key);
- }
- }
- }
-
- @Override
- public String getString(String key, String defaultValue) {
- return this.allConfig.getString(key, defaultValue);
- }
-
- /**
- * Create object by class option.
- * It throws ComputerException if failed to create object.
- */
- @Override
- public <T> T createObject(ConfigOption<Class<?>> clazzOption) {
- return this.createObject(clazzOption, true);
- }
-
- @Override
- public <T> T createObject(ConfigOption<Class<?>> clazzOption,
- boolean requiredNotNull) {
- Class<?> clazz = this.get(clazzOption);
- if (clazz == Null.class) {
- if (requiredNotNull) {
- throw new ComputerException(
- "Please config required option '%s'", clazzOption.name());
- }
- return null;
- }
- try {
- @SuppressWarnings("unchecked")
- T instance = (T) clazz.newInstance();
- return instance;
- } catch (Exception e) {
- throw new ComputerException("Failed to create object for option " +
- "'%s', class='%s'",
- e, clazzOption.name(), clazz.getName());
- }
- }
-
- @Override
- public Boolean outputVertexAdjacentEdges() {
- return this.hotConfig.outputVertexAdjacentEdges();
- }
-
- @Override
- public Boolean outputVertexProperties() {
- return this.hotConfig.outputVertexProperties();
- }
-
- @Override
- public Boolean outputEdgeProperties() {
- return this.hotConfig.outputEdgeProperties();
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/EdgeFrequency.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/EdgeFrequency.java
deleted file mode 100644
index fb903dd5..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/EdgeFrequency.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-/**
- * The frequency of edges can exist between two vertices
- */
-public enum EdgeFrequency {
-
- /**
- * Only one edge can exist between two vertices,
- * use sourceId + targetId to identify it.
- */
- SINGLE,
-
- /**
- * Each edge label can exist one edge between two vertices ,
- * use sourceId + edgelabel + targetId to identify it.
- */
- SINGLE_PER_LABEL,
-
- /**
- * Multiple edge can exist between two vertices,
- * use sourceId + edgelabel + sortValues + targetId to identify it.
- */
- MULTIPLE
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/HotConfig.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/HotConfig.java
deleted file mode 100644
index 25a60cd0..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/HotConfig.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-public final class HotConfig {
-
- private boolean outputVertexAdjacentEdges;
- private boolean outputVertexProperties;
- private boolean outputEdgeProperties;
-
- public boolean outputVertexAdjacentEdges() {
- return this.outputVertexAdjacentEdges;
- }
-
- public void outputVertexAdjacentEdges(boolean outputVertexAdjacentEdges) {
- this.outputVertexAdjacentEdges = outputVertexAdjacentEdges;
- }
-
- public boolean outputVertexProperties() {
- return this.outputVertexProperties;
- }
-
- public void outputVertexProperties(boolean outputVertexProperties) {
- this.outputVertexProperties = outputVertexProperties;
- }
-
- public boolean outputEdgeProperties() {
- return this.outputEdgeProperties;
- }
-
- public void outputEdgeProperties(boolean outputEdgeProperties) {
- this.outputEdgeProperties = outputEdgeProperties;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Null.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Null.java
deleted file mode 100644
index f42724d1..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/config/Null.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.config;
-
-import org.apache.hugegraph.config.ConfigOption;
-
-/**
- * Null is used in ConfigOption<Class> to indicate a null class option.
- * The config does not allow the default value null, so this is used as the
- * default class value when class option can be null.
- * {@link Config#createObject(ConfigOption)} will return null, if the value
- * is ${@code Null.class}".
- */
-public class Null {
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/GraphFactory.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/GraphFactory.java
deleted file mode 100644
index 199f40fe..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/GraphFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.edge.Edges;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-
-public interface GraphFactory {
-
- Id createId();
-
- Id createId(long id);
-
- Id createId(String id);
-
- Id createId(UUID id);
-
- Vertex createVertex();
-
- <V extends Value> Vertex createVertex(Id id, V value);
-
- <V extends Value> Vertex createVertex(String label, Id id, V value);
-
- Edges createEdges();
-
- Edges createEdges(int capacity);
-
- Edge createEdge();
-
- Edge createEdge(Id targetId);
-
- Edge createEdge(String label, Id targetId);
-
- Edge createEdge(String label, String name, Id targetId);
-
- Properties createProperties();
-
- <V> List<V> createList();
-
- <V> List<V> createList(int capacity);
-
- <V> Set<V> createSet();
-
- <V> Set<V> createSet(int size);
-
- <K, V> Map<K, V> createMap();
-
- Value createValue(byte code);
-
- Value createValue(ValueType type);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edge.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edge.java
deleted file mode 100644
index b59e681d..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edge.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.edge;
-
-import org.apache.hugegraph.computer.core.allocator.Recyclable;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-
-public interface Edge extends Recyclable {
-
- String label();
-
- void label(String label);
-
- String name();
-
- void name(String name);
-
- Id targetId();
-
- void targetId(Id targetId);
-
- Properties properties();
-
- void properties(Properties properties);
-
- <T extends Value> T property(String key);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edges.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edges.java
deleted file mode 100644
index 4f73d650..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/edge/Edges.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.edge;
-
-public interface Edges extends Iterable<Edge> {
-
- int size();
-
- void add(Edge edge);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/Id.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/Id.java
deleted file mode 100644
index e4f6ac98..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/Id.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.id;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-
-public interface Id extends Tvalue<Object> {
-
- IdType idType();
-
- int length();
-
- Object asObject();
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/IdFactory.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/IdFactory.java
deleted file mode 100644
index 106873d6..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/id/IdFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.id;
-
-import static org.apache.hugegraph.computer.algorithm.AlgorithmParams.BYTESID_CLASS_NAME;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.UUID;
-
-import org.apache.hugegraph.computer.core.common.Constants;
-import org.apache.hugegraph.computer.core.common.SerialEnum;
-import org.apache.hugegraph.computer.core.common.exception.ComputerException;
-
-public final class IdFactory {
-
- private static final Constructor<?> BYTES_ID_CONSTRUCTOR;
- private static final Method BYTES_ID_LONG_METHOD;
- private static final Method BYTES_ID_STRING_METHOD;
- private static final Method BYTES_ID_UUID_METHOD;
-
- private static final UUID EMPTY_UUID = new UUID(0L, 0L);
-
- static {
- try {
- Class<?> bytesIdClass = Class.forName(BYTESID_CLASS_NAME);
-
- BYTES_ID_CONSTRUCTOR = bytesIdClass.getDeclaredConstructor();
- BYTES_ID_CONSTRUCTOR.setAccessible(true);
-
- BYTES_ID_LONG_METHOD = bytesIdClass.getMethod("of", long.class);
- BYTES_ID_LONG_METHOD.setAccessible(false);
-
- BYTES_ID_STRING_METHOD = bytesIdClass.getMethod("of", String.class);
- BYTES_ID_STRING_METHOD.setAccessible(false);
-
- BYTES_ID_UUID_METHOD = bytesIdClass.getMethod("of", UUID.class);
- BYTES_ID_UUID_METHOD.setAccessible(false);
- } catch (Throwable e) {
- throw new ComputerException("Failed to reflection BytesId method", e);
- }
- }
-
- // Maybe can reuse Id
- public static Id createId(byte code) {
- IdType type = SerialEnum.fromCode(IdType.class, code);
- return createId(type);
- }
-
- public static Id createId(IdType type) {
- try {
- switch (type) {
- case LONG:
- return (Id) BYTES_ID_LONG_METHOD.invoke(null, 0L);
- case UTF8:
- return (Id) BYTES_ID_STRING_METHOD.invoke(null, Constants.EMPTY_STR);
- case UUID:
- return (Id) BYTES_ID_UUID_METHOD.invoke(null, EMPTY_UUID);
- default:
- throw new ComputerException("Can't create Id for %s",
- type.name());
- }
- } catch (Exception e) {
- throw new ComputerException("Failed to createId", e);
- }
- }
-
- public static Id parseId(IdType type, Object value) {
- try {
- switch (type) {
- case LONG:
- return (Id) BYTES_ID_LONG_METHOD.invoke(null, value);
- case UTF8:
- return (Id) BYTES_ID_STRING_METHOD.invoke(null, value);
- case UUID:
- return (Id) BYTES_ID_UUID_METHOD.invoke(null, value);
- default:
- throw new ComputerException("Unexpected id type %s", type.name());
- }
- } catch (Exception e) {
- throw new ComputerException("Failed to parse %s Id: '%s'", e, type, value);
- }
- }
-
- public static Id createId() {
- try {
- return (Id) BYTES_ID_CONSTRUCTOR.newInstance();
- } catch (Exception e) {
- throw new ComputerException("Can't create Id for %s");
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/DefaultProperties.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/DefaultProperties.java
deleted file mode 100644
index b88a0108..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/DefaultProperties.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.properties;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.hugegraph.computer.core.common.SerialEnum;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.value.ValueType;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class DefaultProperties implements Properties {
-
- private final Map<String, Value> keyValues;
- private final GraphFactory graphFactory;
-
- public DefaultProperties(GraphFactory graphFactory) {
- this(graphFactory.createMap(), graphFactory);
- }
-
- public DefaultProperties(Map<String, Value> keyValues,
- GraphFactory graphFactory) {
- this.keyValues = keyValues;
- this.graphFactory = graphFactory;
- }
-
- @Override
- public Map<String, Value> get() {
- return Collections.unmodifiableMap(this.keyValues);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T extends Value> T get(String key) {
- return (T) this.keyValues.get(key);
- }
-
- @Override
- public void put(String key, Value value) {
- this.keyValues.put(key, value);
- }
-
- @Override
- public void putIfAbsent(String key, Value value) {
- this.keyValues.putIfAbsent(key, value);
- }
-
- @Override
- public void putAll(Map<String, Value> kvs) {
- this.keyValues.putAll(kvs);
- }
-
- public int size() {
- return this.keyValues.size();
- }
-
- @Override
- public void clear() {
- this.keyValues.clear();
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.keyValues.clear();
- int size = in.readInt();
- for (int i = 0; i < size; i++) {
- String key = in.readUTF();
- ValueType valueType = SerialEnum.fromCode(ValueType.class,
- in.readByte());
- Value value = this.graphFactory.createValue(valueType);
- value.read(in);
- this.keyValues.put(key, value);
- }
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeInt(this.keyValues.size());
- for (Map.Entry<String, Value> entry : this.keyValues.entrySet()) {
- out.writeUTF(entry.getKey());
- Value value = entry.getValue();
- out.writeByte(value.valueType().code());
- value.write(out);
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof DefaultProperties)) {
- return false;
- }
- DefaultProperties other = (DefaultProperties) obj;
- return this.keyValues.equals(other.keyValues);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(this.keyValues);
- }
-
- @Override
- public String toString() {
- return String.format("DefaultProperties{keyValues=%s}",
- this.keyValues);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/Properties.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/Properties.java
deleted file mode 100644
index d7f12894..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/properties/Properties.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.properties;
-
-import java.util.Map;
-
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.io.Readable;
-import org.apache.hugegraph.computer.core.io.Writable;
-
-public interface Properties extends Readable, Writable {
-
- Map<String, Value> get();
-
- <T extends Value> T get(String key);
-
- void put(String key, Value value);
-
- void putIfAbsent(String key, Value value);
-
- void putAll(Map<String, Value> kvs);
-
- int size();
-
- void clear();
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/BooleanValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/BooleanValue.java
deleted file mode 100644
index 2e68ea49..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/BooleanValue.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class BooleanValue implements Tvalue<Boolean> {
-
- private boolean value;
-
- public BooleanValue() {
- this(false);
- }
-
- public BooleanValue(boolean value) {
- this.value = value;
- }
-
- public boolean boolValue() {
- return this.value;
- }
-
- @Override
- public Boolean value() {
- return this.value;
- }
-
- /*
- * This method is reserved for performance, otherwise it will create a new
- * IntValue object when change it's value.
- */
- public void value(boolean value) {
- this.value = value;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.BOOLEAN;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.value = ((BooleanValue) other).value;
- }
-
- @Override
- public BooleanValue copy() {
- return new BooleanValue(this.value);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.value = in.readBoolean();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeBoolean(this.value);
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- return Boolean.compare(this.value, ((BooleanValue) obj).value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof BooleanValue)) {
- return false;
- }
- return ((BooleanValue) obj).value == this.value;
- }
-
- @Override
- public int hashCode() {
- return Boolean.hashCode(this.value);
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.value);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/DoubleValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/DoubleValue.java
deleted file mode 100644
index f55e19ba..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/DoubleValue.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class DoubleValue extends Number implements Tvalue<Double> {
-
- private static final long serialVersionUID = -524902178200973565L;
-
- private double value;
-
- public DoubleValue() {
- this(0.0D);
- }
-
- public DoubleValue(double value) {
- this.value = value;
- }
-
- @Override
- public int intValue() {
- return (int) this.value;
- }
-
- @Override
- public long longValue() {
- return (long) this.value;
- }
-
- @Override
- public float floatValue() {
- return (float) this.value;
- }
-
- @Override
- public double doubleValue() {
- return this.value;
- }
-
- @Override
- public Double value() {
- return this.value;
- }
-
- /*
- * This method is reserved for performance, otherwise it will create a new
- * DoubleValue object when change it's value.
- */
- public void value(double value) {
- this.value = value;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.DOUBLE;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.value = ((DoubleValue) other).value;
- }
-
- @Override
- public DoubleValue copy() {
- return new DoubleValue(this.value);
- }
-
- @Override
- public boolean isNumber() {
- return true;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.value = in.readDouble();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeDouble(this.value);
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- return Double.compare(this.value, ((DoubleValue) obj).value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof DoubleValue)) {
- return false;
- }
- return ((DoubleValue) obj).value == this.value;
- }
-
- @Override
- public int hashCode() {
- return Double.hashCode(this.value);
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.value);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdList.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdList.java
deleted file mode 100644
index 16f009bb..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdList.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class IdList extends ListValue<Id> {
-
- public IdList() {
- super(ValueType.ID);
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.ID_LIST;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.read(in, false);
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.write(out, false);
- }
-
- @Override
- public IdList copy() {
- IdList values = new IdList();
- for (Id value : this.values()) {
- values.add((Id) value.copy());
- }
- return values;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdSet.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdSet.java
deleted file mode 100644
index 9e90ad23..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IdSet.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-
-public class IdSet implements Value.Tvalue<Set<Id>> {
-
- private final GraphFactory graphFactory;
- private Set<Id> values;
-
- public IdSet() {
- this.graphFactory = ComputerContext.instance().graphFactory();
- this.values = this.graphFactory.createSet();
- }
-
- public void add(Id id) {
- this.values.add(id);
- }
-
- public void addAll(IdSet other) {
- this.values.addAll(other.values);
- }
-
- public void addAll(Collection<Id> other) {
- this.values.addAll(other);
- }
-
- public boolean contains(Id id) {
- return this.values.contains(id);
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.ID_SET;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.values = ((IdSet) other).value();
- }
-
- @Override
- public IdSet copy() {
- IdSet values = new IdSet();
- for (Id value : this.values) {
- values.add((Id) value.copy());
- }
- return values;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- int size = in.readInt();
- if (size > this.values.size() || size < this.values.size() / 2) {
- this.values = this.graphFactory.createSet(size);
- } else {
- this.values.clear();
- }
-
- for (int i = 0; i < size; i++) {
- Id id = this.graphFactory.createId();
- id.read(in);
- this.values.add(id);
- }
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeInt(this.values.size());
- for (Id id : this.values) {
- id.write(out);
- }
- }
-
- @Override
- public Set<Id> value() {
- return Collections.unmodifiableSet(this.values);
- }
-
- @Override
- public int compareTo(Value o) {
- throw new UnsupportedOperationException("compareTo");
- }
-
- public int size() {
- return this.values.size();
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IntValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IntValue.java
deleted file mode 100644
index bab4ba53..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/IntValue.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class IntValue extends Number implements Tvalue<Integer> {
-
- private static final long serialVersionUID = -2014388310992178979L;
-
- private int value;
-
- public IntValue() {
- this(0);
- }
-
- public IntValue(int value) {
- this.value = value;
- }
-
- @Override
- public int intValue() {
- return this.value;
- }
-
- @Override
- public long longValue() {
- return this.value;
- }
-
- @Override
- public float floatValue() {
- return this.value;
- }
-
- @Override
- public double doubleValue() {
- return this.value;
- }
-
- @Override
- public Integer value() {
- return this.value;
- }
-
- /*
- * This method is reserved for performance, otherwise it will create a new
- * IntValue object when change it's value.
- */
- public void value(int value) {
- this.value = value;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.INT;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.value = ((IntValue) other).value;
- }
-
- @Override
- public IntValue copy() {
- return new IntValue(this.value);
- }
-
- @Override
- public boolean isNumber() {
- return true;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.value = in.readInt();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeInt(this.value);
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- return Integer.compare(this.value, ((IntValue) obj).value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof IntValue)) {
- return false;
- }
- return ((IntValue) obj).value == this.value;
- }
-
- @Override
- public int hashCode() {
- return Integer.hashCode(this.value);
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.value);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ListValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ListValue.java
deleted file mode 100644
index 268929dd..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ListValue.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.ListUtils;
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.common.SerialEnum;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class ListValue<T extends Tvalue<?>> implements Tvalue<List<Object>> {
-
- private final GraphFactory graphFactory;
- private ValueType elemType;
- private List<T> values;
-
- public ListValue() {
- this(ValueType.UNKNOWN);
- }
-
- public ListValue(ValueType elemType) {
- this(elemType, new ArrayList<>());
- }
-
- public ListValue(ValueType elemType, List<T> values) {
- this.elemType = elemType;
- this.values = values;
- // TODO: try to reduce call ComputerContext.instance() directly.
- this.graphFactory = ComputerContext.instance().graphFactory();
- }
-
- public void checkAndSetType(T value) {
- E.checkArgument(value != null,
- "Can't add null to %s", this.valueType().string());
- if (this.elemType != ValueType.UNKNOWN) {
- E.checkArgument(this.elemType == value.valueType(),
- "Invalid value '%s' with type %s, " +
- "expect element with type %s",
- value, value.valueType().string(),
- this.elemType.string());
- } else {
- this.elemType = value.valueType();
- }
- }
-
- public void add(T value) {
- this.checkAndSetType(value);
- this.values.add(value);
- }
-
- public void addAll(Collection<T> values) {
- if (CollectionUtils.isEmpty(values)) {
- return;
- }
-
- Iterator<T> iterator = values.iterator();
- T firstValue = iterator.next();
- this.checkAndSetType(firstValue);
- this.values.addAll(values);
- }
-
- public T get(int index) {
- return this.values.get(index);
- }
-
- public T getFirst() {
- if (this.values.size() == 0) {
- throw new NoSuchElementException("The list is empty");
- }
- return this.values.get(0);
- }
-
- public T getLast() {
- int index = this.values.size() - 1;
- if (index < 0) {
- throw new NoSuchElementException("The list is empty");
- }
- return this.values.get(index);
- }
-
- public boolean contains(T obj) {
- return this.values.contains(obj);
- }
-
- public List<T> values() {
- return Collections.unmodifiableList(this.values);
- }
-
- public int size() {
- return this.values.size();
- }
-
- public void clear() {
- this.values.clear();
- }
-
- @Override
- public List<Object> value() {
- List<Object> list = new ArrayList<>(this.values.size());
- for (T value : this.values) {
- list.add(value.value());
- }
- return list;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.LIST_VALUE;
- }
-
- public ValueType elemType() {
- return this.elemType;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void assign(Value other) {
- this.checkAssign(other);
- ValueType elemType = ((ListValue<T>) other).elemType();
- E.checkArgument(elemType == this.elemType(),
- "Can't assign %s<%s> to %s<%s>",
- other.valueType().string(), elemType.string(),
- this.valueType().string(), this.elemType().string());
- this.values = ((ListValue<T>) other).values();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public ListValue<T> copy() {
- List<T> values = this.graphFactory.createList();
- for (T value : this.values) {
- values.add((T) value.copy());
- }
- return new ListValue<>(this.elemType, values);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.read(in, true);
- }
-
- protected void read(RandomAccessInput in, boolean readElemType) throws IOException {
- int size = in.readInt();
- if (readElemType) {
- this.elemType = SerialEnum.fromCode(ValueType.class, in.readByte());
- }
- if (size > this.values.size() || size < this.values.size() / 2) {
- this.values = this.graphFactory.createList(size);
- } else {
- this.values.clear();
- }
-
- for (int i = 0; i < size; i++) {
- @SuppressWarnings("unchecked")
- T value = (T) this.graphFactory.createValue(this.elemType);
- value.read(in);
- this.values.add(value);
- }
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.write(out, true);
- }
-
- protected void write(RandomAccessOutput out, boolean writeElemType) throws IOException {
- out.writeInt(this.values.size());
- if (writeElemType) {
- out.writeByte(this.elemType.code());
- }
- for (T value : this.values) {
- value.write(out);
- }
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- @SuppressWarnings("unchecked")
- ListValue<T> other = (ListValue<T>) obj;
- int cmp = this.size() - other.size();
- if (cmp != 0) {
- return cmp;
- }
- for (int i = 0; i < this.size(); i++) {
- Tvalue<?> self = this.values.get(i);
- cmp = self.compareTo(other.values.get(i));
- if (cmp != 0) {
- return cmp;
- }
- }
- return 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof ListValue)) {
- return false;
- }
- @SuppressWarnings("unchecked")
- ListValue<T> other = (ListValue<T>) obj;
- if (this.elemType != other.elemType) {
- return false;
- }
- return ListUtils.isEqualList(this.values, other.values);
- }
-
- @Override
- public int hashCode() {
- return ListUtils.hashCodeForList(this.values);
- }
-
- @Override
- public String toString() {
- return this.values.toString();
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/LongValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/LongValue.java
deleted file mode 100644
index 9ffc0151..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/LongValue.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class LongValue extends Number implements Tvalue<Long> {
-
- private static final long serialVersionUID = 8332327679205404212L;
-
- private long value;
-
- public LongValue() {
- this(0L);
- }
-
- public LongValue(long value) {
- this.value = value;
- }
-
- @Override
- public int intValue() {
- return (int) this.value;
- }
-
- @Override
- public long longValue() {
- return this.value;
- }
-
- @Override
- public float floatValue() {
- return this.value;
- }
-
- @Override
- public double doubleValue() {
- return this.value;
- }
-
- @Override
- public Long value() {
- return this.value;
- }
-
- /*
- * This method is reserved for performance, otherwise it will create a new
- * LongValue object when change it's value.
- */
- public void value(long value) {
- this.value = value;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.LONG;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.value = ((LongValue) other).value;
- }
-
- @Override
- public LongValue copy() {
- return new LongValue(this.value);
- }
-
- @Override
- public boolean isNumber() {
- return true;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.value = in.readLong();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeLong(this.value);
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- return Long.compare(this.value, ((LongValue) obj).value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LongValue)) {
- return false;
- }
- return ((LongValue) obj).value == this.value;
- }
-
- @Override
- public int hashCode() {
- return Long.hashCode(this.value);
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.value);
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/MapValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/MapValue.java
deleted file mode 100644
index d9784785..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/MapValue.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.hugegraph.computer.core.common.ComputerContext;
-import org.apache.hugegraph.computer.core.common.SerialEnum;
-import org.apache.hugegraph.computer.core.graph.GraphFactory;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class MapValue<T extends Value> implements Value {
-
- private final GraphFactory graphFactory;
-
- private ValueType elemType;
- private Map<Id, T> map;
-
- public MapValue() {
- this(ValueType.UNKNOWN);
- }
-
- public MapValue(ValueType elemType) {
- this(elemType, new HashMap<>());
- }
-
- public MapValue(ValueType elemType, Map<Id, T> map) {
- this.graphFactory = ComputerContext.instance().graphFactory();
- this.elemType = elemType;
- this.map = map;
- }
-
- public void put(Id id, T value) {
- E.checkArgument(id != null, "Can't add null key to %s",
- this.valueType().string());
- E.checkArgument(value != null, "Can't add null value to %s",
- this.valueType().string());
- if (this.elemType != ValueType.UNKNOWN) {
- E.checkArgument(this.elemType == value.valueType(),
- "Invalid value '%s' with type %s, " +
- "expect element with type %s",
- value, value.valueType().string(),
- this.elemType.string());
- } else {
- this.elemType = value.valueType();
- }
- this.map.put(id, value);
- }
-
- public T get(Id id) {
- return this.map.get(id);
- }
-
- public Set<Map.Entry<Id, T>> entrySet() {
- return this.map.entrySet();
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.MAP_VALUE;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void assign(Value other) {
- this.checkAssign(other);
- ValueType elemType = ((MapValue<T>) other).elemType();
- E.checkArgument(elemType == this.elemType(),
- "Can't assign %s<%s> to %s<%s>",
- other.valueType().string(), elemType.string(),
- this.valueType().string(), this.elemType().string());
- this.map = ((MapValue<T>) other).map;
- }
-
- public ValueType elemType() {
- return this.elemType;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Value copy() {
- Map<Id, T> map = new HashMap<>();
- for (Map.Entry<Id, T> entry : this.map.entrySet()) {
- map.put(entry.getKey(), (T) entry.getValue().copy());
- }
- return new MapValue<>(this.elemType, map);
- }
-
- @Override
- public Object value() {
- return this.map;
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.read(in, true);
- }
-
- protected void read(RandomAccessInput in, boolean readElemType)
- throws IOException {
- int size = in.readInt();
- if (readElemType) {
- this.elemType = SerialEnum.fromCode(ValueType.class, in.readByte());
- }
- this.map = this.graphFactory.createMap();
-
- for (int i = 0; i < size; i++) {
- Id id = this.graphFactory.createId();
- id.read(in);
- @SuppressWarnings("unchecked")
- T value = (T) this.graphFactory.createValue(this.elemType);
- value.read(in);
- this.map.put(id, value);
- }
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- this.write(out, true);
- }
-
- protected void write(RandomAccessOutput out, boolean writeElemType)
- throws IOException {
- out.writeInt(this.map.size());
- if (writeElemType) {
- out.writeByte(this.elemType.code());
- }
- for (Map.Entry<Id, T> entry : this.map.entrySet()) {
- Id id = entry.getKey();
- T value = entry.getValue();
- id.write(out);
- value.write(out);
- }
- }
-
- @Override
- public int compareTo(Value obj) {
- throw new UnsupportedOperationException("MapValue.compareTo()");
- }
-
- @Override
- public String string() {
- return "MapValue{elemType=" + this.elemType + ", map=" + this.map + "}";
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/NullValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/NullValue.java
deleted file mode 100644
index d3eb872d..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/NullValue.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class NullValue implements Tvalue<Void> {
-
- private static final NullValue INSTANCE = new NullValue();
-
- private NullValue() {
- }
-
- /*
- * Returns the single instance of this class.
- */
- public static NullValue get() {
- return INSTANCE;
- }
-
- @Override
- public Void value() {
- return null;
- }
-
- @Override
- public String string() {
- return "";
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.NULL;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- }
-
- @Override
- public NullValue copy() {
- return this;
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- // pass
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- // pass
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- assert obj instanceof NullValue;
- return 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- return obj == INSTANCE || obj instanceof NullValue;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public String toString() {
- return "<null>";
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/StringValue.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/StringValue.java
deleted file mode 100644
index f5049c23..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/StringValue.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import java.io.IOException;
-
-import org.apache.hugegraph.computer.core.common.Constants;
-import org.apache.hugegraph.computer.core.graph.value.Value.Tvalue;
-import org.apache.hugegraph.computer.core.io.RandomAccessInput;
-import org.apache.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
-
-public class StringValue implements Tvalue<String> {
-
- private String value;
-
- public StringValue() {
- this.value = Constants.EMPTY_STR;
- }
-
- public StringValue(String value) {
- this.value = value;
- }
-
- @Override
- public ValueType valueType() {
- return ValueType.STRING;
- }
-
- @Override
- public void assign(Value other) {
- this.checkAssign(other);
- this.value = ((StringValue) other).value;
- }
-
- @Override
- public StringValue copy() {
- return new StringValue(this.value);
- }
-
- @Override
- public void read(RandomAccessInput in) throws IOException {
- this.value = in.readUTF();
- }
-
- @Override
- public void write(RandomAccessOutput out) throws IOException {
- out.writeUTF(this.value);
- }
-
- @Override
- public int compareTo(Value obj) {
- E.checkArgumentNotNull(obj, "The compare argument can't be null");
- int typeDiff = this.valueType().compareTo(obj.valueType());
- if (typeDiff != 0) {
- return typeDiff;
- }
- return this.value.compareTo(((StringValue) obj).value);
- }
-
- @Override
- public String value() {
- return this.value;
- }
-
- public void value(String value) {
- this.value = value;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof StringValue)) {
- return false;
- }
- return ((StringValue) obj).value.equals(this.value);
- }
-
- @Override
- public int hashCode() {
- return this.value.hashCode();
- }
-
- @Override
- public String toString() {
- return this.value;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/Value.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/Value.java
deleted file mode 100644
index 840bf3ff..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/Value.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import org.apache.hugegraph.computer.core.io.Readable;
-import org.apache.hugegraph.computer.core.io.Writable;
-import org.apache.hugegraph.util.E;
-
-public interface Value extends Writable, Readable, Comparable<Value> {
-
- /**
- * @return the value type of this instance
- */
- ValueType valueType();
-
- /**
- * Assign a new value to this object
- */
- void assign(Value value);
-
- /**
- * @return copy a value instance of this object
- */
- Value copy();
-
- /**
- * @return value of this object
- */
- Object value();
-
- /**
- * Check whether a value can be assigned to this object
- */
- default void checkAssign(Value other) {
- if (other == null) {
- E.checkArgument(false, "Can't assign null to %s",
- this.getClass().getSimpleName());
- } else if (!this.getClass().isAssignableFrom(other.getClass())) {
- E.checkArgument(false, "Can't assign '%s'(%s) to %s",
- other, other.getClass().getSimpleName(),
- this.getClass().getSimpleName());
- }
- }
-
- default boolean isNumber() {
- return false;
- }
-
- /**
- * @return result string value of this object
- */
- default String string() {
- return String.valueOf(this.value());
- }
-
- /**
- * Value class with template parameter for simple subclass extension
- */
- interface Tvalue<T> extends Value {
-
- @Override
- T value();
- }
-
- /**
- * Value class with template parameter for composite subclass extension,
- * A customized Value class of the algorithm may need to extend this class.
- */
- interface CustomizeValue<T> extends Tvalue<T> {
-
- @Override
- default ValueType valueType() {
- return ValueType.CUSTOMIZE_VALUE;
- }
-
- @Override
- default void assign(Value value) {
- throw new UnsupportedOperationException("assign");
- }
-
- @Override
- default Value copy() {
- throw new UnsupportedOperationException("copy");
- }
-
- @Override
- default int compareTo(Value other) {
- throw new UnsupportedOperationException("compareTo");
- }
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ValueType.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ValueType.java
deleted file mode 100644
index 641486a9..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/value/ValueType.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.value;
-
-import org.apache.hugegraph.computer.core.common.SerialEnum;
-
-public enum ValueType implements SerialEnum {
-
- UNKNOWN(-1, -1, "unknown"),
- NULL(1, 0, "null"),
- BOOLEAN(2, 1, "bool"),
- INT(3, 4, "int"),
- LONG(4, 8, "long"),
- FLOAT(5, 4, "float"),
- DOUBLE(6, 8, "double"),
- STRING(7, -1, "string"),
- ID(20, -1, "id"),
- ID_LIST(21, -1, "idList"),
- ID_LIST_LIST(22, -1, "idListList"),
- ID_SET(23, -1, "idSet"),
- LIST_VALUE(30, -1, "list"),
- MAP_VALUE(31, -1, "map"),
- CUSTOMIZE_VALUE(100, -1, "customize");
-
- private final byte code;
- // Length in bytes if it's a fixed value type, -1 means not fixed.
- private final int byteSize;
- // Name of this value type
- private final String name;
-
- static {
- SerialEnum.register(ValueType.class);
- }
-
- ValueType(int code, int byteSize, String name) {
- assert code >= -128 && code <= 127;
- this.code = (byte) code;
- this.byteSize = byteSize;
- this.name = name;
- }
-
- @Override
- public byte code() {
- return this.code;
- }
-
- public int byteSize() {
- return this.byteSize;
- }
-
- public String string() {
- return this.name;
- }
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/vertex/Vertex.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/vertex/Vertex.java
deleted file mode 100644
index a655040f..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/graph/vertex/Vertex.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.graph.vertex;
-
-import org.apache.hugegraph.computer.core.allocator.Recyclable;
-import org.apache.hugegraph.computer.core.graph.edge.Edge;
-import org.apache.hugegraph.computer.core.graph.edge.Edges;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.properties.Properties;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-
-public interface Vertex extends Recyclable {
-
- String label();
-
- void label(String label);
-
- Id id();
-
- void id(Id id);
-
- <V extends Value> V value();
-
- <V extends Value> void value(V value);
-
- int numEdges();
-
- Edges edges();
-
- void edges(Edges edges);
-
- void addEdge(Edge edge);
-
- Properties properties();
-
- void properties(Properties properties);
-
- <T extends Value> T property(String key);
-
- boolean active();
-
- void inactivate();
-
- void reactivate();
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/input/InputFilter.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/input/InputFilter.java
deleted file mode 100644
index bbb174a5..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/input/InputFilter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.input;
-
-import org.apache.hugegraph.structure.graph.Edge;
-import org.apache.hugegraph.structure.graph.Vertex;
-
-/**
- * Filter vertices or edges, user can filter vertices, edges and their
- * properties that meet the criteria as needed
- */
-public interface InputFilter {
-
- Vertex filter(Vertex vertex);
-
- Edge filter(Edge edge);
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesInput.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesInput.java
deleted file mode 100644
index 76df3e8e..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesInput.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.io;
-
-public interface BytesInput extends RandomAccessInput {
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesOutput.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesOutput.java
deleted file mode 100644
index a3e4983a..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/BytesOutput.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.io;
-
-public interface BytesOutput extends RandomAccessOutput {
-
- /**
- * Get the internal bytes buffer
- * @return buffer
- */
- byte[] buffer();
-
- /**
- * Get the actual bytes buffer that contains value, will make a copy
- * @return copied buffer
- */
- byte[] toByteArray();
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeInput.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeInput.java
deleted file mode 100644
index 9691b4be..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeInput.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.hugegraph.computer.core.io;
-
-import java.io.IOException;
-
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.hugegraph.computer.core.graph.id.Id;
-import org.apache.hugegraph.computer.core.graph.value.Value;
-import org.apache.hugegraph.computer.core.graph.vertex.Vertex;
-
-public interface GraphComputeInput extends GraphInput {
-
- Vertex readVertex() throws IOException;
-
- Vertex readEdges() throws IOException;
-
- Pair<Id, Value> readMessage() throws IOException;
-
- Value readValue(RandomAccessInput in) throws IOException;
-}
diff --git a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeOutput.java b/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeOutput.java
deleted file mode 100644
index fe994ae6..00000000
--- a/computer-api/src/main/java/org/apache/hugegraph/computer/core/io/GraphComputeOutput.java
+++ /dev/null
... 111647 lines suppressed ...