@ladybugmem/icebug 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (624) hide show
  1. package/README.md +14 -0
  2. package/binding.gyp +54 -0
  3. package/build/Release/.deps/Release/icebug.node.d +1 -0
  4. package/build/Release/.deps/Release/obj.target/icebug/src/addon.o.d +291 -0
  5. package/build/Release/icebug.node +0 -0
  6. package/build/Release/obj.target/icebug/src/addon.o +0 -0
  7. package/lib/index.d.ts +361 -0
  8. package/lib/index.js +102 -0
  9. package/package.json +42 -0
  10. package/src/addon.cpp +1253 -0
  11. package/vendor/include/networkit/GlobalState.hpp +86 -0
  12. package/vendor/include/networkit/Globals.hpp +41 -0
  13. package/vendor/include/networkit/algebraic/AlgebraicGlobals.hpp +27 -0
  14. package/vendor/include/networkit/algebraic/CSRGeneralMatrix.hpp +1292 -0
  15. package/vendor/include/networkit/algebraic/CSRMatrix.hpp +11 -0
  16. package/vendor/include/networkit/algebraic/DenseMatrix.hpp +537 -0
  17. package/vendor/include/networkit/algebraic/DynamicMatrix.hpp +514 -0
  18. package/vendor/include/networkit/algebraic/GraphBLAS.hpp +323 -0
  19. package/vendor/include/networkit/algebraic/MatrixTools.hpp +156 -0
  20. package/vendor/include/networkit/algebraic/Semirings.hpp +171 -0
  21. package/vendor/include/networkit/algebraic/SparseAccumulator.hpp +111 -0
  22. package/vendor/include/networkit/algebraic/Vector.hpp +371 -0
  23. package/vendor/include/networkit/algebraic/algorithms/AlgebraicBFS.hpp +72 -0
  24. package/vendor/include/networkit/algebraic/algorithms/AlgebraicBellmanFord.hpp +88 -0
  25. package/vendor/include/networkit/algebraic/algorithms/AlgebraicMatchingCoarsening.hpp +96 -0
  26. package/vendor/include/networkit/algebraic/algorithms/AlgebraicPageRank.hpp +145 -0
  27. package/vendor/include/networkit/algebraic/algorithms/AlgebraicSpanningEdgeCentrality.hpp +122 -0
  28. package/vendor/include/networkit/algebraic/algorithms/AlgebraicTriangleCounting.hpp +76 -0
  29. package/vendor/include/networkit/auxiliary/AlignedAllocator.hpp +113 -0
  30. package/vendor/include/networkit/auxiliary/ArrayTools.hpp +85 -0
  31. package/vendor/include/networkit/auxiliary/BloomFilter.hpp +70 -0
  32. package/vendor/include/networkit/auxiliary/BucketPQ.hpp +142 -0
  33. package/vendor/include/networkit/auxiliary/Enforce.hpp +117 -0
  34. package/vendor/include/networkit/auxiliary/FunctionTraits.hpp +74 -0
  35. package/vendor/include/networkit/auxiliary/HashUtils.hpp +28 -0
  36. package/vendor/include/networkit/auxiliary/IncrementalUniformRandomSelector.hpp +52 -0
  37. package/vendor/include/networkit/auxiliary/Log.hpp +119 -0
  38. package/vendor/include/networkit/auxiliary/MissingMath.hpp +48 -0
  39. package/vendor/include/networkit/auxiliary/Multiprecision.hpp +17 -0
  40. package/vendor/include/networkit/auxiliary/NumberParsing.hpp +307 -0
  41. package/vendor/include/networkit/auxiliary/NumericTools.hpp +57 -0
  42. package/vendor/include/networkit/auxiliary/Parallel.hpp +56 -0
  43. package/vendor/include/networkit/auxiliary/Parallelism.hpp +33 -0
  44. package/vendor/include/networkit/auxiliary/PrioQueue.hpp +252 -0
  45. package/vendor/include/networkit/auxiliary/Random.hpp +122 -0
  46. package/vendor/include/networkit/auxiliary/SetIntersector.hpp +72 -0
  47. package/vendor/include/networkit/auxiliary/SignalHandling.hpp +39 -0
  48. package/vendor/include/networkit/auxiliary/SortedList.hpp +128 -0
  49. package/vendor/include/networkit/auxiliary/SparseVector.hpp +215 -0
  50. package/vendor/include/networkit/auxiliary/SpinLock.hpp +23 -0
  51. package/vendor/include/networkit/auxiliary/StringBuilder.hpp +322 -0
  52. package/vendor/include/networkit/auxiliary/StringTools.hpp +76 -0
  53. package/vendor/include/networkit/auxiliary/TemplateUtils.hpp +76 -0
  54. package/vendor/include/networkit/auxiliary/Timer.hpp +145 -0
  55. package/vendor/include/networkit/auxiliary/VectorComparator.hpp +32 -0
  56. package/vendor/include/networkit/base/Algorithm.hpp +41 -0
  57. package/vendor/include/networkit/base/DynAlgorithm.hpp +31 -0
  58. package/vendor/include/networkit/centrality/ApproxBetweenness.hpp +62 -0
  59. package/vendor/include/networkit/centrality/ApproxCloseness.hpp +136 -0
  60. package/vendor/include/networkit/centrality/ApproxElectricalCloseness.hpp +156 -0
  61. package/vendor/include/networkit/centrality/ApproxGroupBetweenness.hpp +124 -0
  62. package/vendor/include/networkit/centrality/ApproxSpanningEdge.hpp +84 -0
  63. package/vendor/include/networkit/centrality/Betweenness.hpp +47 -0
  64. package/vendor/include/networkit/centrality/Centrality.hpp +98 -0
  65. package/vendor/include/networkit/centrality/Closeness.hpp +107 -0
  66. package/vendor/include/networkit/centrality/ComplexPaths.hpp +113 -0
  67. package/vendor/include/networkit/centrality/CoreDecomposition.hpp +161 -0
  68. package/vendor/include/networkit/centrality/DegreeCentrality.hpp +55 -0
  69. package/vendor/include/networkit/centrality/DynApproxBetweenness.hpp +95 -0
  70. package/vendor/include/networkit/centrality/DynBetweenness.hpp +99 -0
  71. package/vendor/include/networkit/centrality/DynBetweennessOneNode.hpp +98 -0
  72. package/vendor/include/networkit/centrality/DynKatzCentrality.hpp +115 -0
  73. package/vendor/include/networkit/centrality/DynTopHarmonicCloseness.hpp +223 -0
  74. package/vendor/include/networkit/centrality/EigenvectorCentrality.hpp +41 -0
  75. package/vendor/include/networkit/centrality/EstimateBetweenness.hpp +51 -0
  76. package/vendor/include/networkit/centrality/ForestCentrality.hpp +112 -0
  77. package/vendor/include/networkit/centrality/GedWalk.hpp +225 -0
  78. package/vendor/include/networkit/centrality/GroupCloseness.hpp +115 -0
  79. package/vendor/include/networkit/centrality/GroupClosenessGrowShrink.hpp +78 -0
  80. package/vendor/include/networkit/centrality/GroupClosenessLocalSearch.hpp +77 -0
  81. package/vendor/include/networkit/centrality/GroupClosenessLocalSwaps.hpp +106 -0
  82. package/vendor/include/networkit/centrality/GroupDegree.hpp +155 -0
  83. package/vendor/include/networkit/centrality/GroupHarmonicCloseness.hpp +83 -0
  84. package/vendor/include/networkit/centrality/HarmonicCloseness.hpp +48 -0
  85. package/vendor/include/networkit/centrality/KPathCentrality.hpp +52 -0
  86. package/vendor/include/networkit/centrality/KadabraBetweenness.hpp +242 -0
  87. package/vendor/include/networkit/centrality/KatzCentrality.hpp +62 -0
  88. package/vendor/include/networkit/centrality/LaplacianCentrality.hpp +44 -0
  89. package/vendor/include/networkit/centrality/LocalClusteringCoefficient.hpp +60 -0
  90. package/vendor/include/networkit/centrality/LocalPartitionCoverage.hpp +43 -0
  91. package/vendor/include/networkit/centrality/LocalSquareClusteringCoefficient.hpp +42 -0
  92. package/vendor/include/networkit/centrality/PageRank.hpp +101 -0
  93. package/vendor/include/networkit/centrality/PermanenceCentrality.hpp +48 -0
  94. package/vendor/include/networkit/centrality/Sfigality.hpp +45 -0
  95. package/vendor/include/networkit/centrality/SpanningEdgeCentrality.hpp +86 -0
  96. package/vendor/include/networkit/centrality/TopCloseness.hpp +136 -0
  97. package/vendor/include/networkit/centrality/TopHarmonicCloseness.hpp +151 -0
  98. package/vendor/include/networkit/clique/MaximalCliques.hpp +83 -0
  99. package/vendor/include/networkit/coarsening/ClusteringProjector.hpp +59 -0
  100. package/vendor/include/networkit/coarsening/CoarsenedGraphView.hpp +156 -0
  101. package/vendor/include/networkit/coarsening/GraphCoarsening.hpp +57 -0
  102. package/vendor/include/networkit/coarsening/MatchingCoarsening.hpp +43 -0
  103. package/vendor/include/networkit/coarsening/ParallelPartitionCoarsening.hpp +33 -0
  104. package/vendor/include/networkit/coarsening/ParallelPartitionCoarseningView.hpp +62 -0
  105. package/vendor/include/networkit/community/AdjustedRandMeasure.hpp +31 -0
  106. package/vendor/include/networkit/community/ClusteringGenerator.hpp +75 -0
  107. package/vendor/include/networkit/community/CommunityDetectionAlgorithm.hpp +58 -0
  108. package/vendor/include/networkit/community/Conductance.hpp +32 -0
  109. package/vendor/include/networkit/community/CoverF1Similarity.hpp +53 -0
  110. package/vendor/include/networkit/community/CoverHubDominance.hpp +38 -0
  111. package/vendor/include/networkit/community/Coverage.hpp +25 -0
  112. package/vendor/include/networkit/community/CutClustering.hpp +62 -0
  113. package/vendor/include/networkit/community/DissimilarityMeasure.hpp +31 -0
  114. package/vendor/include/networkit/community/DynamicNMIDistance.hpp +44 -0
  115. package/vendor/include/networkit/community/EdgeCut.hpp +24 -0
  116. package/vendor/include/networkit/community/GraphClusteringTools.hpp +103 -0
  117. package/vendor/include/networkit/community/GraphStructuralRandMeasure.hpp +28 -0
  118. package/vendor/include/networkit/community/HubDominance.hpp +46 -0
  119. package/vendor/include/networkit/community/IntrapartitionDensity.hpp +44 -0
  120. package/vendor/include/networkit/community/IsolatedInterpartitionConductance.hpp +40 -0
  121. package/vendor/include/networkit/community/IsolatedInterpartitionExpansion.hpp +40 -0
  122. package/vendor/include/networkit/community/JaccardMeasure.hpp +25 -0
  123. package/vendor/include/networkit/community/LFM.hpp +49 -0
  124. package/vendor/include/networkit/community/LPDegreeOrdered.hpp +48 -0
  125. package/vendor/include/networkit/community/LocalCommunityEvaluation.hpp +100 -0
  126. package/vendor/include/networkit/community/LocalCoverEvaluation.hpp +31 -0
  127. package/vendor/include/networkit/community/LocalPartitionEvaluation.hpp +31 -0
  128. package/vendor/include/networkit/community/LouvainMapEquation.hpp +135 -0
  129. package/vendor/include/networkit/community/Modularity.hpp +54 -0
  130. package/vendor/include/networkit/community/NMIDistance.hpp +28 -0
  131. package/vendor/include/networkit/community/NodeStructuralRandMeasure.hpp +27 -0
  132. package/vendor/include/networkit/community/OverlappingCommunityDetectionAlgorithm.hpp +51 -0
  133. package/vendor/include/networkit/community/OverlappingNMIDistance.hpp +175 -0
  134. package/vendor/include/networkit/community/PLM.hpp +89 -0
  135. package/vendor/include/networkit/community/PLP.hpp +83 -0
  136. package/vendor/include/networkit/community/ParallelAgglomerativeClusterer.hpp +37 -0
  137. package/vendor/include/networkit/community/ParallelLeiden.hpp +96 -0
  138. package/vendor/include/networkit/community/ParallelLeidenView.hpp +138 -0
  139. package/vendor/include/networkit/community/PartitionFragmentation.hpp +30 -0
  140. package/vendor/include/networkit/community/PartitionHubDominance.hpp +37 -0
  141. package/vendor/include/networkit/community/PartitionIntersection.hpp +25 -0
  142. package/vendor/include/networkit/community/QualityMeasure.hpp +27 -0
  143. package/vendor/include/networkit/community/SampledGraphStructuralRandMeasure.hpp +40 -0
  144. package/vendor/include/networkit/community/SampledNodeStructuralRandMeasure.hpp +40 -0
  145. package/vendor/include/networkit/community/StablePartitionNodes.hpp +48 -0
  146. package/vendor/include/networkit/components/BiconnectedComponents.hpp +116 -0
  147. package/vendor/include/networkit/components/ComponentDecomposition.hpp +72 -0
  148. package/vendor/include/networkit/components/ConnectedComponents.hpp +55 -0
  149. package/vendor/include/networkit/components/DynConnectedComponents.hpp +71 -0
  150. package/vendor/include/networkit/components/DynWeaklyConnectedComponents.hpp +73 -0
  151. package/vendor/include/networkit/components/ParallelConnectedComponents.hpp +44 -0
  152. package/vendor/include/networkit/components/RandomSpanningForest.hpp +36 -0
  153. package/vendor/include/networkit/components/StronglyConnectedComponents.hpp +50 -0
  154. package/vendor/include/networkit/components/WeaklyConnectedComponents.hpp +59 -0
  155. package/vendor/include/networkit/correlation/Assortativity.hpp +64 -0
  156. package/vendor/include/networkit/distance/APSP.hpp +70 -0
  157. package/vendor/include/networkit/distance/AStar.hpp +68 -0
  158. package/vendor/include/networkit/distance/AStarGeneral.hpp +110 -0
  159. package/vendor/include/networkit/distance/AdamicAdarDistance.hpp +52 -0
  160. package/vendor/include/networkit/distance/AffectedNodes.hpp +130 -0
  161. package/vendor/include/networkit/distance/AlgebraicDistance.hpp +63 -0
  162. package/vendor/include/networkit/distance/BFS.hpp +43 -0
  163. package/vendor/include/networkit/distance/BidirectionalBFS.hpp +51 -0
  164. package/vendor/include/networkit/distance/BidirectionalDijkstra.hpp +69 -0
  165. package/vendor/include/networkit/distance/CommuteTimeDistance.hpp +89 -0
  166. package/vendor/include/networkit/distance/Diameter.hpp +97 -0
  167. package/vendor/include/networkit/distance/Dijkstra.hpp +50 -0
  168. package/vendor/include/networkit/distance/DynAPSP.hpp +67 -0
  169. package/vendor/include/networkit/distance/DynBFS.hpp +56 -0
  170. package/vendor/include/networkit/distance/DynDijkstra.hpp +57 -0
  171. package/vendor/include/networkit/distance/DynPrunedLandmarkLabeling.hpp +67 -0
  172. package/vendor/include/networkit/distance/DynSSSP.hpp +87 -0
  173. package/vendor/include/networkit/distance/Eccentricity.hpp +32 -0
  174. package/vendor/include/networkit/distance/EffectiveDiameter.hpp +47 -0
  175. package/vendor/include/networkit/distance/EffectiveDiameterApproximation.hpp +57 -0
  176. package/vendor/include/networkit/distance/FloydWarshall.hpp +93 -0
  177. package/vendor/include/networkit/distance/GraphDistance.hpp +49 -0
  178. package/vendor/include/networkit/distance/HopPlotApproximation.hpp +62 -0
  179. package/vendor/include/networkit/distance/IncompleteDijkstra.hpp +66 -0
  180. package/vendor/include/networkit/distance/IncompleteSSSP.hpp +41 -0
  181. package/vendor/include/networkit/distance/JaccardDistance.hpp +57 -0
  182. package/vendor/include/networkit/distance/MultiTargetBFS.hpp +32 -0
  183. package/vendor/include/networkit/distance/MultiTargetDijkstra.hpp +40 -0
  184. package/vendor/include/networkit/distance/NeighborhoodFunction.hpp +47 -0
  185. package/vendor/include/networkit/distance/NeighborhoodFunctionApproximation.hpp +56 -0
  186. package/vendor/include/networkit/distance/NeighborhoodFunctionHeuristic.hpp +56 -0
  187. package/vendor/include/networkit/distance/NodeDistance.hpp +54 -0
  188. package/vendor/include/networkit/distance/PrunedLandmarkLabeling.hpp +76 -0
  189. package/vendor/include/networkit/distance/ReverseBFS.hpp +46 -0
  190. package/vendor/include/networkit/distance/SPSP.hpp +143 -0
  191. package/vendor/include/networkit/distance/SSSP.hpp +216 -0
  192. package/vendor/include/networkit/distance/STSP.hpp +193 -0
  193. package/vendor/include/networkit/distance/Volume.hpp +66 -0
  194. package/vendor/include/networkit/dynamics/DGSStreamParser.hpp +40 -0
  195. package/vendor/include/networkit/dynamics/DGSWriter.hpp +30 -0
  196. package/vendor/include/networkit/dynamics/GraphDifference.hpp +110 -0
  197. package/vendor/include/networkit/dynamics/GraphEvent.hpp +55 -0
  198. package/vendor/include/networkit/dynamics/GraphEventHandler.hpp +39 -0
  199. package/vendor/include/networkit/dynamics/GraphEventProxy.hpp +55 -0
  200. package/vendor/include/networkit/dynamics/GraphUpdater.hpp +38 -0
  201. package/vendor/include/networkit/edgescores/ChibaNishizekiQuadrangleEdgeScore.hpp +26 -0
  202. package/vendor/include/networkit/edgescores/ChibaNishizekiTriangleEdgeScore.hpp +33 -0
  203. package/vendor/include/networkit/edgescores/EdgeScore.hpp +50 -0
  204. package/vendor/include/networkit/edgescores/EdgeScoreAsWeight.hpp +33 -0
  205. package/vendor/include/networkit/edgescores/EdgeScoreBlender.hpp +33 -0
  206. package/vendor/include/networkit/edgescores/EdgeScoreLinearizer.hpp +32 -0
  207. package/vendor/include/networkit/edgescores/EdgeScoreNormalizer.hpp +35 -0
  208. package/vendor/include/networkit/edgescores/GeometricMeanScore.hpp +29 -0
  209. package/vendor/include/networkit/edgescores/PrefixJaccardScore.hpp +23 -0
  210. package/vendor/include/networkit/edgescores/TriangleEdgeScore.hpp +39 -0
  211. package/vendor/include/networkit/embedding/Node2Vec.hpp +83 -0
  212. package/vendor/include/networkit/flow/EdmondsKarp.hpp +112 -0
  213. package/vendor/include/networkit/generators/BarabasiAlbertGenerator.hpp +87 -0
  214. package/vendor/include/networkit/generators/ChungLuGenerator.hpp +46 -0
  215. package/vendor/include/networkit/generators/ChungLuGeneratorAlamEtAl.hpp +63 -0
  216. package/vendor/include/networkit/generators/ClusteredRandomGraphGenerator.hpp +56 -0
  217. package/vendor/include/networkit/generators/ConfigurationModel.hpp +36 -0
  218. package/vendor/include/networkit/generators/DorogovtsevMendesGenerator.hpp +33 -0
  219. package/vendor/include/networkit/generators/DynamicBarabasiAlbertGenerator.hpp +33 -0
  220. package/vendor/include/networkit/generators/DynamicDGSParser.hpp +51 -0
  221. package/vendor/include/networkit/generators/DynamicDorogovtsevMendesGenerator.hpp +34 -0
  222. package/vendor/include/networkit/generators/DynamicForestFireGenerator.hpp +55 -0
  223. package/vendor/include/networkit/generators/DynamicGraphGenerator.hpp +40 -0
  224. package/vendor/include/networkit/generators/DynamicGraphSource.hpp +79 -0
  225. package/vendor/include/networkit/generators/DynamicHyperbolicGenerator.hpp +143 -0
  226. package/vendor/include/networkit/generators/DynamicPathGenerator.hpp +26 -0
  227. package/vendor/include/networkit/generators/DynamicPubWebGenerator.hpp +54 -0
  228. package/vendor/include/networkit/generators/EdgeSwitchingMarkovChainGenerator.hpp +65 -0
  229. package/vendor/include/networkit/generators/ErdosRenyiEnumerator.hpp +318 -0
  230. package/vendor/include/networkit/generators/ErdosRenyiGenerator.hpp +56 -0
  231. package/vendor/include/networkit/generators/HavelHakimiGenerator.hpp +48 -0
  232. package/vendor/include/networkit/generators/HyperbolicGenerator.hpp +236 -0
  233. package/vendor/include/networkit/generators/LFRGenerator.hpp +175 -0
  234. package/vendor/include/networkit/generators/MocnikGenerator.hpp +147 -0
  235. package/vendor/include/networkit/generators/MocnikGeneratorBasic.hpp +58 -0
  236. package/vendor/include/networkit/generators/PowerlawDegreeSequence.hpp +128 -0
  237. package/vendor/include/networkit/generators/PubWebGenerator.hpp +94 -0
  238. package/vendor/include/networkit/generators/RegularRingLatticeGenerator.hpp +37 -0
  239. package/vendor/include/networkit/generators/RmatGenerator.hpp +67 -0
  240. package/vendor/include/networkit/generators/StaticDegreeSequenceGenerator.hpp +42 -0
  241. package/vendor/include/networkit/generators/StaticGraphGenerator.hpp +30 -0
  242. package/vendor/include/networkit/generators/StochasticBlockmodel.hpp +41 -0
  243. package/vendor/include/networkit/generators/WattsStrogatzGenerator.hpp +43 -0
  244. package/vendor/include/networkit/generators/quadtree/QuadNode.hpp +857 -0
  245. package/vendor/include/networkit/generators/quadtree/QuadNodeCartesianEuclid.hpp +587 -0
  246. package/vendor/include/networkit/generators/quadtree/QuadNodePolarEuclid.hpp +726 -0
  247. package/vendor/include/networkit/generators/quadtree/Quadtree.hpp +232 -0
  248. package/vendor/include/networkit/generators/quadtree/QuadtreeCartesianEuclid.hpp +149 -0
  249. package/vendor/include/networkit/generators/quadtree/QuadtreePolarEuclid.hpp +143 -0
  250. package/vendor/include/networkit/geometric/HyperbolicSpace.hpp +248 -0
  251. package/vendor/include/networkit/geometric/Point2DWithIndex.hpp +145 -0
  252. package/vendor/include/networkit/global/ClusteringCoefficient.hpp +42 -0
  253. package/vendor/include/networkit/global/GlobalClusteringCoefficient.hpp +24 -0
  254. package/vendor/include/networkit/graph/Attributes.hpp +568 -0
  255. package/vendor/include/networkit/graph/BFS.hpp +111 -0
  256. package/vendor/include/networkit/graph/DFS.hpp +71 -0
  257. package/vendor/include/networkit/graph/Dijkstra.hpp +83 -0
  258. package/vendor/include/networkit/graph/EdgeIterators.hpp +171 -0
  259. package/vendor/include/networkit/graph/Graph.hpp +2083 -0
  260. package/vendor/include/networkit/graph/GraphBuilder.hpp +289 -0
  261. package/vendor/include/networkit/graph/GraphR.hpp +133 -0
  262. package/vendor/include/networkit/graph/GraphTools.hpp +589 -0
  263. package/vendor/include/networkit/graph/GraphW.hpp +1236 -0
  264. package/vendor/include/networkit/graph/KruskalMSF.hpp +50 -0
  265. package/vendor/include/networkit/graph/NeighborIterators.hpp +163 -0
  266. package/vendor/include/networkit/graph/NodeIterators.hpp +127 -0
  267. package/vendor/include/networkit/graph/PrimMSF.hpp +66 -0
  268. package/vendor/include/networkit/graph/RandomMaximumSpanningForest.hpp +133 -0
  269. package/vendor/include/networkit/graph/SpanningForest.hpp +41 -0
  270. package/vendor/include/networkit/graph/TopologicalSort.hpp +87 -0
  271. package/vendor/include/networkit/graph/UnionMaximumSpanningForest.hpp +126 -0
  272. package/vendor/include/networkit/graph/test/GraphBuilderBenchmark.hpp +68 -0
  273. package/vendor/include/networkit/independentset/IndependentSetFinder.hpp +44 -0
  274. package/vendor/include/networkit/independentset/Luby.hpp +27 -0
  275. package/vendor/include/networkit/io/BinaryEdgeListPartitionReader.hpp +45 -0
  276. package/vendor/include/networkit/io/BinaryEdgeListPartitionWriter.hpp +47 -0
  277. package/vendor/include/networkit/io/BinaryPartitionReader.hpp +41 -0
  278. package/vendor/include/networkit/io/BinaryPartitionWriter.hpp +44 -0
  279. package/vendor/include/networkit/io/CoverReader.hpp +27 -0
  280. package/vendor/include/networkit/io/CoverWriter.hpp +21 -0
  281. package/vendor/include/networkit/io/DGSReader.hpp +39 -0
  282. package/vendor/include/networkit/io/DibapGraphReader.hpp +43 -0
  283. package/vendor/include/networkit/io/DotGraphWriter.hpp +39 -0
  284. package/vendor/include/networkit/io/DotPartitionWriter.hpp +23 -0
  285. package/vendor/include/networkit/io/DynamicGraphReader.hpp +29 -0
  286. package/vendor/include/networkit/io/EdgeListCoverReader.hpp +35 -0
  287. package/vendor/include/networkit/io/EdgeListPartitionReader.hpp +43 -0
  288. package/vendor/include/networkit/io/EdgeListReader.hpp +61 -0
  289. package/vendor/include/networkit/io/EdgeListWriter.hpp +48 -0
  290. package/vendor/include/networkit/io/GMLGraphReader.hpp +33 -0
  291. package/vendor/include/networkit/io/GMLGraphWriter.hpp +33 -0
  292. package/vendor/include/networkit/io/GraphIO.hpp +52 -0
  293. package/vendor/include/networkit/io/GraphReader.hpp +40 -0
  294. package/vendor/include/networkit/io/GraphToolBinaryReader.hpp +71 -0
  295. package/vendor/include/networkit/io/GraphToolBinaryWriter.hpp +61 -0
  296. package/vendor/include/networkit/io/GraphWriter.hpp +27 -0
  297. package/vendor/include/networkit/io/KONECTGraphReader.hpp +44 -0
  298. package/vendor/include/networkit/io/LineFileReader.hpp +42 -0
  299. package/vendor/include/networkit/io/METISGraphReader.hpp +36 -0
  300. package/vendor/include/networkit/io/METISGraphWriter.hpp +29 -0
  301. package/vendor/include/networkit/io/METISParser.hpp +63 -0
  302. package/vendor/include/networkit/io/MTXGraphReader.hpp +31 -0
  303. package/vendor/include/networkit/io/MTXParser.hpp +87 -0
  304. package/vendor/include/networkit/io/MatrixMarketReader.hpp +33 -0
  305. package/vendor/include/networkit/io/MatrixReader.hpp +33 -0
  306. package/vendor/include/networkit/io/MemoryMappedFile.hpp +80 -0
  307. package/vendor/include/networkit/io/NetworkitBinaryGraph.hpp +144 -0
  308. package/vendor/include/networkit/io/NetworkitBinaryReader.hpp +50 -0
  309. package/vendor/include/networkit/io/NetworkitBinaryWriter.hpp +71 -0
  310. package/vendor/include/networkit/io/PartitionReader.hpp +34 -0
  311. package/vendor/include/networkit/io/PartitionWriter.hpp +31 -0
  312. package/vendor/include/networkit/io/RBGraphReader.hpp +37 -0
  313. package/vendor/include/networkit/io/RBMatrixReader.hpp +49 -0
  314. package/vendor/include/networkit/io/RasterReader.hpp +40 -0
  315. package/vendor/include/networkit/io/SNAPEdgeListPartitionReader.hpp +28 -0
  316. package/vendor/include/networkit/io/SNAPGraphReader.hpp +53 -0
  317. package/vendor/include/networkit/io/SNAPGraphWriter.hpp +53 -0
  318. package/vendor/include/networkit/io/ThrillGraphBinaryReader.hpp +44 -0
  319. package/vendor/include/networkit/io/ThrillGraphBinaryWriter.hpp +27 -0
  320. package/vendor/include/networkit/layout/LayoutAlgorithm.hpp +39 -0
  321. package/vendor/include/networkit/linkprediction/AdamicAdarIndex.hpp +37 -0
  322. package/vendor/include/networkit/linkprediction/AdjustedRandIndex.hpp +36 -0
  323. package/vendor/include/networkit/linkprediction/AlgebraicDistanceIndex.hpp +70 -0
  324. package/vendor/include/networkit/linkprediction/CommonNeighborsIndex.hpp +39 -0
  325. package/vendor/include/networkit/linkprediction/EvaluationMetric.hpp +135 -0
  326. package/vendor/include/networkit/linkprediction/JaccardIndex.hpp +44 -0
  327. package/vendor/include/networkit/linkprediction/KatzIndex.hpp +84 -0
  328. package/vendor/include/networkit/linkprediction/LinkPredictor.hpp +98 -0
  329. package/vendor/include/networkit/linkprediction/LinkThresholder.hpp +56 -0
  330. package/vendor/include/networkit/linkprediction/MissingLinksFinder.hpp +60 -0
  331. package/vendor/include/networkit/linkprediction/NeighborhoodDistanceIndex.hpp +42 -0
  332. package/vendor/include/networkit/linkprediction/NeighborhoodUtility.hpp +54 -0
  333. package/vendor/include/networkit/linkprediction/NeighborsMeasureIndex.hpp +48 -0
  334. package/vendor/include/networkit/linkprediction/PrecisionRecallMetric.hpp +40 -0
  335. package/vendor/include/networkit/linkprediction/PredictionsSorter.hpp +66 -0
  336. package/vendor/include/networkit/linkprediction/PreferentialAttachmentIndex.hpp +37 -0
  337. package/vendor/include/networkit/linkprediction/ROCMetric.hpp +39 -0
  338. package/vendor/include/networkit/linkprediction/RandomLinkSampler.hpp +47 -0
  339. package/vendor/include/networkit/linkprediction/ResourceAllocationIndex.hpp +38 -0
  340. package/vendor/include/networkit/linkprediction/SameCommunityIndex.hpp +50 -0
  341. package/vendor/include/networkit/linkprediction/TotalNeighborsIndex.hpp +39 -0
  342. package/vendor/include/networkit/linkprediction/UDegreeIndex.hpp +35 -0
  343. package/vendor/include/networkit/linkprediction/VDegreeIndex.hpp +35 -0
  344. package/vendor/include/networkit/matching/BMatcher.hpp +52 -0
  345. package/vendor/include/networkit/matching/BMatching.hpp +115 -0
  346. package/vendor/include/networkit/matching/BSuitorMatcher.hpp +170 -0
  347. package/vendor/include/networkit/matching/DynamicBSuitorMatcher.hpp +78 -0
  348. package/vendor/include/networkit/matching/LocalMaxMatcher.hpp +35 -0
  349. package/vendor/include/networkit/matching/Matcher.hpp +55 -0
  350. package/vendor/include/networkit/matching/Matching.hpp +111 -0
  351. package/vendor/include/networkit/matching/PathGrowingMatcher.hpp +46 -0
  352. package/vendor/include/networkit/matching/SuitorMatcher.hpp +62 -0
  353. package/vendor/include/networkit/numerics/ConjugateGradient.hpp +163 -0
  354. package/vendor/include/networkit/numerics/GaussSeidelRelaxation.hpp +99 -0
  355. package/vendor/include/networkit/numerics/LAMG/LAMGSettings.hpp +70 -0
  356. package/vendor/include/networkit/numerics/LAMG/Lamg.hpp +460 -0
  357. package/vendor/include/networkit/numerics/LAMG/Level/EliminationStage.hpp +47 -0
  358. package/vendor/include/networkit/numerics/LAMG/Level/Level.hpp +56 -0
  359. package/vendor/include/networkit/numerics/LAMG/Level/LevelAggregation.hpp +52 -0
  360. package/vendor/include/networkit/numerics/LAMG/Level/LevelElimination.hpp +133 -0
  361. package/vendor/include/networkit/numerics/LAMG/Level/LevelFinest.hpp +28 -0
  362. package/vendor/include/networkit/numerics/LAMG/LevelHierarchy.hpp +165 -0
  363. package/vendor/include/networkit/numerics/LAMG/MultiLevelSetup.hpp +1090 -0
  364. package/vendor/include/networkit/numerics/LAMG/SolverLamg.hpp +316 -0
  365. package/vendor/include/networkit/numerics/LinearSolver.hpp +151 -0
  366. package/vendor/include/networkit/numerics/Preconditioner/DiagonalPreconditioner.hpp +61 -0
  367. package/vendor/include/networkit/numerics/Preconditioner/IdentityPreconditioner.hpp +36 -0
  368. package/vendor/include/networkit/numerics/Smoother.hpp +37 -0
  369. package/vendor/include/networkit/overlap/HashingOverlapper.hpp +28 -0
  370. package/vendor/include/networkit/overlap/Overlapper.hpp +27 -0
  371. package/vendor/include/networkit/planarity/LeftRightPlanarityCheck.hpp +113 -0
  372. package/vendor/include/networkit/randomization/Curveball.hpp +49 -0
  373. package/vendor/include/networkit/randomization/CurveballGlobalTradeGenerator.hpp +39 -0
  374. package/vendor/include/networkit/randomization/CurveballUniformTradeGenerator.hpp +39 -0
  375. package/vendor/include/networkit/randomization/DegreePreservingShuffle.hpp +82 -0
  376. package/vendor/include/networkit/randomization/EdgeSwitching.hpp +157 -0
  377. package/vendor/include/networkit/randomization/GlobalCurveball.hpp +69 -0
  378. package/vendor/include/networkit/randomization/GlobalTradeSequence.hpp +303 -0
  379. package/vendor/include/networkit/reachability/AllSimplePaths.hpp +122 -0
  380. package/vendor/include/networkit/reachability/ReachableNodes.hpp +83 -0
  381. package/vendor/include/networkit/scd/ApproximatePageRank.hpp +51 -0
  382. package/vendor/include/networkit/scd/CliqueDetect.hpp +55 -0
  383. package/vendor/include/networkit/scd/CombinedSCD.hpp +51 -0
  384. package/vendor/include/networkit/scd/GCE.hpp +42 -0
  385. package/vendor/include/networkit/scd/LFMLocal.hpp +54 -0
  386. package/vendor/include/networkit/scd/LocalT.hpp +40 -0
  387. package/vendor/include/networkit/scd/LocalTightnessExpansion.hpp +46 -0
  388. package/vendor/include/networkit/scd/PageRankNibble.hpp +55 -0
  389. package/vendor/include/networkit/scd/RandomBFS.hpp +33 -0
  390. package/vendor/include/networkit/scd/SCDGroundTruthComparison.hpp +121 -0
  391. package/vendor/include/networkit/scd/SelectiveCommunityDetector.hpp +76 -0
  392. package/vendor/include/networkit/scd/SetConductance.hpp +47 -0
  393. package/vendor/include/networkit/scd/TCE.hpp +41 -0
  394. package/vendor/include/networkit/scd/TwoPhaseL.hpp +40 -0
  395. package/vendor/include/networkit/scoring/EdgeScoring.hpp +44 -0
  396. package/vendor/include/networkit/scoring/ModularityScoring.hpp +79 -0
  397. package/vendor/include/networkit/simulation/EpidemicSimulationSEIR.hpp +59 -0
  398. package/vendor/include/networkit/sparsification/ChanceCorrectedTriangleScore.hpp +28 -0
  399. package/vendor/include/networkit/sparsification/ForestFireScore.hpp +34 -0
  400. package/vendor/include/networkit/sparsification/GlobalThresholdFilter.hpp +40 -0
  401. package/vendor/include/networkit/sparsification/LocalDegreeScore.hpp +30 -0
  402. package/vendor/include/networkit/sparsification/LocalFilterScore.hpp +124 -0
  403. package/vendor/include/networkit/sparsification/LocalSimilarityScore.hpp +63 -0
  404. package/vendor/include/networkit/sparsification/MultiscaleScore.hpp +38 -0
  405. package/vendor/include/networkit/sparsification/RandomEdgeScore.hpp +33 -0
  406. package/vendor/include/networkit/sparsification/RandomNodeEdgeScore.hpp +29 -0
  407. package/vendor/include/networkit/sparsification/SCANStructuralSimilarityScore.hpp +23 -0
  408. package/vendor/include/networkit/sparsification/SimmelianOverlapScore.hpp +35 -0
  409. package/vendor/include/networkit/sparsification/SimmelianScore.hpp +92 -0
  410. package/vendor/include/networkit/sparsification/Sparsifiers.hpp +166 -0
  411. package/vendor/include/networkit/structures/Cover.hpp +248 -0
  412. package/vendor/include/networkit/structures/LocalCommunity.hpp +363 -0
  413. package/vendor/include/networkit/structures/Partition.hpp +335 -0
  414. package/vendor/include/networkit/structures/UnionFind.hpp +66 -0
  415. package/vendor/include/networkit/viz/GraphLayoutAlgorithm.hpp +157 -0
  416. package/vendor/include/networkit/viz/MaxentStress.hpp +346 -0
  417. package/vendor/include/networkit/viz/Octree.hpp +428 -0
  418. package/vendor/include/networkit/viz/PivotMDS.hpp +63 -0
  419. package/vendor/include/networkit/viz/Point.hpp +415 -0
  420. package/vendor/include/networkit/viz/PostscriptWriter.hpp +78 -0
  421. package/vendor/include/tlx/algorithm/exclusive_scan.hpp +56 -0
  422. package/vendor/include/tlx/algorithm/is_sorted_cmp.hpp +56 -0
  423. package/vendor/include/tlx/algorithm/merge_advance.hpp +177 -0
  424. package/vendor/include/tlx/algorithm/merge_combine.hpp +76 -0
  425. package/vendor/include/tlx/algorithm/multisequence_partition.hpp +346 -0
  426. package/vendor/include/tlx/algorithm/multisequence_selection.hpp +351 -0
  427. package/vendor/include/tlx/algorithm/multiway_merge.hpp +1385 -0
  428. package/vendor/include/tlx/algorithm/multiway_merge_splitting.hpp +257 -0
  429. package/vendor/include/tlx/algorithm/parallel_multiway_merge.hpp +408 -0
  430. package/vendor/include/tlx/algorithm/random_bipartition_shuffle.hpp +116 -0
  431. package/vendor/include/tlx/algorithm.hpp +36 -0
  432. package/vendor/include/tlx/allocator_base.hpp +100 -0
  433. package/vendor/include/tlx/backtrace.hpp +54 -0
  434. package/vendor/include/tlx/cmdline_parser.hpp +498 -0
  435. package/vendor/include/tlx/container/btree.hpp +3977 -0
  436. package/vendor/include/tlx/container/btree_map.hpp +634 -0
  437. package/vendor/include/tlx/container/btree_multimap.hpp +627 -0
  438. package/vendor/include/tlx/container/btree_multiset.hpp +612 -0
  439. package/vendor/include/tlx/container/btree_set.hpp +612 -0
  440. package/vendor/include/tlx/container/d_ary_addressable_int_heap.hpp +416 -0
  441. package/vendor/include/tlx/container/d_ary_heap.hpp +311 -0
  442. package/vendor/include/tlx/container/loser_tree.hpp +1009 -0
  443. package/vendor/include/tlx/container/lru_cache.hpp +319 -0
  444. package/vendor/include/tlx/container/radix_heap.hpp +735 -0
  445. package/vendor/include/tlx/container/ring_buffer.hpp +428 -0
  446. package/vendor/include/tlx/container/simple_vector.hpp +304 -0
  447. package/vendor/include/tlx/container/splay_tree.hpp +399 -0
  448. package/vendor/include/tlx/container/string_view.hpp +805 -0
  449. package/vendor/include/tlx/container.hpp +40 -0
  450. package/vendor/include/tlx/counting_ptr.hpp +522 -0
  451. package/vendor/include/tlx/define/attribute_always_inline.hpp +34 -0
  452. package/vendor/include/tlx/define/attribute_fallthrough.hpp +36 -0
  453. package/vendor/include/tlx/define/attribute_format_printf.hpp +34 -0
  454. package/vendor/include/tlx/define/attribute_packed.hpp +34 -0
  455. package/vendor/include/tlx/define/attribute_warn_unused_result.hpp +34 -0
  456. package/vendor/include/tlx/define/constexpr.hpp +31 -0
  457. package/vendor/include/tlx/define/deprecated.hpp +39 -0
  458. package/vendor/include/tlx/define/endian.hpp +49 -0
  459. package/vendor/include/tlx/define/likely.hpp +33 -0
  460. package/vendor/include/tlx/define/visibility_hidden.hpp +34 -0
  461. package/vendor/include/tlx/define.hpp +36 -0
  462. package/vendor/include/tlx/delegate.hpp +524 -0
  463. package/vendor/include/tlx/die/core.hpp +311 -0
  464. package/vendor/include/tlx/die.hpp +106 -0
  465. package/vendor/include/tlx/digest/md5.hpp +81 -0
  466. package/vendor/include/tlx/digest/sha1.hpp +81 -0
  467. package/vendor/include/tlx/digest/sha256.hpp +81 -0
  468. package/vendor/include/tlx/digest/sha512.hpp +81 -0
  469. package/vendor/include/tlx/digest.hpp +30 -0
  470. package/vendor/include/tlx/logger/all.hpp +33 -0
  471. package/vendor/include/tlx/logger/array.hpp +43 -0
  472. package/vendor/include/tlx/logger/core.hpp +287 -0
  473. package/vendor/include/tlx/logger/deque.hpp +42 -0
  474. package/vendor/include/tlx/logger/map.hpp +65 -0
  475. package/vendor/include/tlx/logger/set.hpp +60 -0
  476. package/vendor/include/tlx/logger/tuple.hpp +66 -0
  477. package/vendor/include/tlx/logger/unordered_map.hpp +68 -0
  478. package/vendor/include/tlx/logger/unordered_set.hpp +64 -0
  479. package/vendor/include/tlx/logger/wrap_unprintable.hpp +75 -0
  480. package/vendor/include/tlx/logger.hpp +44 -0
  481. package/vendor/include/tlx/math/abs_diff.hpp +35 -0
  482. package/vendor/include/tlx/math/aggregate.hpp +231 -0
  483. package/vendor/include/tlx/math/aggregate_min_max.hpp +116 -0
  484. package/vendor/include/tlx/math/bswap.hpp +148 -0
  485. package/vendor/include/tlx/math/bswap_be.hpp +79 -0
  486. package/vendor/include/tlx/math/bswap_le.hpp +79 -0
  487. package/vendor/include/tlx/math/clz.hpp +174 -0
  488. package/vendor/include/tlx/math/ctz.hpp +174 -0
  489. package/vendor/include/tlx/math/div_ceil.hpp +36 -0
  490. package/vendor/include/tlx/math/ffs.hpp +123 -0
  491. package/vendor/include/tlx/math/integer_log2.hpp +189 -0
  492. package/vendor/include/tlx/math/is_power_of_two.hpp +74 -0
  493. package/vendor/include/tlx/math/polynomial_regression.hpp +243 -0
  494. package/vendor/include/tlx/math/popcount.hpp +173 -0
  495. package/vendor/include/tlx/math/power_to_the.hpp +44 -0
  496. package/vendor/include/tlx/math/rol.hpp +112 -0
  497. package/vendor/include/tlx/math/ror.hpp +112 -0
  498. package/vendor/include/tlx/math/round_to_power_of_two.hpp +121 -0
  499. package/vendor/include/tlx/math/round_up.hpp +36 -0
  500. package/vendor/include/tlx/math/sgn.hpp +38 -0
  501. package/vendor/include/tlx/math.hpp +46 -0
  502. package/vendor/include/tlx/meta/apply_tuple.hpp +55 -0
  503. package/vendor/include/tlx/meta/call_for_range.hpp +78 -0
  504. package/vendor/include/tlx/meta/call_foreach.hpp +60 -0
  505. package/vendor/include/tlx/meta/call_foreach_tuple.hpp +60 -0
  506. package/vendor/include/tlx/meta/call_foreach_tuple_with_index.hpp +61 -0
  507. package/vendor/include/tlx/meta/call_foreach_with_index.hpp +64 -0
  508. package/vendor/include/tlx/meta/enable_if.hpp +37 -0
  509. package/vendor/include/tlx/meta/fold_left.hpp +63 -0
  510. package/vendor/include/tlx/meta/fold_left_tuple.hpp +60 -0
  511. package/vendor/include/tlx/meta/fold_right.hpp +63 -0
  512. package/vendor/include/tlx/meta/fold_right_tuple.hpp +60 -0
  513. package/vendor/include/tlx/meta/function_chain.hpp +197 -0
  514. package/vendor/include/tlx/meta/function_stack.hpp +189 -0
  515. package/vendor/include/tlx/meta/has_member.hpp +80 -0
  516. package/vendor/include/tlx/meta/has_method.hpp +117 -0
  517. package/vendor/include/tlx/meta/index_sequence.hpp +66 -0
  518. package/vendor/include/tlx/meta/is_std_array.hpp +40 -0
  519. package/vendor/include/tlx/meta/is_std_pair.hpp +39 -0
  520. package/vendor/include/tlx/meta/is_std_tuple.hpp +39 -0
  521. package/vendor/include/tlx/meta/is_std_vector.hpp +39 -0
  522. package/vendor/include/tlx/meta/log2.hpp +101 -0
  523. package/vendor/include/tlx/meta/no_operation.hpp +55 -0
  524. package/vendor/include/tlx/meta/static_index.hpp +42 -0
  525. package/vendor/include/tlx/meta/vexpand.hpp +34 -0
  526. package/vendor/include/tlx/meta/vmap_for_range.hpp +84 -0
  527. package/vendor/include/tlx/meta/vmap_foreach.hpp +63 -0
  528. package/vendor/include/tlx/meta/vmap_foreach_tuple.hpp +59 -0
  529. package/vendor/include/tlx/meta/vmap_foreach_tuple_with_index.hpp +62 -0
  530. package/vendor/include/tlx/meta/vmap_foreach_with_index.hpp +70 -0
  531. package/vendor/include/tlx/meta.hpp +55 -0
  532. package/vendor/include/tlx/multi_timer.hpp +148 -0
  533. package/vendor/include/tlx/port/setenv.hpp +31 -0
  534. package/vendor/include/tlx/port.hpp +27 -0
  535. package/vendor/include/tlx/semaphore.hpp +119 -0
  536. package/vendor/include/tlx/simple_vector.hpp +20 -0
  537. package/vendor/include/tlx/siphash.hpp +282 -0
  538. package/vendor/include/tlx/sort/networks/best.hpp +611 -0
  539. package/vendor/include/tlx/sort/networks/bose_nelson.hpp +412 -0
  540. package/vendor/include/tlx/sort/networks/bose_nelson_parameter.hpp +507 -0
  541. package/vendor/include/tlx/sort/networks/cswap.hpp +60 -0
  542. package/vendor/include/tlx/sort/parallel_mergesort.hpp +398 -0
  543. package/vendor/include/tlx/sort/strings/insertion_sort.hpp +232 -0
  544. package/vendor/include/tlx/sort/strings/multikey_quicksort.hpp +185 -0
  545. package/vendor/include/tlx/sort/strings/parallel_sample_sort.hpp +1647 -0
  546. package/vendor/include/tlx/sort/strings/radix_sort.hpp +934 -0
  547. package/vendor/include/tlx/sort/strings/sample_sort_tools.hpp +756 -0
  548. package/vendor/include/tlx/sort/strings/string_ptr.hpp +426 -0
  549. package/vendor/include/tlx/sort/strings/string_set.hpp +800 -0
  550. package/vendor/include/tlx/sort/strings.hpp +329 -0
  551. package/vendor/include/tlx/sort/strings_parallel.hpp +325 -0
  552. package/vendor/include/tlx/sort.hpp +29 -0
  553. package/vendor/include/tlx/stack_allocator.hpp +226 -0
  554. package/vendor/include/tlx/string/appendline.hpp +35 -0
  555. package/vendor/include/tlx/string/base64.hpp +87 -0
  556. package/vendor/include/tlx/string/bitdump.hpp +139 -0
  557. package/vendor/include/tlx/string/compare_icase.hpp +42 -0
  558. package/vendor/include/tlx/string/contains.hpp +36 -0
  559. package/vendor/include/tlx/string/contains_word.hpp +42 -0
  560. package/vendor/include/tlx/string/ends_with.hpp +79 -0
  561. package/vendor/include/tlx/string/equal_icase.hpp +42 -0
  562. package/vendor/include/tlx/string/erase_all.hpp +70 -0
  563. package/vendor/include/tlx/string/escape_html.hpp +34 -0
  564. package/vendor/include/tlx/string/escape_uri.hpp +34 -0
  565. package/vendor/include/tlx/string/expand_environment_variables.hpp +49 -0
  566. package/vendor/include/tlx/string/extract_between.hpp +40 -0
  567. package/vendor/include/tlx/string/format_iec_units.hpp +32 -0
  568. package/vendor/include/tlx/string/format_si_iec_units.hpp +19 -0
  569. package/vendor/include/tlx/string/format_si_units.hpp +32 -0
  570. package/vendor/include/tlx/string/hash_djb2.hpp +87 -0
  571. package/vendor/include/tlx/string/hash_sdbm.hpp +86 -0
  572. package/vendor/include/tlx/string/hexdump.hpp +154 -0
  573. package/vendor/include/tlx/string/index_of.hpp +56 -0
  574. package/vendor/include/tlx/string/join.hpp +65 -0
  575. package/vendor/include/tlx/string/join_generic.hpp +89 -0
  576. package/vendor/include/tlx/string/join_quoted.hpp +46 -0
  577. package/vendor/include/tlx/string/less_icase.hpp +64 -0
  578. package/vendor/include/tlx/string/levenshtein.hpp +193 -0
  579. package/vendor/include/tlx/string/pad.hpp +39 -0
  580. package/vendor/include/tlx/string/parse_si_iec_units.hpp +46 -0
  581. package/vendor/include/tlx/string/parse_uri.hpp +66 -0
  582. package/vendor/include/tlx/string/parse_uri_form_data.hpp +136 -0
  583. package/vendor/include/tlx/string/replace.hpp +141 -0
  584. package/vendor/include/tlx/string/split.hpp +170 -0
  585. package/vendor/include/tlx/string/split_quoted.hpp +49 -0
  586. package/vendor/include/tlx/string/split_view.hpp +218 -0
  587. package/vendor/include/tlx/string/split_words.hpp +53 -0
  588. package/vendor/include/tlx/string/ssprintf.hpp +45 -0
  589. package/vendor/include/tlx/string/ssprintf_generic.hpp +95 -0
  590. package/vendor/include/tlx/string/starts_with.hpp +44 -0
  591. package/vendor/include/tlx/string/to_lower.hpp +47 -0
  592. package/vendor/include/tlx/string/to_upper.hpp +47 -0
  593. package/vendor/include/tlx/string/trim.hpp +298 -0
  594. package/vendor/include/tlx/string/union_words.hpp +33 -0
  595. package/vendor/include/tlx/string/word_wrap.hpp +35 -0
  596. package/vendor/include/tlx/string.hpp +68 -0
  597. package/vendor/include/tlx/thread_barrier_mutex.hpp +109 -0
  598. package/vendor/include/tlx/thread_barrier_spin.hpp +127 -0
  599. package/vendor/include/tlx/thread_pool.hpp +151 -0
  600. package/vendor/include/tlx/timestamp.hpp +23 -0
  601. package/vendor/include/tlx/unused.hpp +28 -0
  602. package/vendor/include/tlx/vector_free.hpp +30 -0
  603. package/vendor/include/tlx/version.hpp +49 -0
  604. package/vendor/include/ttmath/ttmath.h +2881 -0
  605. package/vendor/include/ttmath/ttmathbig.h +6111 -0
  606. package/vendor/include/ttmath/ttmathdec.h +419 -0
  607. package/vendor/include/ttmath/ttmathint.h +1923 -0
  608. package/vendor/include/ttmath/ttmathmisc.h +250 -0
  609. package/vendor/include/ttmath/ttmathobjects.h +812 -0
  610. package/vendor/include/ttmath/ttmathparser.h +2791 -0
  611. package/vendor/include/ttmath/ttmaththreads.h +252 -0
  612. package/vendor/include/ttmath/ttmathtypes.h +707 -0
  613. package/vendor/include/ttmath/ttmathuint.h +4190 -0
  614. package/vendor/include/ttmath/ttmathuint_noasm.h +1038 -0
  615. package/vendor/include/ttmath/ttmathuint_x86.h +1620 -0
  616. package/vendor/include/ttmath/ttmathuint_x86_64.h +1177 -0
  617. package/vendor/lib/cmake/tlx/tlx-config.cmake +51 -0
  618. package/vendor/lib/cmake/tlx/tlx-targets-release.cmake +19 -0
  619. package/vendor/lib/cmake/tlx/tlx-targets.cmake +106 -0
  620. package/vendor/lib/cmake/tlx/tlx-version.cmake +11 -0
  621. package/vendor/lib/libnetworkit.dylib +0 -0
  622. package/vendor/lib/libtlx.a +0 -0
  623. package/vendor/lib/pkgconfig/networkit.pc +11 -0
  624. package/vendor/lib/pkgconfig/tlx.pc +11 -0
@@ -0,0 +1,1236 @@
1
+ #ifndef NETWORKIT_GRAPH_GRAPH_W_HPP_
2
+ #define NETWORKIT_GRAPH_GRAPH_W_HPP_
3
+
4
+ #include <set>
5
+ #include <networkit/graph/Graph.hpp>
6
+
7
+ namespace NetworKit {
8
+
9
+ /**
10
+ * @ingroup graph
11
+ * A writable graph that extends Graph with mutation operations.
12
+ * This class provides all read operations from Graph plus write operations
13
+ * like addNode, addEdge, removeNode, removeEdge, etc.
14
+ *
15
+ * GraphW uses traditional vector-based adjacency lists for mutable operations,
16
+ * while the base Graph class uses memory-efficient Arrow CSR arrays.
17
+ */
18
+ class GraphW final : public Graph {
19
+
20
+ protected:
21
+ // Vector-based adjacency data structures for mutable operations
22
+ //!< only used for directed graphs, inEdges[v] contains all nodes u that
23
+ //!< have an edge (u, v)
24
+ std::vector<std::vector<node>> inEdges;
25
+ //!< (outgoing) edges, for each edge (u, v) v is saved in outEdges[u] and
26
+ //!< for undirected also u in outEdges[v]
27
+ std::vector<std::vector<node>> outEdges;
28
+
29
+ //!< only used for directed graphs, same schema as inEdges
30
+ std::vector<std::vector<edgeweight>> inEdgeWeights;
31
+ //!< same schema (and same order!) as outEdges
32
+ std::vector<std::vector<edgeweight>> outEdgeWeights;
33
+
34
+ //!< only used for directed graphs, same schema as inEdges
35
+ std::vector<std::vector<edgeid>> inEdgeIds;
36
+ //!< same schema (and same order!) as outEdges
37
+ std::vector<std::vector<edgeid>> outEdgeIds;
38
+
39
+ public:
40
+ /**
41
+ * Check for invalid graph states for vector-based graphs.
42
+ * @return False if the graph is in invalid state.
43
+ */
44
+ bool checkConsistency() const override;
45
+
46
+ private:
47
+ /**
48
+ * Initialize vector-based data structures based on graph properties
49
+ */
50
+ void initializeVectorStructures() {
51
+ count nodeCount = upperNodeIdBound();
52
+
53
+ inEdges.resize(isDirected() ? nodeCount : 0);
54
+ outEdges.resize(nodeCount);
55
+ inEdgeWeights.resize(isWeighted() && isDirected() ? nodeCount : 0);
56
+ outEdgeWeights.resize(isWeighted() ? nodeCount : 0);
57
+ inEdgeIds.resize(hasEdgeIds() && isDirected() ? nodeCount : 0);
58
+ outEdgeIds.resize(hasEdgeIds() ? nodeCount : 0);
59
+ }
60
+
61
+ public:
62
+ /**
63
+ * Create a graph of @a n nodes. The graph has assignable edge weights if @a
64
+ * weighted is set to <code>true</code>. If @a weighted is set to
65
+ * <code>false</code> each edge has edge weight 1.0 and any other weight
66
+ * assignment will be ignored.
67
+ * @param n Number of nodes.
68
+ * @param weighted If set to <code>true</code>, the graph has edge weights.
69
+ * @param directed If set to @c true, the graph will be directed.
70
+ * @param edgesIndexed If set to @c true, the graph will have indexed edges.
71
+ */
72
+ GraphW(count n = 0, bool weighted = false, bool directed = false, bool edgesIndexed = false)
73
+ : Graph(n, weighted, directed, edgesIndexed), inEdges(directed ? n : 0), outEdges(n),
74
+ inEdgeWeights(weighted && directed ? n : 0), outEdgeWeights(weighted ? n : 0),
75
+ inEdgeIds(edgesIndexed && directed ? n : 0), outEdgeIds(edgesIndexed ? n : 0) {}
76
+
77
+ /**
78
+ * Generate a weighted graph from a list of edges. (Useful for small
79
+ * graphs in unit tests that you do not want to read from a file.)
80
+ *
81
+ * @param[in] edges list of weighted edges
82
+ */
83
+ GraphW(std::initializer_list<WeightedEdge> edges);
84
+
85
+ /**
86
+ * Create a graph as copy of @a other.
87
+ * @param other The graph to copy.
88
+ */
89
+ GraphW(const GraphW &other)
90
+ : Graph(other, true), inEdges(other.inEdges), outEdges(other.outEdges),
91
+ inEdgeWeights(other.inEdgeWeights), outEdgeWeights(other.outEdgeWeights),
92
+ inEdgeIds(other.inEdgeIds), outEdgeIds(other.outEdgeIds) {
93
+ // GraphW uses vector-based storage, not CSR
94
+ // Clear any CSR pointers that may have been copied from base class
95
+ outEdgesCSRIndices.reset();
96
+ outEdgesCSRIndptr.reset();
97
+ inEdgesCSRIndices.reset();
98
+ inEdgesCSRIndptr.reset();
99
+ outEdgesCSRWeights.reset();
100
+ inEdgesCSRWeights.reset();
101
+ usingCSR = false;
102
+ }
103
+
104
+ /**
105
+ * Create a graph as copy of @a other.
106
+ * @param other The graph to copy.
107
+ */
108
+ GraphW(const Graph &other)
109
+ : GraphW(other, other.isWeighted(), other.isDirected(), other.hasEdgeIds()) {}
110
+
111
+ /**
112
+ * Create a graph as copy of @a other with modified properties.
113
+ * @param other The graph to copy.
114
+ * @param weighted If set to true, the graph has edge weights.
115
+ * @param directed If set to true, the graph will be directed.
116
+ * @param edgesIndexed If set to true, the graph will have indexed edges.
117
+ */
118
+ template <class EdgeMerger = std::plus<edgeweight>>
119
+ GraphW(const Graph &other, bool weighted, bool directed, bool edgesIndexed = false,
120
+ EdgeMerger edgeMerger = std::plus<edgeweight>())
121
+ : GraphW(other.upperNodeIdBound(), weighted, directed, edgesIndexed) {
122
+
123
+ // Remove nodes that don't exist in the source graph
124
+ for (node v = 0; v < other.upperNodeIdBound(); ++v) {
125
+ if (!other.hasNode(v)) {
126
+ removeNode(v);
127
+ }
128
+ }
129
+
130
+ // Copy all edges using the public API
131
+ if (other.isDirected() == directed) {
132
+ // Same directedness - straightforward copy
133
+ other.forEdges([&](node u, node v, edgeweight w, [[maybe_unused]] edgeid id) {
134
+ addEdge(u, v, weighted ? w : defaultEdgeWeight);
135
+ });
136
+ } else if (other.isDirected() && !directed) {
137
+ // Converting directed to undirected - merge edges
138
+ WARN("Edge attributes are not preserved when converting from directed to undirected "
139
+ "graphs.");
140
+
141
+ std::set<std::pair<node, node>> addedEdges;
142
+ other.forEdges([&](node u, node v, edgeweight w, [[maybe_unused]] edgeid id) {
143
+ std::pair<node, node> edge = {std::min(u, v), std::max(u, v)};
144
+ if (addedEdges.find(edge) == addedEdges.end()) {
145
+ addEdge(edge.first, edge.second, weighted ? w : defaultEdgeWeight);
146
+ addedEdges.insert(edge);
147
+ } else if (weighted) {
148
+ // Merge weights for existing edge
149
+ edgeweight currentWeight = weight(edge.first, edge.second);
150
+ setWeight(edge.first, edge.second, edgeMerger(currentWeight, w));
151
+ }
152
+ });
153
+ } else {
154
+ // Converting undirected to directed - add both directions
155
+ WARN("Edge attributes are currently not preserved when converting from undirected to "
156
+ "directed graphs.");
157
+
158
+ other.forEdges([&](node u, node v, edgeweight w, [[maybe_unused]] edgeid id) {
159
+ addEdge(u, v, weighted ? w : defaultEdgeWeight);
160
+ if (u != v) {
161
+ addEdge(v, u, weighted ? w : defaultEdgeWeight);
162
+ }
163
+ });
164
+ }
165
+
166
+ if (edgesIndexed && !other.hasEdgeIds()) {
167
+ indexEdges(true);
168
+ }
169
+ }
170
+
171
+ /** move constructor */
172
+ GraphW(GraphW &&other) noexcept
173
+ : Graph(std::move(other)), inEdges(std::move(other.inEdges)),
174
+ outEdges(std::move(other.outEdges)), inEdgeWeights(std::move(other.inEdgeWeights)),
175
+ outEdgeWeights(std::move(other.outEdgeWeights)), inEdgeIds(std::move(other.inEdgeIds)),
176
+ outEdgeIds(std::move(other.outEdgeIds)) {}
177
+
178
+ /** move constructor */
179
+ GraphW(Graph &&other) noexcept : Graph(std::move(other)) { initializeVectorStructures(); }
180
+
181
+ /** Default destructor */
182
+ ~GraphW() override = default;
183
+
184
+ /** move assignment operator */
185
+ GraphW &operator=(GraphW &&other) noexcept {
186
+ if (this != &other) {
187
+ Graph::operator=(std::move(other));
188
+ inEdges = std::move(other.inEdges);
189
+ outEdges = std::move(other.outEdges);
190
+ inEdgeWeights = std::move(other.inEdgeWeights);
191
+ outEdgeWeights = std::move(other.outEdgeWeights);
192
+ inEdgeIds = std::move(other.inEdgeIds);
193
+ outEdgeIds = std::move(other.outEdgeIds);
194
+ }
195
+ return *this;
196
+ }
197
+
198
+ /** move assignment operator */
199
+ GraphW &operator=(Graph &&other) noexcept {
200
+ Graph::operator=(std::move(other));
201
+ // Clear existing vectors before reinitializing to avoid keeping old edge data
202
+ inEdges.clear();
203
+ outEdges.clear();
204
+ inEdgeWeights.clear();
205
+ outEdgeWeights.clear();
206
+ inEdgeIds.clear();
207
+ outEdgeIds.clear();
208
+ initializeVectorStructures();
209
+ return *this;
210
+ }
211
+
212
+ /** copy assignment operator */
213
+ GraphW &operator=(const GraphW &other) {
214
+ Graph::operator=(other);
215
+ inEdges = other.inEdges;
216
+ outEdges = other.outEdges;
217
+ inEdgeWeights = other.inEdgeWeights;
218
+ outEdgeWeights = other.outEdgeWeights;
219
+ inEdgeIds = other.inEdgeIds;
220
+ outEdgeIds = other.outEdgeIds;
221
+ return *this;
222
+ }
223
+
224
+ /** copy assignment operator */
225
+ GraphW &operator=(const Graph &other) {
226
+ Graph::operator=(other);
227
+ // Clear existing vectors before reinitializing to avoid keeping old edge data
228
+ inEdges.clear();
229
+ outEdges.clear();
230
+ inEdgeWeights.clear();
231
+ outEdgeWeights.clear();
232
+ inEdgeIds.clear();
233
+ outEdgeIds.clear();
234
+ initializeVectorStructures();
235
+ return *this;
236
+ }
237
+
238
+ /** EDGE IDS **/
239
+
240
+ /**
241
+ * Initially assign integer edge identifiers.
242
+ *
243
+ * @param force Force re-indexing of edges even if they have already been
244
+ * indexed
245
+ */
246
+ void indexEdges(bool force = false);
247
+
248
+ /** GRAPH INFORMATION **/
249
+
250
+ /**
251
+ * Try to save some memory by shrinking internal data structures of the
252
+ * graph. Only run this once you finished editing the graph. Otherwise it
253
+ * will cause unnecessary reallocation of memory.
254
+ */
255
+ void shrinkToFit();
256
+
257
+ /**
258
+ * DEPRECATED: this function will no longer be supported in later releases.
259
+ * Compacts the adjacency arrays by re-using no longer needed slots from
260
+ * deleted edges.
261
+ */
262
+ void TLX_DEPRECATED(compactEdges());
263
+
264
+ /**
265
+ * Sorts the outgoing neighbors of a given node according to a user-defined comparison function.
266
+ *
267
+ * @param u The node whose outgoing neighbors will be sorted.
268
+ * @param lambda A binary predicate used to compare two neighbors. The predicate should
269
+ * take two nodes as arguments and return true if the first node should
270
+ * precede the second in the sorted order.
271
+ */
272
+ template <typename Lambda>
273
+ void sortNeighbors(node u, Lambda lambda) {
274
+ assert(hasNode(u));
275
+
276
+ if ((degreeIn(u) < 2) && (degree(u) < 2)) {
277
+ return;
278
+ }
279
+
280
+ // Sort the outEdge-Attributes
281
+ std::vector<index> outIndices(outEdges[u].size());
282
+ std::iota(outIndices.begin(), outIndices.end(), 0);
283
+ std::ranges::sort(outIndices,
284
+ [&](index a, index b) { return lambda(outEdges[u][a], outEdges[u][b]); });
285
+
286
+ Aux::ArrayTools::applyPermutation(outEdges[u].begin(), outEdges[u].end(),
287
+ outIndices.begin());
288
+
289
+ if (weighted) {
290
+ Aux::ArrayTools::applyPermutation(outEdgeWeights[u].begin(), outEdgeWeights[u].end(),
291
+ outIndices.begin());
292
+ }
293
+
294
+ if (edgesIndexed) {
295
+ Aux::ArrayTools::applyPermutation(outEdgeIds[u].begin(), outEdgeIds[u].end(),
296
+ outIndices.begin());
297
+ }
298
+
299
+ if (directed) {
300
+ // Sort in-edges by the same ordering (by target node)
301
+ // First, find the permutation that sorts inEdges[u] by the corresponding outEdges
302
+ std::vector<index> inIndices(inEdges[u].size());
303
+ std::iota(inIndices.begin(), inIndices.end(), 0);
304
+ std::ranges::sort(
305
+ inIndices, [&](index a, index b) { return lambda(inEdges[u][a], inEdges[u][b]); });
306
+ Aux::ArrayTools::applyPermutation(inEdges[u].begin(), inEdges[u].end(),
307
+ inIndices.begin());
308
+
309
+ if (edgesIndexed) {
310
+ Aux::ArrayTools::applyPermutation(inEdgeIds[u].begin(), inEdgeIds[u].end(),
311
+ inIndices.begin());
312
+ }
313
+ }
314
+ }
315
+
316
+ /**
317
+ * Sorts the adjacency arrays by node id. While the running time is linear
318
+ * this temporarily duplicates the memory.
319
+ */
320
+ void sortEdges();
321
+
322
+ /**
323
+ * Sorts the adjacency arrays by a custom criterion.
324
+ *
325
+ * @param lambda Lambda function used to sort the edges. It takes two WeightedEdge
326
+ * e1 and e2 as input parameters, returns true if e1 < e2, false otherwise.
327
+ */
328
+ template <class Lambda>
329
+ void sortEdges(Lambda lambda) {
330
+ parallelForNodes([&](node u) {
331
+ if (isWeighted()) {
332
+ std::vector<WeightedEdge> edges;
333
+ forNeighborsOf(u, [&](node v, edgeweight w) { edges.emplace_back(u, v, w); });
334
+ std::sort(edges.begin(), edges.end(), lambda);
335
+
336
+ removePartialOutEdges(unsafe, u);
337
+ for (const auto &edge : edges) {
338
+ addPartialOutEdge(unsafe, edge.u, edge.v, edge.weight);
339
+ }
340
+ } else {
341
+ std::vector<node> neighbors(outEdges[u]);
342
+ std::sort(neighbors.begin(), neighbors.end(), [&](node v1, node v2) {
343
+ return lambda(WeightedEdge(u, v1, defaultEdgeWeight),
344
+ WeightedEdge(u, v2, defaultEdgeWeight));
345
+ });
346
+
347
+ removePartialOutEdges(unsafe, u);
348
+ for (node v : neighbors) {
349
+ addPartialOutEdge(unsafe, u, v);
350
+ }
351
+ }
352
+ });
353
+ }
354
+
355
+ /**
356
+ * Set edge count of the graph to edges.
357
+ * @param edges the edge count of a graph
358
+ */
359
+ void setEdgeCount(Unsafe, count edges) { m = edges; }
360
+
361
+ /**
362
+ * Set upper bound of edge count.
363
+ *
364
+ * @param newBound New upper edge id bound.
365
+ */
366
+ void setUpperEdgeIdBound(Unsafe, edgeid newBound) { omega = newBound; }
367
+
368
+ /**
369
+ * Set the number of self-loops.
370
+ *
371
+ * @param loops New number of self-loops.
372
+ */
373
+ void setNumberOfSelfLoops(Unsafe, count loops) { storedNumberOfSelfLoops = loops; }
374
+
375
+ /* NODE MODIFIERS */
376
+
377
+ /**
378
+ * Add a new node to the graph and return it.
379
+ * @return The new node.
380
+ */
381
+ node addNode();
382
+
383
+ /**
384
+ * Add numberOfNewNodes new nodes.
385
+ * @param numberOfNewNodes Number of new nodes.
386
+ * @return The index of the last node added.
387
+ */
388
+ node addNodes(count numberOfNewNodes);
389
+
390
+ /**
391
+ * Remove a node @a v and all incident edges from the graph.
392
+ *
393
+ * Incoming as well as outgoing edges will be removed.
394
+ *
395
+ * @param v Node.
396
+ */
397
+ void removeNode(node v);
398
+
399
+ /**
400
+ * Removes out-going edges from node @u. If the graph is weighted and/or has edge ids, weights
401
+ * and/or edge ids will also be removed.
402
+ *
403
+ * @param u Node.
404
+ */
405
+ void removePartialOutEdges(Unsafe, node u) {
406
+ assert(hasNode(u));
407
+ outEdges[u].clear();
408
+ if (isWeighted()) {
409
+ outEdgeWeights[u].clear();
410
+ }
411
+ if (hasEdgeIds()) {
412
+ outEdgeIds[u].clear();
413
+ }
414
+ }
415
+
416
+ /**
417
+ * Removes in-going edges to node @u. If the graph is weighted and/or has edge ids, weights
418
+ * and/or edge ids will also be removed.
419
+ *
420
+ * @param u Node.
421
+ */
422
+ void removePartialInEdges(Unsafe, node u) {
423
+ assert(hasNode(u));
424
+ inEdges[u].clear();
425
+ if (isWeighted()) {
426
+ inEdgeWeights[u].clear();
427
+ }
428
+ if (hasEdgeIds()) {
429
+ inEdgeIds[u].clear();
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Restores a previously deleted node @a v with its previous id in the
435
+ * graph.
436
+ *
437
+ * @param v Node.
438
+ *
439
+ */
440
+ void restoreNode(node v);
441
+
442
+ /* EDGE MODIFIERS */
443
+
444
+ /**
445
+ * Insert an edge between the nodes @a u and @a v. If the graph is
446
+ * weighted you can optionally set a weight for this edge. The default
447
+ * weight is 1.0. Note: Multi-edges are not supported and will NOT be
448
+ * handled consistently by the graph data structure. It is possible to check
449
+ * for multi-edges by enabling parameter "checkForMultiEdges". If already present,
450
+ * the new edge is not inserted. Enabling this check increases the complexity of the function
451
+ * to O(max(deg(u), deg(v))).
452
+ * @param u Endpoint of edge.
453
+ * @param v Endpoint of edge.
454
+ * @param ew Optional edge weight.
455
+ * @param checkMultiEdge If true, this enables a check for a possible multi-edge.
456
+ * @return @c true if edge has been added, false otherwise (in case checkMultiEdge is set to
457
+ * true and the new edge would have been a multi-edge.)
458
+ */
459
+ bool addEdge(node u, node v, edgeweight ew = defaultEdgeWeight, bool checkMultiEdge = false);
460
+
461
+ /**
462
+ * Insert an edge between the nodes @a u and @a v. Unlike the addEdge function, this function
463
+ * does not add any information to v. If the graph is weighted you can optionally set a
464
+ * weight for this edge. The default weight is 1.0. Note: Multi-edges are not supported and will
465
+ * NOT be handled consistently by the graph data structure. It is possible to check
466
+ * for multi-edges by enabling parameter "checkForMultiEdges". If already present,
467
+ * the new edge is not inserted. Enabling this check increases the complexity of the function
468
+ * to O(max(deg(u), deg(v))).
469
+ * @param u Endpoint of edge.
470
+ * @param v Endpoint of edge.
471
+ * @param ew Optional edge weight.
472
+ * @param index Optional edge index.
473
+ * @param checkForMultiEdges If true, this enables a check for a possible multi-edge.
474
+ * @return @c true if edge has been added, false otherwise (in case checkMultiEdge is set to
475
+ * true and the new edge would have been a multi-edge.)
476
+ */
477
+ bool addPartialEdge(Unsafe, node u, node v, edgeweight ew = defaultEdgeWeight,
478
+ uint64_t index = 0, bool checkForMultiEdges = false);
479
+
480
+ /**
481
+ * Insert an in edge between the nodes @a u and @a v in a directed graph. If the graph is
482
+ * weighted you can optionally set a weight for this edge. The default
483
+ * weight is 1.0. Note: Multi-edges are not supported and will NOT be
484
+ * handled consistently by the graph data structure. It is possible to check
485
+ * for multi-edges by enabling parameter "checkForMultiEdges". If already present,
486
+ * the new edge is not inserted. Enabling this check increases the complexity of the function
487
+ * to O(max(deg(u), deg(v))).
488
+ * @param u Endpoint of edge.
489
+ * @param v Endpoint of edge.
490
+ * @param ew Optional edge weight.
491
+ * @param index Optional edge index.
492
+ * @param checkForMultiEdges If true, this enables a check for a possible multi-edge.
493
+ * @return @c true if edge has been added, false otherwise (in case checkMultiEdge is set to
494
+ * true and the new edge would have been a multi-edge.)
495
+ */
496
+ bool addPartialInEdge(Unsafe, node u, node v, edgeweight ew = defaultEdgeWeight,
497
+ uint64_t index = 0, bool checkForMultiEdges = false);
498
+
499
+ /**
500
+ * Insert an out edge between the nodes @a u and @a v in a directed graph. If the graph is
501
+ * weighted you can optionally set a weight for this edge. The default
502
+ * weight is 1.0. Note: Multi-edges are not supported and will NOT be
503
+ * handled consistently by the graph data structure. It is possible to check
504
+ * for multi-edges by enabling parameter "checkForMultiEdges". If already present,
505
+ * the new edge is not inserted. Enabling this check increases the complexity of the function
506
+ * to O(max(deg(u), deg(v))).
507
+ * @param u Endpoint of edge.
508
+ * @param v Endpoint of edge.
509
+ * @param ew Optional edge weight.
510
+ * @param index Optional edge index.
511
+ * @param checkForMultiEdges If true, this enables a check for a possible multi-edge.
512
+ * @return @c true if edge has been added, false otherwise (in case checkMultiEdge is set to
513
+ * true and the new edge would have been a multi-edge.)
514
+ */
515
+ bool addPartialOutEdge(Unsafe, node u, node v, edgeweight ew = defaultEdgeWeight,
516
+ uint64_t index = 0, bool checkForMultiEdges = false);
517
+
518
+ /**
519
+ * If set to true, the ingoing and outgoing adjacency vectors will
520
+ * automatically be updated to maintain a sorting (if it existed before) by performing up to n-1
521
+ * swaps. If the user plans to remove multiple edges, better set it to false and call
522
+ * sortEdges() afterwards to avoid redundant swaps. Default = true.
523
+ */
524
+ void setKeepEdgesSorted(bool sorted = true) { maintainSortedEdges = sorted; }
525
+
526
+ /**
527
+ * If set to true, the EdgeIDs will automatically be adjusted,
528
+ * so that no gaps in between IDs exist. If the user plans to remove multiple edges, better set
529
+ * it to false and call indexEdges(force=true) afterwards to avoid redundant re-indexing.
530
+ * Default = true.
531
+ */
532
+ void setMaintainCompactEdges(bool compact = true) { maintainCompactEdges = compact; }
533
+
534
+ /**
535
+ * Removes the undirected edge {@a u,@a v}.
536
+ * @param u Endpoint of edge.
537
+ * @param v Endpoint of edge.
538
+ */
539
+ void removeEdge(node u, node v);
540
+
541
+ /**
542
+ * Removes all the edges in the graph.
543
+ */
544
+ void removeAllEdges();
545
+
546
+ /**
547
+ * Removes edges adjacent to a node according to a specific criterion.
548
+ *
549
+ * @param u The node whose adjacent edges shall be removed.
550
+ * @param condition A function that takes a node as an input and returns a
551
+ * bool. If true the edge (u, v) is removed.
552
+ * @param edgesIn Whether in-going or out-going edges shall be removed.
553
+ * @return std::pair<count, count> The number of removed edges (first) and the number of removed
554
+ * self-loops (second).
555
+ */
556
+ template <typename Condition>
557
+ std::pair<count, count> removeAdjacentEdges(node u, Condition condition, bool edgesIn = false) {
558
+ count removedEdges = 0;
559
+ count removedSelfLoops = 0;
560
+
561
+ // For directed graphs, this function is supposed to be called twice: one to remove
562
+ // out-edges, and one to remove in-edges.
563
+ auto &edges_ = edgesIn ? inEdges[u] : outEdges[u];
564
+ for (index vi = 0; vi < edges_.size();) {
565
+ if (condition(edges_[vi])) {
566
+ const auto isSelfLoop = (edges_[vi] == u);
567
+ removedSelfLoops += isSelfLoop;
568
+ removedEdges += !isSelfLoop;
569
+ edges_[vi] = edges_.back();
570
+ edges_.pop_back();
571
+ if (isWeighted()) {
572
+ auto &weights_ = edgesIn ? inEdgeWeights[u] : outEdgeWeights[u];
573
+ weights_[vi] = weights_.back();
574
+ weights_.pop_back();
575
+ }
576
+ if (hasEdgeIds()) {
577
+ auto &edgeIds_ = edgesIn ? inEdgeIds[u] : outEdgeIds[u];
578
+ edgeIds_[vi] = edgeIds_.back();
579
+ edgeIds_.pop_back();
580
+ }
581
+ } else {
582
+ ++vi;
583
+ }
584
+ }
585
+
586
+ return {removedEdges, removedSelfLoops};
587
+ }
588
+
589
+ /**
590
+ * Removes all self-loops in the graph.
591
+ */
592
+ void removeSelfLoops();
593
+
594
+ /**
595
+ * Removes all multi-edges in the graph.
596
+ */
597
+ void removeMultiEdges();
598
+
599
+ /**
600
+ * Changes the edges {@a s1, @a t1} into {@a s1, @a t2} and the edge {@a
601
+ * s2,
602
+ * @a t2} into {@a s2, @a t1}.
603
+ *
604
+ * If there are edge weights or edge ids, they are preserved. Note that no
605
+ * check is performed if the swap is actually possible, i.e. does not
606
+ * generate duplicate edges.
607
+ *
608
+ * @param s1 The first source
609
+ * @param t1 The first target
610
+ * @param s2 The second source
611
+ * @param t2 The second target
612
+ */
613
+ void swapEdge(node s1, node t1, node s2, node t2);
614
+
615
+ /**
616
+ * Return edge weight of edge {@a u,@a v}. Returns 0 if edge does not
617
+ * exist. BEWARE: Running time is \Theta(deg(u))!
618
+ *
619
+ * @param u Endpoint of edge.
620
+ * @param v Endpoint of edge.
621
+ * @return Edge weight of edge {@a u,@a v} or 0 if edge does not exist.
622
+ */
623
+ edgeweight weight(node u, node v) const override;
624
+
625
+ /**
626
+ * Set edge weight of edge {@a u,@a v}. BEWARE: Running time is \Theta(deg(u))!
627
+ *
628
+ * @param u Endpoint of edge.
629
+ * @param v Endpoint of edge.
630
+ * @param ew New edge weight.
631
+ */
632
+ void setWeight(node u, node v, edgeweight ew);
633
+
634
+ /**
635
+ * Set edge weight of the @a i-th outgoing edge of node @a u. BEWARE: Running time is constant.
636
+ *
637
+ * @param u Endpoint of edge.
638
+ * @param i Index of the outgoing edge.
639
+ * @param ew New edge weight.
640
+ */
641
+ void setWeightAtIthNeighbor(Unsafe, node u, index i, edgeweight ew) override;
642
+
643
+ /**
644
+ * Set edge weight of the @a i-th incoming edge of node @a u. BEWARE: Running time is constant.
645
+ *
646
+ * @param u Endpoint of edge.
647
+ * @param i Index of the incoming edge.
648
+ * @param ew New edge weight.
649
+ */
650
+ void setWeightAtIthInNeighbor(Unsafe, node u, index i, edgeweight ew) override;
651
+
652
+ /**
653
+ * Increase edge weight of edge {@a u,@a v} by @a ew. BEWARE: Running time is \Theta(deg(u))!
654
+ *
655
+ * @param u Endpoint of edge.
656
+ * @param v Endpoint of edge.
657
+ * @param ew Edge weight increase.
658
+ */
659
+ void increaseWeight(node u, node v, edgeweight ew);
660
+
661
+ /**
662
+ * Reserves memory in the node's edge containers for undirected graphs.
663
+ *
664
+ * @param u the node memory should be reserved for
665
+ * @param size the amount of memory to reserve
666
+ *
667
+ * This function is thread-safe if called from different
668
+ * threads on different nodes.
669
+ */
670
+ void preallocateUndirected(node u, size_t size);
671
+
672
+ /**
673
+ * Reserves memory in the node's edge containers for directed graphs.
674
+ *
675
+ * @param u the node memory should be reserved for
676
+ * @param inSize the amount of memory to reserve for in edges
677
+ * @param outSize the amount of memory to reserve for out edges
678
+ *
679
+ * This function is thread-safe if called from different
680
+ * threads on different nodes.
681
+ */
682
+ void preallocateDirected(node u, size_t outSize, size_t inSize);
683
+
684
+ /**
685
+ * Reserves memory in the node's edge containers for directed graphs.
686
+ *
687
+ * @param u the node memory should be reserved for
688
+ * @param outSize the amount of memory to reserve for out edges
689
+ *
690
+ * This function is thread-safe if called from different
691
+ * threads on different nodes.
692
+ */
693
+ void preallocateDirectedOutEdges(node u, size_t outSize);
694
+
695
+ /**
696
+ * Reserves memory in the node's edge containers for directed graphs.
697
+ *
698
+ * @param u the node memory should be reserved for
699
+ * @param inSize the amount of memory to reserve for in edges
700
+ *
701
+ * This function is thread-safe if called from different
702
+ * threads on different nodes.
703
+ */
704
+ void preallocateDirectedInEdges(node u, size_t inSize);
705
+
706
+ // Override base class methods to provide vector-based implementations
707
+
708
+ /**
709
+ * Returns the number of outgoing neighbors of @a v.
710
+ *
711
+ * @param v Node.
712
+ * @return The number of outgoing neighbors.
713
+ */
714
+ count degree(node v) const override {
715
+ assert(hasNode(v));
716
+ return outEdges[v].size();
717
+ }
718
+
719
+ count degreeIn(node v) const override {
720
+ assert(hasNode(v));
721
+ if (directed) {
722
+ return inEdges[v].size();
723
+ }
724
+ return outEdges[v].size();
725
+ }
726
+
727
+ bool isIsolated(node v) const override {
728
+ if (!hasNode(v))
729
+ throw std::runtime_error("Error, the node does not exist!");
730
+ if (directed) {
731
+ return outEdges[v].size() == 0 && inEdges[v].size() == 0;
732
+ }
733
+ return outEdges[v].size() == 0;
734
+ }
735
+
736
+ edgeid edgeId(node u, node v) const override;
737
+
738
+ index indexInOutEdgeArray(node u, node v) const override;
739
+
740
+ index indexInInEdgeArray(node v, node u) const override;
741
+
742
+ /**
743
+ * Return the i-th (outgoing) neighbor of @a u.
744
+ *
745
+ * @param u Node.
746
+ * @param i index; should be in [0, degreeOut(u))
747
+ * @return @a i-th (outgoing) neighbor of @a u, or @c none if no such
748
+ * neighbor exists.
749
+ */
750
+ node getIthNeighbor(Unsafe, node u, index i) const override { return outEdges[u][i]; }
751
+
752
+ /**
753
+ * Return the weight to the i-th (outgoing) neighbor of @a u.
754
+ *
755
+ * @param u Node.
756
+ * @param i index; should be in [0, degreeOut(u))
757
+ * @return @a edge weight to the i-th (outgoing) neighbor of @a u, or @c +inf if no such
758
+ * neighbor exists.
759
+ */
760
+ edgeweight getIthNeighborWeight(Unsafe, node u, index i) const {
761
+ return isWeighted() ? outEdgeWeights[u][i] : defaultEdgeWeight;
762
+ }
763
+
764
+ /**
765
+ * Return the i-th (outgoing) neighbor of @a u.
766
+ *
767
+ * @param u Node.
768
+ * @param i index; should be in [0, degreeOut(u))
769
+ * @return @a i-th (outgoing) neighbor of @a u, or @c none if no such
770
+ * neighbor exists.
771
+ */
772
+ node getIthNeighbor(node u, index i) const override {
773
+ if (!hasNode(u) || i >= outEdges[u].size())
774
+ return none;
775
+ return outEdges[u][i];
776
+ }
777
+
778
+ /**
779
+ * Return the i-th (incoming) neighbor of @a u.
780
+ *
781
+ * @param u Node.
782
+ * @param i index; should be in [0, degreeIn(u))
783
+ * @return @a i-th (incoming) neighbor of @a u, or @c none if no such
784
+ * neighbor exists.
785
+ */
786
+ node getIthInNeighbor(node u, index i) const override {
787
+ if (!hasNode(u) || i >= inEdges[u].size())
788
+ return none;
789
+ return inEdges[u][i];
790
+ }
791
+
792
+ /**
793
+ * Return the weight to the i-th (outgoing) neighbor of @a u.
794
+ *
795
+ * @param u Node.
796
+ * @param i index; should be in [0, degreeOut(u))
797
+ * @return @a edge weight to the i-th (outgoing) neighbor of @a u, or @c +inf if no such
798
+ * neighbor exists.
799
+ */
800
+ edgeweight getIthNeighborWeight(node u, index i) const override {
801
+ if (!hasNode(u) || i >= outEdges[u].size())
802
+ return nullWeight;
803
+ return isWeighted() ? outEdgeWeights[u][i] : defaultEdgeWeight;
804
+ }
805
+
806
+ /**
807
+ * Get i-th (outgoing) neighbor of @a u and the corresponding edge weight.
808
+ *
809
+ * @param u Node.
810
+ * @param i index; should be in [0, degreeOut(u))
811
+ * @return pair: i-th (outgoing) neighbor of @a u and the corresponding
812
+ * edge weight, or @c defaultEdgeWeight if unweighted.
813
+ */
814
+ std::pair<node, edgeweight> getIthNeighborWithWeight(node u, index i) const override {
815
+ if (!hasNode(u) || i >= outEdges[u].size())
816
+ return {none, none};
817
+ return getIthNeighborWithWeight(unsafe, u, i);
818
+ }
819
+
820
+ /**
821
+ * Get i-th (outgoing) neighbor of @a u and the corresponding edge weight.
822
+ *
823
+ * @param u Node.
824
+ * @param i index; should be in [0, degreeOut(u))
825
+ * @return pair: i-th (outgoing) neighbor of @a u and the corresponding
826
+ * edge weight, or @c defaultEdgeWeight if unweighted.
827
+ */
828
+ std::pair<node, edgeweight> getIthNeighborWithWeight(Unsafe, node u, index i) const {
829
+ if (!isWeighted())
830
+ return {outEdges[u][i], defaultEdgeWeight};
831
+ return {outEdges[u][i], outEdgeWeights[u][i]};
832
+ }
833
+
834
+ /**
835
+ * Get i-th (outgoing) neighbor of @a u and the corresponding edge id.
836
+ *
837
+ * @param u Node.
838
+ * @param i index; should be in [0, degreeOut(u))
839
+ * @return pair: i-th (outgoing) neighbor of @a u and the corresponding
840
+ * edge id, or @c none if no such neighbor exists.
841
+ */
842
+ std::pair<node, edgeid> getIthNeighborWithId(node u, index i) const override {
843
+ assert(hasEdgeIds());
844
+ if (!hasNode(u) || i >= outEdges[u].size())
845
+ return {none, none};
846
+ return {outEdges[u][i], outEdgeIds[u][i]};
847
+ }
848
+
849
+ private:
850
+ // Override template method implementations to use vector-based storage
851
+
852
+ /**
853
+ * Returns the edge weight of the outgoing edge of index i in the outgoing
854
+ * edges of node u
855
+ * @param u The node
856
+ * @param i The index
857
+ * @return The weight of the outgoing edge or defaultEdgeWeight if the graph
858
+ * is unweighted
859
+ */
860
+ template <bool hasWeights>
861
+ inline edgeweight getOutEdgeWeight(node u, index i) const;
862
+
863
+ /**
864
+ * Returns the edge weight of the incoming edge of index i in the incoming
865
+ * edges of node u
866
+ *
867
+ * @param u The node
868
+ * @param i The index in the incoming edge array
869
+ * @return The weight of the incoming edge
870
+ */
871
+ template <bool hasWeights>
872
+ inline edgeweight getInEdgeWeight(node u, index i) const;
873
+
874
+ /**
875
+ * Returns the edge id of the edge of index i in the outgoing edges of node
876
+ * u
877
+ *
878
+ * @param u The node
879
+ * @param i The index in the outgoing edges
880
+ * @return The edge id
881
+ */
882
+ template <bool graphHasEdgeIds>
883
+ inline edgeid getOutEdgeId(node u, index i) const;
884
+
885
+ /**
886
+ * Returns the edge id of the edge of index i in the incoming edges of node
887
+ * u
888
+ *
889
+ * @param u The node
890
+ * @param i The index in the incoming edges of u
891
+ * @return The edge id
892
+ */
893
+ template <bool graphHasEdgeIds>
894
+ inline edgeid getInEdgeId(node u, index i) const;
895
+
896
+ /**
897
+ * @brief Returns if the edge (u, v) shall be used in the iteration of all
898
+ * edgesIndexed
899
+ *
900
+ * @param u The source node of the edge
901
+ * @param v The target node of the edge
902
+ * @return If the node shall be used, i.e. if v is not none and in the
903
+ * undirected case if u >= v
904
+ */
905
+ template <bool graphIsDirected>
906
+ inline bool useEdgeInIteration(node u, node v) const;
907
+
908
+ /**
909
+ * @brief Implementation of the for loop for outgoing edges of u
910
+ *
911
+ * Note: If all (valid) outgoing edges shall be considered, graphIsDirected
912
+ * needs to be set to true
913
+ *
914
+ * @param u The node
915
+ * @param handle The handle that shall be executed for each edge
916
+ * @return void
917
+ */
918
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
919
+ inline void forOutEdgesOfImpl(node u, L handle) const;
920
+
921
+ /**
922
+ * @brief Implementation of the for loop for incoming edges of u
923
+ *
924
+ * For undirected graphs, this is the same as forOutEdgesOfImpl but u and v
925
+ * are changed in the handle
926
+ *
927
+ * @param u The node
928
+ * @param handle The handle that shall be executed for each edge
929
+ * @return void
930
+ */
931
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
932
+ inline void forInEdgesOfImpl(node u, L handle) const;
933
+
934
+ /**
935
+ * @brief Summation variant of the parallel for loop for all edges, @see
936
+ * parallelSumForEdges
937
+ *
938
+ * @param handle The handle that shall be executed for all edges
939
+ * @return void
940
+ */
941
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
942
+ inline double parallelSumForEdgesImpl(L handle) const;
943
+
944
+ /**
945
+ * @brief Override for vector-based edge iteration
946
+ */
947
+ void
948
+ forEdgesVirtualImpl(bool directed, bool weighted, bool hasEdgeIds,
949
+ std::function<void(node, node, edgeweight, edgeid)> handle) const override;
950
+
951
+ /**
952
+ * @brief Override for vector-based forEdgesOf
953
+ */
954
+ void forEdgesOfVirtualImpl(
955
+ node u, bool directed, bool weighted, bool hasEdgeIds,
956
+ std::function<void(node, node, edgeweight, edgeid)> handle) const override;
957
+
958
+ /**
959
+ * @brief Override for vector-based forInEdgesOf
960
+ */
961
+ void forInEdgesVirtualImpl(
962
+ node u, bool directed, bool weighted, bool hasEdgeIds,
963
+ std::function<void(node, node, edgeweight, edgeid)> handle) const override;
964
+
965
+ /**
966
+ * @brief Override for vector-based parallelSumForEdges
967
+ */
968
+ double parallelSumForEdgesVirtualImpl(
969
+ bool directed, bool weighted, bool hasEdgeIds,
970
+ std::function<double(node, node, edgeweight, edgeid)> handle) const override;
971
+
972
+ /**
973
+ * @brief Override for hasEdge - vector-based implementation
974
+ */
975
+ bool hasEdgeImpl(node u, node v) const override;
976
+
977
+ protected:
978
+ /**
979
+ * Get neighbors as a vector (vector-based implementation)
980
+ */
981
+ std::vector<node> getNeighborsVector(node u, bool inEdges = false) const override;
982
+
983
+ /**
984
+ * Get neighbors with weights as vectors (vector-based implementation)
985
+ */
986
+ std::pair<std::vector<node>, std::vector<edgeweight>>
987
+ getNeighborsWithWeightsVector(node u, bool inEdges = false) const override;
988
+
989
+ public:
990
+ /**
991
+ * Wrapper class to iterate over a range of the neighbors of a node within
992
+ * a for loop.
993
+ */
994
+ template <bool InEdges = false>
995
+ class NeighborRange {
996
+ const GraphW *G;
997
+ node u{none};
998
+
999
+ public:
1000
+ NeighborRange(const GraphW &G, node u) : G(&G), u(u) { assert(G.hasNode(u)); };
1001
+
1002
+ NeighborRange() : G(nullptr){};
1003
+
1004
+ NeighborIterator begin() const {
1005
+ assert(G);
1006
+ return InEdges ? NeighborIterator(G->inEdges[u].begin())
1007
+ : NeighborIterator(G->outEdges[u].begin());
1008
+ }
1009
+
1010
+ NeighborIterator end() const {
1011
+ assert(G);
1012
+ return InEdges ? NeighborIterator(G->inEdges[u].end())
1013
+ : NeighborIterator(G->outEdges[u].end());
1014
+ }
1015
+
1016
+ // Conversion operator to Graph::NeighborRange for Cython compatibility
1017
+ operator typename Graph::NeighborRange<InEdges>() const {
1018
+ throw std::runtime_error(
1019
+ "Conversion from GraphW::NeighborRange to Graph::NeighborRange not supported - "
1020
+ "iterator methods not implemented in base Graph class");
1021
+ }
1022
+ };
1023
+
1024
+ using OutNeighborRange = NeighborRange<false>;
1025
+ using InNeighborRange = NeighborRange<true>;
1026
+
1027
+ /**
1028
+ * Wrapper class to iterate over a range of the neighbors of a node
1029
+ * including the edge weights within a for loop.
1030
+ * Values are std::pair<node, edgeweight>.
1031
+ */
1032
+ template <bool InEdges = false>
1033
+ class NeighborWeightRange {
1034
+ const GraphW *G;
1035
+ node u{none};
1036
+
1037
+ public:
1038
+ NeighborWeightRange(const GraphW &G, node u) : G(&G), u(u) { assert(G.hasNode(u)); };
1039
+
1040
+ NeighborWeightRange() : G(nullptr){};
1041
+
1042
+ NeighborWeightIterator begin() const {
1043
+ assert(G);
1044
+ return InEdges
1045
+ ? NeighborWeightIterator(G->inEdges[u].begin(), G->inEdgeWeights[u].begin())
1046
+ : NeighborWeightIterator(G->outEdges[u].begin(),
1047
+ G->outEdgeWeights[u].begin());
1048
+ }
1049
+
1050
+ NeighborWeightIterator end() const {
1051
+ assert(G);
1052
+ return InEdges
1053
+ ? NeighborWeightIterator(G->inEdges[u].end(), G->inEdgeWeights[u].end())
1054
+ : NeighborWeightIterator(G->outEdges[u].end(), G->outEdgeWeights[u].end());
1055
+ }
1056
+
1057
+ // Conversion operator to Graph::NeighborWeightRange for Cython compatibility
1058
+ operator typename Graph::NeighborWeightRange<InEdges>() const {
1059
+ throw std::runtime_error(
1060
+ "Conversion from GraphW::NeighborWeightRange to Graph::NeighborWeightRange not "
1061
+ "supported - iterator methods not implemented in base Graph class");
1062
+ }
1063
+ };
1064
+
1065
+ using OutNeighborWeightRange = NeighborWeightRange<false>;
1066
+ using InNeighborWeightRange = NeighborWeightRange<true>;
1067
+
1068
+ /**
1069
+ * Get an iterable range over the neighbors of @a.
1070
+ *
1071
+ * @param u Node.
1072
+ * @return Iterator range over the neighbors of @a u.
1073
+ */
1074
+ NeighborRange<false> neighborRange(node u) const {
1075
+ assert(exists[u]);
1076
+ return NeighborRange<false>(*this, u);
1077
+ }
1078
+
1079
+ /**
1080
+ * Get an iterable range over the neighbors of @a u including the edge
1081
+ * weights.
1082
+ *
1083
+ * @param u Node.
1084
+ * @return Iterator range over pairs of neighbors of @a u and corresponding
1085
+ * edge weights.
1086
+ */
1087
+ NeighborWeightRange<false> weightNeighborRange(node u) const {
1088
+ assert(isWeighted());
1089
+ assert(exists[u]);
1090
+ return NeighborWeightRange<false>(*this, u);
1091
+ }
1092
+
1093
+ /**
1094
+ * Get an iterable range over the in-neighbors of @a.
1095
+ *
1096
+ * @param u Node.
1097
+ * @return Iterator range over pairs of in-neighbors of @a u.
1098
+ */
1099
+ NeighborRange<true> inNeighborRange(node u) const {
1100
+ assert(isDirected());
1101
+ assert(exists[u]);
1102
+ return NeighborRange<true>(*this, u);
1103
+ }
1104
+
1105
+ /**
1106
+ * Get an iterable range over the in-neighbors of @a u including the
1107
+ * edge weights.
1108
+ *
1109
+ * @param u Node.
1110
+ * @return Iterator range over pairs of in-neighbors of @a u and corresponding
1111
+ * edge weights.
1112
+ */
1113
+ NeighborWeightRange<true> weightInNeighborRange(node u) const {
1114
+ assert(isDirected() && isWeighted());
1115
+ assert(exists[u]);
1116
+ return NeighborWeightRange<true>(*this, u);
1117
+ }
1118
+ };
1119
+
1120
+ // Template method implementations for GraphW
1121
+
1122
+ // implementation for weighted == true
1123
+ template <bool hasWeights>
1124
+ inline edgeweight GraphW::getOutEdgeWeight(node u, index i) const {
1125
+ return outEdgeWeights[u][i];
1126
+ }
1127
+
1128
+ // implementation for weighted == false
1129
+ template <>
1130
+ inline edgeweight GraphW::getOutEdgeWeight<false>(node, index) const {
1131
+ return defaultEdgeWeight;
1132
+ }
1133
+
1134
+ // implementation for weighted == true
1135
+ template <bool hasWeights>
1136
+ inline edgeweight GraphW::getInEdgeWeight(node u, index i) const {
1137
+ return inEdgeWeights[u][i];
1138
+ }
1139
+
1140
+ // implementation for weighted == false
1141
+ template <>
1142
+ inline edgeweight GraphW::getInEdgeWeight<false>(node, index) const {
1143
+ return defaultEdgeWeight;
1144
+ }
1145
+
1146
+ // implementation for hasEdgeIds == true
1147
+ template <bool graphHasEdgeIds>
1148
+ inline edgeid GraphW::getOutEdgeId(node u, index i) const {
1149
+ return outEdgeIds[u][i];
1150
+ }
1151
+
1152
+ // implementation for hasEdgeIds == false
1153
+ template <>
1154
+ inline edgeid GraphW::getOutEdgeId<false>(node, index) const {
1155
+ return none;
1156
+ }
1157
+
1158
+ // implementation for hasEdgeIds == true
1159
+ template <bool graphHasEdgeIds>
1160
+ inline edgeid GraphW::getInEdgeId(node u, index i) const {
1161
+ return inEdgeIds[u][i];
1162
+ }
1163
+
1164
+ // implementation for hasEdgeIds == false
1165
+ template <>
1166
+ inline edgeid GraphW::getInEdgeId<false>(node, index) const {
1167
+ return none;
1168
+ }
1169
+
1170
+ // implementation for graphIsDirected == true
1171
+ template <bool graphIsDirected>
1172
+ inline bool GraphW::useEdgeInIteration(node /* u */, node /* v */) const {
1173
+ return true;
1174
+ }
1175
+
1176
+ // implementation for graphIsDirected == false
1177
+ template <>
1178
+ inline bool GraphW::useEdgeInIteration<false>(node u, node v) const {
1179
+ return u >= v;
1180
+ }
1181
+
1182
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
1183
+ inline void GraphW::forOutEdgesOfImpl(node u, L handle) const {
1184
+ for (index i = 0; i < outEdges[u].size(); ++i) {
1185
+ node v = outEdges[u][i];
1186
+
1187
+ if (useEdgeInIteration<graphIsDirected>(u, v)) {
1188
+ Graph::edgeLambda<L>(handle, u, v, getOutEdgeWeight<hasWeights>(u, i),
1189
+ getOutEdgeId<graphHasEdgeIds>(u, i));
1190
+ }
1191
+ }
1192
+ }
1193
+
1194
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
1195
+ inline void GraphW::forInEdgesOfImpl(node u, L handle) const {
1196
+ if (graphIsDirected) {
1197
+ for (index i = 0; i < inEdges[u].size(); i++) {
1198
+ node v = inEdges[u][i];
1199
+
1200
+ Graph::edgeLambda<L>(handle, u, v, getInEdgeWeight<hasWeights>(u, i),
1201
+ getInEdgeId<graphHasEdgeIds>(u, i));
1202
+ }
1203
+ } else {
1204
+ for (index i = 0; i < outEdges[u].size(); ++i) {
1205
+ node v = outEdges[u][i];
1206
+
1207
+ Graph::edgeLambda<L>(handle, u, v, getOutEdgeWeight<hasWeights>(u, i),
1208
+ getOutEdgeId<graphHasEdgeIds>(u, i));
1209
+ }
1210
+ }
1211
+ }
1212
+
1213
+ template <bool graphIsDirected, bool hasWeights, bool graphHasEdgeIds, typename L>
1214
+ inline double GraphW::parallelSumForEdgesImpl(L handle) const {
1215
+ double sum = 0.0;
1216
+
1217
+ #pragma omp parallel for reduction(+ : sum)
1218
+ for (omp_index u = 0; u < static_cast<omp_index>(z); ++u) {
1219
+ for (index i = 0; i < outEdges[u].size(); ++i) {
1220
+ node v = outEdges[u][i];
1221
+
1222
+ // undirected, do not iterate over edges twice
1223
+ // {u, v} instead of (u, v); if v == none, u > v is not fulfilled
1224
+ if (useEdgeInIteration<graphIsDirected>(u, v)) {
1225
+ sum += Graph::edgeLambda<L>(handle, u, v, getOutEdgeWeight<hasWeights>(u, i),
1226
+ getOutEdgeId<graphHasEdgeIds>(u, i));
1227
+ }
1228
+ }
1229
+ }
1230
+
1231
+ return sum;
1232
+ }
1233
+
1234
+ } /* namespace NetworKit */
1235
+
1236
+ #endif // NETWORKIT_GRAPH_GRAPH_W_HPP_