@nshiab/simple-data-analysis-core 2.0.8 → 2.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.
- package/esm/class/SDAError.d.ts +6 -6
- package/esm/class/SDAError.js +6 -6
- package/esm/class/Simple.d.ts +9 -9
- package/esm/class/Simple.js +9 -9
- package/esm/class/SimpleDB.d.ts +80 -76
- package/esm/class/SimpleDB.d.ts.map +1 -1
- package/esm/class/SimpleDB.js +80 -76
- package/esm/class/SimpleTable.d.ts +2805 -1077
- package/esm/class/SimpleTable.d.ts.map +1 -1
- package/esm/class/SimpleTable.js +2777 -1077
- package/esm/helpers/appendColumnBatches.d.ts +3 -0
- package/esm/helpers/appendColumnBatches.d.ts.map +1 -0
- package/esm/helpers/appendColumnBatches.js +21 -0
- package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
- package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildApproximateMutualReachabilityMst.js +212 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.js +167 -0
- package/esm/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
- package/esm/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildExactMutualReachabilityMst.js +97 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.js +86 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.js +70 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.js +47 -0
- package/esm/helpers/buildUmapGraph.d.ts +21 -0
- package/esm/helpers/buildUmapGraph.d.ts.map +1 -0
- package/esm/helpers/buildUmapGraph.js +61 -0
- package/esm/helpers/buildVectorNeighbors.d.ts +45 -0
- package/esm/helpers/buildVectorNeighbors.d.ts.map +1 -0
- package/esm/helpers/buildVectorNeighbors.js +170 -0
- package/esm/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
- package/esm/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
- package/esm/helpers/buildWeakGraphComponentsSql.js +32 -0
- package/esm/helpers/cacheDatabase.d.ts.map +1 -1
- package/esm/helpers/cacheDatabase.js +2 -1
- package/esm/helpers/camelCase.d.ts +7 -5
- package/esm/helpers/camelCase.d.ts.map +1 -1
- package/esm/helpers/camelCase.js +7 -5
- package/esm/helpers/capitalize.d.ts +6 -4
- package/esm/helpers/capitalize.d.ts.map +1 -1
- package/esm/helpers/capitalize.js +6 -4
- package/esm/helpers/clusterHdbscan.d.ts +18 -0
- package/esm/helpers/clusterHdbscan.d.ts.map +1 -0
- package/esm/helpers/clusterHdbscan.js +342 -0
- package/esm/helpers/computeCovariance.d.ts +16 -0
- package/esm/helpers/computeCovariance.d.ts.map +1 -0
- package/esm/helpers/computeCovariance.js +99 -0
- package/esm/helpers/computeMahalanobisDistances.d.ts +14 -0
- package/esm/helpers/computeMahalanobisDistances.d.ts.map +1 -0
- package/esm/helpers/computeMahalanobisDistances.js +87 -0
- package/esm/helpers/createDirectory.d.ts +4 -3
- package/esm/helpers/createDirectory.d.ts.map +1 -1
- package/esm/helpers/createDirectory.js +4 -3
- package/esm/helpers/dataToArrays.d.ts +6 -4
- package/esm/helpers/dataToArrays.d.ts.map +1 -1
- package/esm/helpers/dataToArrays.js +6 -4
- package/esm/helpers/extractTypes.d.ts +1 -1
- package/esm/helpers/extractTypes.js +4 -9
- package/esm/helpers/factorCovariance.d.ts +17 -0
- package/esm/helpers/factorCovariance.d.ts.map +1 -0
- package/esm/helpers/factorCovariance.js +189 -0
- package/esm/helpers/findGeoColumn.d.ts +6 -4
- package/esm/helpers/findGeoColumn.d.ts.map +1 -1
- package/esm/helpers/findGeoColumn.js +6 -4
- package/esm/helpers/findGeoColumnFromSchema.d.ts +8 -5
- package/esm/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
- package/esm/helpers/findGeoColumnFromSchema.js +8 -5
- package/esm/helpers/fitUmapCurve.d.ts +2 -0
- package/esm/helpers/fitUmapCurve.d.ts.map +1 -0
- package/esm/helpers/fitUmapCurve.js +66 -0
- package/esm/helpers/formatDate.d.ts +12 -6
- package/esm/helpers/formatDate.d.ts.map +1 -1
- package/esm/helpers/formatDate.js +12 -6
- package/esm/helpers/formatMissingTables.d.ts +8 -5
- package/esm/helpers/formatMissingTables.d.ts.map +1 -1
- package/esm/helpers/formatMissingTables.js +8 -5
- package/esm/helpers/formatNumber.d.ts +19 -10
- package/esm/helpers/formatNumber.d.ts.map +1 -1
- package/esm/helpers/formatNumber.js +32 -17
- package/esm/helpers/getGraphEdgeIdColumn.d.ts +9 -0
- package/esm/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
- package/esm/helpers/getGraphEdgeIdColumn.js +25 -0
- package/esm/helpers/getGraphEndpointColumns.d.ts +11 -0
- package/esm/helpers/getGraphEndpointColumns.d.ts.map +1 -0
- package/esm/helpers/getGraphEndpointColumns.js +160 -0
- package/esm/helpers/getGraphWeightColumn.d.ts +10 -0
- package/esm/helpers/getGraphWeightColumn.d.ts.map +1 -0
- package/esm/helpers/getGraphWeightColumn.js +40 -0
- package/esm/helpers/graphRouteResultSchema.d.ts +4 -0
- package/esm/helpers/graphRouteResultSchema.d.ts.map +1 -0
- package/esm/helpers/graphRouteResultSchema.js +12 -0
- package/esm/helpers/graphRouteResultSelect.d.ts +4 -0
- package/esm/helpers/graphRouteResultSelect.d.ts.map +1 -0
- package/esm/helpers/graphRouteResultSelect.js +22 -0
- package/esm/helpers/hasGeometryColumn.d.ts +4 -3
- package/esm/helpers/hasGeometryColumn.d.ts.map +1 -1
- package/esm/helpers/hasGeometryColumn.js +4 -3
- package/esm/helpers/initialUmapCoordinates.d.ts +2 -0
- package/esm/helpers/initialUmapCoordinates.d.ts.map +1 -0
- package/esm/helpers/initialUmapCoordinates.js +5 -0
- package/esm/helpers/inspectGraphConnectivity.d.ts +10 -0
- package/esm/helpers/inspectGraphConnectivity.d.ts.map +1 -0
- package/esm/helpers/inspectGraphConnectivity.js +55 -0
- package/esm/helpers/mergeOptions.d.ts +24 -13
- package/esm/helpers/mergeOptions.d.ts.map +1 -1
- package/esm/helpers/mergeOptions.js +24 -13
- package/esm/helpers/optimizeUmapLayout.d.ts +7 -0
- package/esm/helpers/optimizeUmapLayout.d.ts.map +1 -0
- package/esm/helpers/optimizeUmapLayout.js +93 -0
- package/esm/helpers/parseValue.d.ts +6 -4
- package/esm/helpers/parseValue.d.ts.map +1 -1
- package/esm/helpers/parseValue.js +6 -4
- package/esm/helpers/prepareGraphRouteSql.d.ts +31 -0
- package/esm/helpers/prepareGraphRouteSql.d.ts.map +1 -0
- package/esm/helpers/prepareGraphRouteSql.js +86 -0
- package/esm/helpers/prepareGraphStarts.d.ts +9 -0
- package/esm/helpers/prepareGraphStarts.d.ts.map +1 -0
- package/esm/helpers/prepareGraphStarts.js +68 -0
- package/esm/helpers/prepareGraphTemporalSql.d.ts +28 -0
- package/esm/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
- package/esm/helpers/prepareGraphTemporalSql.js +154 -0
- package/esm/helpers/prepareGraphTraversal.d.ts +19 -0
- package/esm/helpers/prepareGraphTraversal.d.ts.map +1 -0
- package/esm/helpers/prepareGraphTraversal.js +79 -0
- package/esm/helpers/prepareNumericFeatures.d.ts +41 -0
- package/esm/helpers/prepareNumericFeatures.d.ts.map +1 -0
- package/esm/helpers/prepareNumericFeatures.js +210 -0
- package/esm/helpers/prepareUmapLayoutOptions.d.ts +14 -0
- package/esm/helpers/prepareUmapLayoutOptions.d.ts.map +1 -0
- package/esm/helpers/prepareUmapLayoutOptions.js +23 -0
- package/esm/helpers/prettyDuration.d.ts +14 -8
- package/esm/helpers/prettyDuration.d.ts.map +1 -1
- package/esm/helpers/prettyDuration.js +14 -8
- package/esm/helpers/printTable.d.ts +18 -13
- package/esm/helpers/printTable.d.ts.map +1 -1
- package/esm/helpers/printTable.js +18 -13
- package/esm/helpers/publishPreparedColumns.d.ts +37 -0
- package/esm/helpers/publishPreparedColumns.d.ts.map +1 -0
- package/esm/helpers/publishPreparedColumns.js +113 -0
- package/esm/helpers/queryDB.d.ts +24 -13
- package/esm/helpers/queryDB.d.ts.map +1 -1
- package/esm/helpers/queryDB.js +24 -13
- package/esm/helpers/queueAsyncBarrier.d.ts +12 -7
- package/esm/helpers/queueAsyncBarrier.d.ts.map +1 -1
- package/esm/helpers/queueAsyncBarrier.js +12 -7
- package/esm/helpers/queueGraphResult.d.ts +18 -0
- package/esm/helpers/queueGraphResult.d.ts.map +1 -0
- package/esm/helpers/queueGraphResult.js +39 -0
- package/esm/helpers/quoteIdentifier.d.ts +4 -3
- package/esm/helpers/quoteIdentifier.d.ts.map +1 -1
- package/esm/helpers/quoteIdentifier.js +4 -3
- package/esm/helpers/quoteQualifiedIdentifier.d.ts +6 -4
- package/esm/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
- package/esm/helpers/quoteQualifiedIdentifier.js +6 -4
- package/esm/helpers/readScalarNumber.d.ts +3 -0
- package/esm/helpers/readScalarNumber.d.ts.map +1 -0
- package/esm/helpers/readScalarNumber.js +4 -0
- package/esm/helpers/runQuery.d.ts.map +1 -1
- package/esm/helpers/runQuery.js +17 -3
- package/esm/helpers/selectFuzzyReplacements.d.ts +11 -0
- package/esm/helpers/selectFuzzyReplacements.d.ts.map +1 -0
- package/esm/helpers/selectFuzzyReplacements.js +124 -0
- package/esm/helpers/stabilizeCosineVectors.d.ts +14 -0
- package/esm/helpers/stabilizeCosineVectors.d.ts.map +1 -0
- package/esm/helpers/stabilizeCosineVectors.js +34 -0
- package/esm/helpers/stringToArray.d.ts +4 -3
- package/esm/helpers/stringToArray.d.ts.map +1 -1
- package/esm/helpers/stringToArray.js +4 -3
- package/esm/helpers/umapRandom.d.ts +2 -0
- package/esm/helpers/umapRandom.d.ts.map +1 -0
- package/esm/helpers/umapRandom.js +10 -0
- package/esm/helpers/updateColumnsWithJS.d.ts +12 -6
- package/esm/helpers/updateColumnsWithJS.d.ts.map +1 -1
- package/esm/helpers/updateColumnsWithJS.js +12 -6
- package/esm/helpers/validateGraphRouteResultSchema.d.ts +4 -0
- package/esm/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
- package/esm/helpers/validateGraphRouteResultSchema.js +13 -0
- package/esm/helpers/validateGraphTemporalEvents.d.ts +7 -0
- package/esm/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
- package/esm/helpers/validateGraphTemporalEvents.js +47 -0
- package/esm/helpers/validateNumericalAnalysis.d.ts +10 -6
- package/esm/helpers/validateNumericalAnalysis.d.ts.map +1 -1
- package/esm/helpers/validateNumericalAnalysis.js +10 -6
- package/esm/helpers/validateVectorRowIds.d.ts +4 -0
- package/esm/helpers/validateVectorRowIds.d.ts.map +1 -0
- package/esm/helpers/validateVectorRowIds.js +16 -0
- package/esm/helpers/vectorDistanceExpression.d.ts +6 -0
- package/esm/helpers/vectorDistanceExpression.d.ts.map +1 -0
- package/esm/helpers/vectorDistanceExpression.js +11 -0
- package/esm/helpers/wrapString.d.ts +10 -7
- package/esm/helpers/wrapString.d.ts.map +1 -1
- package/esm/helpers/wrapString.js +10 -7
- package/esm/methods/addId.d.ts +5 -0
- package/esm/methods/addId.d.ts.map +1 -0
- package/esm/methods/addId.js +38 -0
- package/esm/methods/cache.js +1 -1
- package/esm/methods/commonNeighbors.d.ts +10 -0
- package/esm/methods/commonNeighbors.d.ts.map +1 -0
- package/esm/methods/commonNeighbors.js +101 -0
- package/esm/methods/connectedComponents.d.ts +9 -0
- package/esm/methods/connectedComponents.d.ts.map +1 -0
- package/esm/methods/connectedComponents.js +147 -0
- package/esm/methods/degree.d.ts +9 -0
- package/esm/methods/degree.d.ts.map +1 -0
- package/esm/methods/degree.js +135 -0
- package/esm/methods/distances.d.ts +12 -0
- package/esm/methods/distances.d.ts.map +1 -0
- package/esm/methods/distances.js +164 -0
- package/esm/methods/findCycles.d.ts +12 -0
- package/esm/methods/findCycles.d.ts.map +1 -0
- package/esm/methods/findCycles.js +330 -0
- package/esm/methods/fuzzyClean.d.ts.map +1 -1
- package/esm/methods/fuzzyClean.js +17 -136
- package/esm/methods/fuzzyJoin.js +70 -16
- package/esm/methods/getTypes.d.ts +1 -1
- package/esm/methods/hdbscan.d.ts +5 -0
- package/esm/methods/hdbscan.d.ts.map +1 -0
- package/esm/methods/hdbscan.js +208 -0
- package/esm/methods/loadArray.d.ts.map +1 -1
- package/esm/methods/loadArray.js +3 -20
- package/esm/methods/mahalanobis.d.ts +5 -0
- package/esm/methods/mahalanobis.d.ts.map +1 -0
- package/esm/methods/mahalanobis.js +92 -0
- package/esm/methods/neighbors.d.ts +9 -0
- package/esm/methods/neighbors.d.ts.map +1 -0
- package/esm/methods/neighbors.js +81 -0
- package/esm/methods/normalizeVector.d.ts +5 -0
- package/esm/methods/normalizeVector.d.ts.map +1 -0
- package/esm/methods/normalizeVector.js +132 -0
- package/esm/methods/paths.d.ts +12 -0
- package/esm/methods/paths.d.ts.map +1 -0
- package/esm/methods/paths.js +287 -0
- package/esm/methods/reachable.d.ts +11 -0
- package/esm/methods/reachable.d.ts.map +1 -0
- package/esm/methods/reachable.js +131 -0
- package/esm/methods/rowToVector.d.ts +5 -0
- package/esm/methods/rowToVector.d.ts.map +1 -0
- package/esm/methods/rowToVector.js +77 -0
- package/esm/methods/shortestPath.d.ts +12 -0
- package/esm/methods/shortestPath.d.ts.map +1 -0
- package/esm/methods/shortestPath.js +337 -0
- package/esm/methods/topologicalSort.d.ts +7 -0
- package/esm/methods/topologicalSort.d.ts.map +1 -0
- package/esm/methods/topologicalSort.js +164 -0
- package/esm/methods/umap.d.ts +5 -0
- package/esm/methods/umap.d.ts.map +1 -0
- package/esm/methods/umap.js +156 -0
- package/esm/methods/updateWithJS.js +9 -21
- package/llm.md +2170 -128
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/script/class/SDAError.d.ts +6 -6
- package/script/class/SDAError.js +6 -6
- package/script/class/Simple.d.ts +9 -9
- package/script/class/Simple.js +9 -9
- package/script/class/SimpleDB.d.ts +80 -76
- package/script/class/SimpleDB.d.ts.map +1 -1
- package/script/class/SimpleDB.js +80 -76
- package/script/class/SimpleTable.d.ts +2805 -1077
- package/script/class/SimpleTable.d.ts.map +1 -1
- package/script/class/SimpleTable.js +2777 -1077
- package/script/helpers/appendColumnBatches.d.ts +3 -0
- package/script/helpers/appendColumnBatches.d.ts.map +1 -0
- package/script/helpers/appendColumnBatches.js +24 -0
- package/script/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
- package/script/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildApproximateMutualReachabilityMst.js +219 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.js +174 -0
- package/script/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
- package/script/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildExactMutualReachabilityMst.js +103 -0
- package/script/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
- package/script/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
- package/script/helpers/buildGraphTemporalCostStateSql.js +92 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.js +76 -0
- package/script/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
- package/script/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildSparseMutualReachabilityMst.js +50 -0
- package/script/helpers/buildUmapGraph.d.ts +21 -0
- package/script/helpers/buildUmapGraph.d.ts.map +1 -0
- package/script/helpers/buildUmapGraph.js +67 -0
- package/script/helpers/buildVectorNeighbors.d.ts +45 -0
- package/script/helpers/buildVectorNeighbors.d.ts.map +1 -0
- package/script/helpers/buildVectorNeighbors.js +176 -0
- package/script/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
- package/script/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
- package/script/helpers/buildWeakGraphComponentsSql.js +38 -0
- package/script/helpers/cacheDatabase.d.ts.map +1 -1
- package/script/helpers/cacheDatabase.js +2 -1
- package/script/helpers/camelCase.d.ts +7 -5
- package/script/helpers/camelCase.d.ts.map +1 -1
- package/script/helpers/camelCase.js +7 -5
- package/script/helpers/capitalize.d.ts +6 -4
- package/script/helpers/capitalize.d.ts.map +1 -1
- package/script/helpers/capitalize.js +6 -4
- package/script/helpers/clusterHdbscan.d.ts +18 -0
- package/script/helpers/clusterHdbscan.d.ts.map +1 -0
- package/script/helpers/clusterHdbscan.js +346 -0
- package/script/helpers/computeCovariance.d.ts +16 -0
- package/script/helpers/computeCovariance.d.ts.map +1 -0
- package/script/helpers/computeCovariance.js +105 -0
- package/script/helpers/computeMahalanobisDistances.d.ts +14 -0
- package/script/helpers/computeMahalanobisDistances.d.ts.map +1 -0
- package/script/helpers/computeMahalanobisDistances.js +93 -0
- package/script/helpers/createDirectory.d.ts +4 -3
- package/script/helpers/createDirectory.d.ts.map +1 -1
- package/script/helpers/createDirectory.js +4 -3
- package/script/helpers/dataToArrays.d.ts +6 -4
- package/script/helpers/dataToArrays.d.ts.map +1 -1
- package/script/helpers/dataToArrays.js +6 -4
- package/script/helpers/extractTypes.d.ts +1 -1
- package/script/helpers/extractTypes.js +4 -9
- package/script/helpers/factorCovariance.d.ts +17 -0
- package/script/helpers/factorCovariance.d.ts.map +1 -0
- package/script/helpers/factorCovariance.js +194 -0
- package/script/helpers/findGeoColumn.d.ts +6 -4
- package/script/helpers/findGeoColumn.d.ts.map +1 -1
- package/script/helpers/findGeoColumn.js +6 -4
- package/script/helpers/findGeoColumnFromSchema.d.ts +8 -5
- package/script/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
- package/script/helpers/findGeoColumnFromSchema.js +8 -5
- package/script/helpers/fitUmapCurve.d.ts +2 -0
- package/script/helpers/fitUmapCurve.d.ts.map +1 -0
- package/script/helpers/fitUmapCurve.js +69 -0
- package/script/helpers/formatDate.d.ts +12 -6
- package/script/helpers/formatDate.d.ts.map +1 -1
- package/script/helpers/formatDate.js +12 -6
- package/script/helpers/formatMissingTables.d.ts +8 -5
- package/script/helpers/formatMissingTables.d.ts.map +1 -1
- package/script/helpers/formatMissingTables.js +8 -5
- package/script/helpers/formatNumber.d.ts +19 -10
- package/script/helpers/formatNumber.d.ts.map +1 -1
- package/script/helpers/formatNumber.js +32 -17
- package/script/helpers/getGraphEdgeIdColumn.d.ts +9 -0
- package/script/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
- package/script/helpers/getGraphEdgeIdColumn.js +31 -0
- package/script/helpers/getGraphEndpointColumns.d.ts +11 -0
- package/script/helpers/getGraphEndpointColumns.d.ts.map +1 -0
- package/script/helpers/getGraphEndpointColumns.js +166 -0
- package/script/helpers/getGraphWeightColumn.d.ts +10 -0
- package/script/helpers/getGraphWeightColumn.d.ts.map +1 -0
- package/script/helpers/getGraphWeightColumn.js +46 -0
- package/script/helpers/graphRouteResultSchema.d.ts +4 -0
- package/script/helpers/graphRouteResultSchema.d.ts.map +1 -0
- package/script/helpers/graphRouteResultSchema.js +18 -0
- package/script/helpers/graphRouteResultSelect.d.ts +4 -0
- package/script/helpers/graphRouteResultSelect.d.ts.map +1 -0
- package/script/helpers/graphRouteResultSelect.js +28 -0
- package/script/helpers/hasGeometryColumn.d.ts +4 -3
- package/script/helpers/hasGeometryColumn.d.ts.map +1 -1
- package/script/helpers/hasGeometryColumn.js +4 -3
- package/script/helpers/initialUmapCoordinates.d.ts +2 -0
- package/script/helpers/initialUmapCoordinates.d.ts.map +1 -0
- package/script/helpers/initialUmapCoordinates.js +11 -0
- package/script/helpers/inspectGraphConnectivity.d.ts +10 -0
- package/script/helpers/inspectGraphConnectivity.d.ts.map +1 -0
- package/script/helpers/inspectGraphConnectivity.js +58 -0
- package/script/helpers/mergeOptions.d.ts +24 -13
- package/script/helpers/mergeOptions.d.ts.map +1 -1
- package/script/helpers/mergeOptions.js +24 -13
- package/script/helpers/optimizeUmapLayout.d.ts +7 -0
- package/script/helpers/optimizeUmapLayout.d.ts.map +1 -0
- package/script/helpers/optimizeUmapLayout.js +99 -0
- package/script/helpers/parseValue.d.ts +6 -4
- package/script/helpers/parseValue.d.ts.map +1 -1
- package/script/helpers/parseValue.js +6 -4
- package/script/helpers/prepareGraphRouteSql.d.ts +31 -0
- package/script/helpers/prepareGraphRouteSql.d.ts.map +1 -0
- package/script/helpers/prepareGraphRouteSql.js +127 -0
- package/script/helpers/prepareGraphStarts.d.ts +9 -0
- package/script/helpers/prepareGraphStarts.d.ts.map +1 -0
- package/script/helpers/prepareGraphStarts.js +71 -0
- package/script/helpers/prepareGraphTemporalSql.d.ts +28 -0
- package/script/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
- package/script/helpers/prepareGraphTemporalSql.js +161 -0
- package/script/helpers/prepareGraphTraversal.d.ts +19 -0
- package/script/helpers/prepareGraphTraversal.d.ts.map +1 -0
- package/script/helpers/prepareGraphTraversal.js +87 -0
- package/script/helpers/prepareNumericFeatures.d.ts +41 -0
- package/script/helpers/prepareNumericFeatures.d.ts.map +1 -0
- package/script/helpers/prepareNumericFeatures.js +217 -0
- package/script/helpers/prepareUmapLayoutOptions.d.ts +14 -0
- package/script/helpers/prepareUmapLayoutOptions.d.ts.map +1 -0
- package/script/helpers/prepareUmapLayoutOptions.js +29 -0
- package/script/helpers/prettyDuration.d.ts +14 -8
- package/script/helpers/prettyDuration.d.ts.map +1 -1
- package/script/helpers/prettyDuration.js +14 -8
- package/script/helpers/printTable.d.ts +18 -13
- package/script/helpers/printTable.d.ts.map +1 -1
- package/script/helpers/printTable.js +18 -13
- package/script/helpers/publishPreparedColumns.d.ts +37 -0
- package/script/helpers/publishPreparedColumns.d.ts.map +1 -0
- package/script/helpers/publishPreparedColumns.js +119 -0
- package/script/helpers/queryDB.d.ts +24 -13
- package/script/helpers/queryDB.d.ts.map +1 -1
- package/script/helpers/queryDB.js +24 -13
- package/script/helpers/queueAsyncBarrier.d.ts +12 -7
- package/script/helpers/queueAsyncBarrier.d.ts.map +1 -1
- package/script/helpers/queueAsyncBarrier.js +12 -7
- package/script/helpers/queueGraphResult.d.ts +18 -0
- package/script/helpers/queueGraphResult.d.ts.map +1 -0
- package/script/helpers/queueGraphResult.js +45 -0
- package/script/helpers/quoteIdentifier.d.ts +4 -3
- package/script/helpers/quoteIdentifier.d.ts.map +1 -1
- package/script/helpers/quoteIdentifier.js +4 -3
- package/script/helpers/quoteQualifiedIdentifier.d.ts +6 -4
- package/script/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
- package/script/helpers/quoteQualifiedIdentifier.js +6 -4
- package/script/helpers/readScalarNumber.d.ts +3 -0
- package/script/helpers/readScalarNumber.d.ts.map +1 -0
- package/script/helpers/readScalarNumber.js +7 -0
- package/script/helpers/runQuery.d.ts.map +1 -1
- package/script/helpers/runQuery.js +17 -3
- package/script/helpers/selectFuzzyReplacements.d.ts +11 -0
- package/script/helpers/selectFuzzyReplacements.d.ts.map +1 -0
- package/script/helpers/selectFuzzyReplacements.js +127 -0
- package/script/helpers/stabilizeCosineVectors.d.ts +14 -0
- package/script/helpers/stabilizeCosineVectors.d.ts.map +1 -0
- package/script/helpers/stabilizeCosineVectors.js +40 -0
- package/script/helpers/stringToArray.d.ts +4 -3
- package/script/helpers/stringToArray.d.ts.map +1 -1
- package/script/helpers/stringToArray.js +4 -3
- package/script/helpers/umapRandom.d.ts +2 -0
- package/script/helpers/umapRandom.d.ts.map +1 -0
- package/script/helpers/umapRandom.js +13 -0
- package/script/helpers/updateColumnsWithJS.d.ts +12 -6
- package/script/helpers/updateColumnsWithJS.d.ts.map +1 -1
- package/script/helpers/updateColumnsWithJS.js +12 -6
- package/script/helpers/validateGraphRouteResultSchema.d.ts +4 -0
- package/script/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
- package/script/helpers/validateGraphRouteResultSchema.js +19 -0
- package/script/helpers/validateGraphTemporalEvents.d.ts +7 -0
- package/script/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
- package/script/helpers/validateGraphTemporalEvents.js +53 -0
- package/script/helpers/validateNumericalAnalysis.d.ts +10 -6
- package/script/helpers/validateNumericalAnalysis.d.ts.map +1 -1
- package/script/helpers/validateNumericalAnalysis.js +10 -6
- package/script/helpers/validateVectorRowIds.d.ts +4 -0
- package/script/helpers/validateVectorRowIds.d.ts.map +1 -0
- package/script/helpers/validateVectorRowIds.js +19 -0
- package/script/helpers/vectorDistanceExpression.d.ts +6 -0
- package/script/helpers/vectorDistanceExpression.d.ts.map +1 -0
- package/script/helpers/vectorDistanceExpression.js +14 -0
- package/script/helpers/wrapString.d.ts +10 -7
- package/script/helpers/wrapString.d.ts.map +1 -1
- package/script/helpers/wrapString.js +10 -7
- package/script/methods/addId.d.ts +5 -0
- package/script/methods/addId.d.ts.map +1 -0
- package/script/methods/addId.js +44 -0
- package/script/methods/cache.js +1 -1
- package/script/methods/commonNeighbors.d.ts +10 -0
- package/script/methods/commonNeighbors.d.ts.map +1 -0
- package/script/methods/commonNeighbors.js +140 -0
- package/script/methods/connectedComponents.d.ts +9 -0
- package/script/methods/connectedComponents.d.ts.map +1 -0
- package/script/methods/connectedComponents.js +186 -0
- package/script/methods/degree.d.ts +9 -0
- package/script/methods/degree.d.ts.map +1 -0
- package/script/methods/degree.js +141 -0
- package/script/methods/distances.d.ts +12 -0
- package/script/methods/distances.d.ts.map +1 -0
- package/script/methods/distances.js +203 -0
- package/script/methods/findCycles.d.ts +12 -0
- package/script/methods/findCycles.d.ts.map +1 -0
- package/script/methods/findCycles.js +369 -0
- package/script/methods/fuzzyClean.d.ts.map +1 -1
- package/script/methods/fuzzyClean.js +17 -136
- package/script/methods/fuzzyJoin.js +70 -16
- package/script/methods/getTypes.d.ts +1 -1
- package/script/methods/hdbscan.d.ts +5 -0
- package/script/methods/hdbscan.d.ts.map +1 -0
- package/script/methods/hdbscan.js +214 -0
- package/script/methods/loadArray.d.ts.map +1 -1
- package/script/methods/loadArray.js +2 -19
- package/script/methods/mahalanobis.d.ts +5 -0
- package/script/methods/mahalanobis.d.ts.map +1 -0
- package/script/methods/mahalanobis.js +98 -0
- package/script/methods/neighbors.d.ts +9 -0
- package/script/methods/neighbors.d.ts.map +1 -0
- package/script/methods/neighbors.js +120 -0
- package/script/methods/normalizeVector.d.ts +5 -0
- package/script/methods/normalizeVector.d.ts.map +1 -0
- package/script/methods/normalizeVector.js +138 -0
- package/script/methods/paths.d.ts +12 -0
- package/script/methods/paths.d.ts.map +1 -0
- package/script/methods/paths.js +326 -0
- package/script/methods/reachable.d.ts +11 -0
- package/script/methods/reachable.d.ts.map +1 -0
- package/script/methods/reachable.js +170 -0
- package/script/methods/rowToVector.d.ts +5 -0
- package/script/methods/rowToVector.d.ts.map +1 -0
- package/script/methods/rowToVector.js +83 -0
- package/script/methods/shortestPath.d.ts +12 -0
- package/script/methods/shortestPath.d.ts.map +1 -0
- package/script/methods/shortestPath.js +376 -0
- package/script/methods/topologicalSort.d.ts +7 -0
- package/script/methods/topologicalSort.d.ts.map +1 -0
- package/script/methods/topologicalSort.js +170 -0
- package/script/methods/umap.d.ts +5 -0
- package/script/methods/umap.d.ts.map +1 -0
- package/script/methods/umap.js +162 -0
- package/script/methods/updateWithJS.js +9 -21
|
@@ -9,12 +9,6 @@ const keepNumericalColumns_js_1 = __importDefault(require("./keepNumericalColumn
|
|
|
9
9
|
/**
|
|
10
10
|
* Validates the column options shared by numerical pair analyses.
|
|
11
11
|
*
|
|
12
|
-
* @param types - The schema of the table being analyzed.
|
|
13
|
-
* @param options - The optional x and y columns selected by the caller.
|
|
14
|
-
* @param method - The SDA method performing the analysis.
|
|
15
|
-
* @param tableName - The name of the table being analyzed.
|
|
16
|
-
* @returns All numeric columns in the table schema.
|
|
17
|
-
*
|
|
18
12
|
* @example
|
|
19
13
|
* ```ts
|
|
20
14
|
* const columns = validateNumericalAnalysis(
|
|
@@ -24,6 +18,16 @@ const keepNumericalColumns_js_1 = __importDefault(require("./keepNumericalColumn
|
|
|
24
18
|
* "measurements",
|
|
25
19
|
* );
|
|
26
20
|
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param types - The schema of the table being analyzed.
|
|
23
|
+
*
|
|
24
|
+
* @param options - The optional x and y columns selected by the caller.
|
|
25
|
+
*
|
|
26
|
+
* @param method - The SDA method performing the analysis.
|
|
27
|
+
*
|
|
28
|
+
* @param tableName - The name of the table being analyzed.
|
|
29
|
+
*
|
|
30
|
+
* @returns All numeric columns in the table schema.
|
|
27
31
|
*/
|
|
28
32
|
function validateNumericalAnalysis(types, options, method, tableName) {
|
|
29
33
|
if (options.x === undefined && options.y !== undefined) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DuckDBConnection } from "@duckdb/node-api";
|
|
2
|
+
/** Validate the positional identity contract before bounded vector scans. */
|
|
3
|
+
export default function validateVectorRowIds(connection: DuckDBConnection, rows: string, count: number): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=validateVectorRowIds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateVectorRowIds.d.ts","sourceRoot":"","sources":["../../src/helpers/validateVectorRowIds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,6EAA6E;AAC7E,wBAA8B,oBAAoB,CAChD,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = validateVectorRowIds;
|
|
4
|
+
/** Validate the positional identity contract before bounded vector scans. */
|
|
5
|
+
async function validateVectorRowIds(connection, rows, count) {
|
|
6
|
+
// Graph state and DuckDB scratch schemas use signed INTEGER vertex ids.
|
|
7
|
+
if (!Number.isSafeInteger(count) || count < 1 || count > 2147483647) {
|
|
8
|
+
throw new Error("Vector row count must fit a positive INTEGER vertex count.");
|
|
9
|
+
}
|
|
10
|
+
const [actual, distinct, minimum, maximum, invalid] = (await connection.runAndReadAll(`SELECT count(*),count(DISTINCT vertex),
|
|
11
|
+
min(vertex),max(vertex),count(*) FILTER (
|
|
12
|
+
WHERE vertex IS NULL OR vertex!=trunc(vertex)) FROM ${rows}`))
|
|
13
|
+
.getRowsJS()[0];
|
|
14
|
+
if (Number(actual) !== count || Number(distinct) !== count ||
|
|
15
|
+
Number(minimum) !== 0 || Number(maximum) !== count - 1 ||
|
|
16
|
+
Number(invalid) !== 0) {
|
|
17
|
+
throw new Error(`Vector rows must contain exactly ${count} unique integer vertex ids from 0 to ${count - 1}.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a DOUBLE-precision distance expression for prepared vector aliases.
|
|
3
|
+
* Cosine callers first stabilize their private rows with stabilizeCosineVectors.
|
|
4
|
+
*/
|
|
5
|
+
export default function vectorDistanceExpression(left: string, right: string, metric: "euclidean" | "cosine"): string;
|
|
6
|
+
//# sourceMappingURL=vectorDistanceExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorDistanceExpression.d.ts","sourceRoot":"","sources":["../../src/helpers/vectorDistanceExpression.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,GAAG,QAAQ,GAC7B,MAAM,CAKR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = vectorDistanceExpression;
|
|
4
|
+
/**
|
|
5
|
+
* Build a DOUBLE-precision distance expression for prepared vector aliases.
|
|
6
|
+
* Cosine callers first stabilize their private rows with stabilizeCosineVectors.
|
|
7
|
+
*/
|
|
8
|
+
function vectorDistanceExpression(left, right, metric) {
|
|
9
|
+
if (metric === "euclidean")
|
|
10
|
+
return `array_distance(${left},${right})`;
|
|
11
|
+
// DuckDB can return tiny positive or negative errors for equal/cosine-aligned
|
|
12
|
+
// vectors. Exact equality also makes duplicate behavior deterministic.
|
|
13
|
+
return `CASE WHEN ${left}=${right} THEN 0 ELSE greatest(0,array_cosine_distance(${left},${right})) END`;
|
|
14
|
+
}
|
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
* will be broken at the character boundary. This function is primarily used
|
|
5
5
|
* for preparing text to be displayed in console tables.
|
|
6
6
|
*
|
|
7
|
-
* @param str - The string to wrap.
|
|
8
|
-
* @param maxWidth - The maximum width of each line.
|
|
9
|
-
* @param wordWrap - If true, attempts to break at word boundaries. If false,
|
|
10
|
-
* breaks at character boundaries. Defaults to `true`.
|
|
11
|
-
* @returns The wrapped string with newline characters inserted at appropriate
|
|
12
|
-
* positions.
|
|
13
|
-
*
|
|
14
7
|
* @example
|
|
15
8
|
* ```typescript
|
|
16
9
|
* const text = "This is a very long sentence that needs to be wrapped";
|
|
@@ -30,6 +23,16 @@
|
|
|
30
23
|
* // Output: Thisisaver
|
|
31
24
|
* // ylongword
|
|
32
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param str - The string to wrap.
|
|
28
|
+
*
|
|
29
|
+
* @param maxWidth - The maximum width of each line.
|
|
30
|
+
*
|
|
31
|
+
* @param wordWrap - If true, attempts to break at word boundaries. If false,
|
|
32
|
+
* breaks at character boundaries. Defaults to `true`.
|
|
33
|
+
*
|
|
34
|
+
* @returns The wrapped string with newline characters inserted at appropriate
|
|
35
|
+
* positions.
|
|
33
36
|
*/
|
|
34
37
|
export default function wrapString(str: string, maxWidth: number, wordWrap?: boolean): string;
|
|
35
38
|
//# sourceMappingURL=wrapString.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapString.d.ts","sourceRoot":"","sources":["../../src/helpers/wrapString.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wrapString.d.ts","sourceRoot":"","sources":["../../src/helpers/wrapString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,UAAO,GACd,MAAM,CAqDR"}
|
|
@@ -7,13 +7,6 @@ exports.default = wrapString;
|
|
|
7
7
|
* will be broken at the character boundary. This function is primarily used
|
|
8
8
|
* for preparing text to be displayed in console tables.
|
|
9
9
|
*
|
|
10
|
-
* @param str - The string to wrap.
|
|
11
|
-
* @param maxWidth - The maximum width of each line.
|
|
12
|
-
* @param wordWrap - If true, attempts to break at word boundaries. If false,
|
|
13
|
-
* breaks at character boundaries. Defaults to `true`.
|
|
14
|
-
* @returns The wrapped string with newline characters inserted at appropriate
|
|
15
|
-
* positions.
|
|
16
|
-
*
|
|
17
10
|
* @example
|
|
18
11
|
* ```typescript
|
|
19
12
|
* const text = "This is a very long sentence that needs to be wrapped";
|
|
@@ -33,6 +26,16 @@ exports.default = wrapString;
|
|
|
33
26
|
* // Output: Thisisaver
|
|
34
27
|
* // ylongword
|
|
35
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param str - The string to wrap.
|
|
31
|
+
*
|
|
32
|
+
* @param maxWidth - The maximum width of each line.
|
|
33
|
+
*
|
|
34
|
+
* @param wordWrap - If true, attempts to break at word boundaries. If false,
|
|
35
|
+
* breaks at character boundaries. Defaults to `true`.
|
|
36
|
+
*
|
|
37
|
+
* @returns The wrapped string with newline characters inserted at appropriate
|
|
38
|
+
* positions.
|
|
36
39
|
*/
|
|
37
40
|
function wrapString(str, maxWidth, wordWrap = true) {
|
|
38
41
|
if (str.length <= maxWidth) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addId.d.ts","sourceRoot":"","sources":["../../src/methods/addId.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,QAgDlC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = addId;
|
|
7
|
+
const assertNewColumns_js_1 = __importDefault(require("../helpers/assertNewColumns.js"));
|
|
8
|
+
const foldIdentifier_js_1 = __importDefault(require("../helpers/foldIdentifier.js"));
|
|
9
|
+
const mergeOptions_js_1 = __importDefault(require("../helpers/mergeOptions.js"));
|
|
10
|
+
const queryDB_js_1 = __importDefault(require("../helpers/queryDB.js"));
|
|
11
|
+
const queueOp_js_1 = __importDefault(require("../helpers/queueOp.js"));
|
|
12
|
+
const quoteIdentifier_js_1 = __importDefault(require("../helpers/quoteIdentifier.js"));
|
|
13
|
+
function addId(simpleTable, newColumn, options = {}) {
|
|
14
|
+
if (typeof newColumn !== "string") {
|
|
15
|
+
throw new TypeError("addId() newColumn must be a string.");
|
|
16
|
+
}
|
|
17
|
+
if (options.prefix !== undefined && typeof options.prefix !== "string") {
|
|
18
|
+
throw new TypeError("addId() options.prefix must be a string.");
|
|
19
|
+
}
|
|
20
|
+
// Materialize preceding operations so IDs follow their resulting row order.
|
|
21
|
+
options = structuredClone(options);
|
|
22
|
+
(0, queueOp_js_1.default)(simpleTable, {
|
|
23
|
+
kind: "barrier",
|
|
24
|
+
method: "addId()",
|
|
25
|
+
parameters: { newColumn, options },
|
|
26
|
+
execute: async () => {
|
|
27
|
+
const types = await simpleTable.getTypes();
|
|
28
|
+
const existingColumn = Object.keys(types).find((column) => (0, foldIdentifier_js_1.default)(column) === (0, foldIdentifier_js_1.default)(newColumn));
|
|
29
|
+
(0, assertNewColumns_js_1.default)(types, [existingColumn ?? newColumn], "addId()");
|
|
30
|
+
// An empty window preserves scan order without referencing rowid, which
|
|
31
|
+
// may be shadowed by a user column.
|
|
32
|
+
const rowNumber = "(ROW_NUMBER() OVER () - 1)";
|
|
33
|
+
const id = options.prefix === undefined
|
|
34
|
+
? rowNumber
|
|
35
|
+
: `CONCAT(?, CAST(${rowNumber} AS VARCHAR))`;
|
|
36
|
+
await (0, queryDB_js_1.default)(simpleTable, `CREATE OR REPLACE TABLE ${(0, quoteIdentifier_js_1.default)(simpleTable.name)} AS SELECT *, ${id} AS ${(0, quoteIdentifier_js_1.default)(newColumn)} FROM ${(0, quoteIdentifier_js_1.default)(simpleTable.name)}`, (0, mergeOptions_js_1.default)(simpleTable, {
|
|
37
|
+
table: simpleTable.name,
|
|
38
|
+
method: "addId()",
|
|
39
|
+
parameters: { newColumn, options },
|
|
40
|
+
values: options.prefix === undefined ? undefined : [options.prefix],
|
|
41
|
+
}));
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
package/script/methods/cache.js
CHANGED
|
@@ -46,7 +46,7 @@ const serializeCacheInputs_js_1 = __importStar(require("../helpers/serializeCach
|
|
|
46
46
|
const tableGeneration_js_1 = require("../helpers/tableGeneration.js");
|
|
47
47
|
const cacheDatabase_js_1 = require("../helpers/cacheDatabase.js");
|
|
48
48
|
const cacheTableDependencies_js_1 = require("../helpers/cacheTableDependencies.js");
|
|
49
|
-
const CACHE_FORMAT_VERSION = "duckdb-
|
|
49
|
+
const CACHE_FORMAT_VERSION = "duckdb-v5";
|
|
50
50
|
async function cache(table, compute, options = {}) {
|
|
51
51
|
// If cache() is itself called from another cache computation, the outer
|
|
52
52
|
// computation depends on the table produced here.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
import { type GraphId } from "../helpers/prepareGraphStarts.js";
|
|
3
|
+
import { type GraphDirection } from "../helpers/prepareGraphTraversal.js";
|
|
4
|
+
type CommonNeighborsOptions = {
|
|
5
|
+
direction?: GraphDirection;
|
|
6
|
+
outputTable?: string | boolean;
|
|
7
|
+
};
|
|
8
|
+
export default function commonNeighbors(simpleTable: SimpleTable, sourceColumn: string, targetColumn: string, nodeA: GraphId, nodeB: GraphId, options?: CommonNeighborsOptions): SimpleTable;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=commonNeighbors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonNeighbors.d.ts","sourceRoot":"","sources":["../../src/methods/commonNeighbors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD,OAA2B,EACzB,KAAK,OAAO,EAEb,MAAM,kCAAkC,CAAC;AAC1C,OAA8B,EAC5B,KAAK,cAAc,EAEpB,MAAM,qCAAqC,CAAC;AAI7C,KAAK,sBAAsB,GAAG;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,sBAA2B,GACnC,WAAW,CAwDb"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = commonNeighbors;
|
|
40
|
+
const prepareGraphStarts_js_1 = __importDefault(require("../helpers/prepareGraphStarts.js"));
|
|
41
|
+
const prepareGraphTraversal_js_1 = __importStar(require("../helpers/prepareGraphTraversal.js"));
|
|
42
|
+
const queueGraphResult_js_1 = __importDefault(require("../helpers/queueGraphResult.js"));
|
|
43
|
+
const quoteIdentifier_js_1 = __importDefault(require("../helpers/quoteIdentifier.js"));
|
|
44
|
+
function commonNeighbors(simpleTable, sourceColumn, targetColumn, nodeA, nodeB, options = {}) {
|
|
45
|
+
if (typeof sourceColumn !== "string") {
|
|
46
|
+
throw new TypeError("commonNeighbors() sourceColumn must be a string.");
|
|
47
|
+
}
|
|
48
|
+
if (typeof targetColumn !== "string") {
|
|
49
|
+
throw new TypeError("commonNeighbors() targetColumn must be a string.");
|
|
50
|
+
}
|
|
51
|
+
if (options === null || typeof options !== "object" || Array.isArray(options)) {
|
|
52
|
+
throw new TypeError("commonNeighbors() options must be an object.");
|
|
53
|
+
}
|
|
54
|
+
if (options.direction !== undefined &&
|
|
55
|
+
!["outgoing", "incoming", "both"].includes(options.direction)) {
|
|
56
|
+
throw new TypeError('commonNeighbors() options.direction must be "outgoing", "incoming", or "both".');
|
|
57
|
+
}
|
|
58
|
+
if (options.outputTable !== undefined &&
|
|
59
|
+
typeof options.outputTable !== "string" &&
|
|
60
|
+
typeof options.outputTable !== "boolean") {
|
|
61
|
+
throw new TypeError("commonNeighbors() options.outputTable must be a string or boolean.");
|
|
62
|
+
}
|
|
63
|
+
const nodes = prepareNodes(nodeA, nodeB);
|
|
64
|
+
options = structuredClone(options);
|
|
65
|
+
const direction = options.direction ?? "outgoing";
|
|
66
|
+
const parameters = { sourceColumn, targetColumn, nodeA, nodeB, options };
|
|
67
|
+
return (0, queueGraphResult_js_1.default)(simpleTable, {
|
|
68
|
+
method: "commonNeighbors()",
|
|
69
|
+
parameters,
|
|
70
|
+
outputTable: options.outputTable,
|
|
71
|
+
values: (schema) => {
|
|
72
|
+
validateNodes(schema, sourceColumn, targetColumn, nodes);
|
|
73
|
+
return nodes.values;
|
|
74
|
+
},
|
|
75
|
+
buildSelect: (input, schema) => commonNeighborsSelect(input, schema, sourceColumn, targetColumn, nodes, direction),
|
|
76
|
+
outputSchema: (schema) => ({
|
|
77
|
+
node: validateNodes(schema, sourceColumn, targetColumn, nodes).idType,
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function prepareNodes(nodeA, nodeB) {
|
|
82
|
+
if (Array.isArray(nodeA)) {
|
|
83
|
+
throw new TypeError("commonNeighbors() nodeA must be one node ID.");
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(nodeB)) {
|
|
86
|
+
throw new TypeError("commonNeighbors() nodeB must be one node ID.");
|
|
87
|
+
}
|
|
88
|
+
const first = (0, prepareGraphStarts_js_1.default)(nodeA, "commonNeighbors()", "nodeA", true);
|
|
89
|
+
const second = (0, prepareGraphStarts_js_1.default)(nodeB, "commonNeighbors()", "nodeB", true);
|
|
90
|
+
if (first.family !== second.family) {
|
|
91
|
+
throw new TypeError("commonNeighbors() nodeA and nodeB must both be string IDs or both be numeric IDs.");
|
|
92
|
+
}
|
|
93
|
+
if (first.values[0] === second.values[0]) {
|
|
94
|
+
throw new TypeError("commonNeighbors() nodeA and nodeB must be different.");
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
family: first.family,
|
|
98
|
+
numericValues: [...first.numericValues, ...second.numericValues],
|
|
99
|
+
values: [first.values[0], second.values[0]],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function validateNodes(schema, source, target, nodes) {
|
|
103
|
+
return (0, prepareGraphTraversal_js_1.validateGraphStarts)(schema, source, target, nodes, "commonNeighbors()", "nodeA and nodeB");
|
|
104
|
+
}
|
|
105
|
+
function commonNeighborsSelect(input, schema, source, target, nodes, direction) {
|
|
106
|
+
const prepared = (0, prepareGraphTraversal_js_1.default)(input, schema, source, target, nodes, "commonNeighbors()", "nodeA and nodeB");
|
|
107
|
+
const relations = prepared.relationNames([
|
|
108
|
+
"graph_requested_nodes",
|
|
109
|
+
"graph_edges",
|
|
110
|
+
"graph_neighbor_memberships",
|
|
111
|
+
"graph_common_neighbors",
|
|
112
|
+
]);
|
|
113
|
+
const requested = relations.graph_requested_nodes;
|
|
114
|
+
const edges = relations.graph_edges;
|
|
115
|
+
const memberships = relations.graph_neighbor_memberships;
|
|
116
|
+
const common = relations.graph_common_neighbors;
|
|
117
|
+
const q = quoteIdentifier_js_1.default;
|
|
118
|
+
return `WITH ${requested}(${q("node")}) AS (
|
|
119
|
+
VALUES ${prepared.startValues}
|
|
120
|
+
), ${edges} AS (
|
|
121
|
+
${prepared.edges(direction)}
|
|
122
|
+
), ${memberships} AS (
|
|
123
|
+
SELECT ${q("requested")}.${q("node")} AS ${q("requested_node")},
|
|
124
|
+
${q("edges")}.${q("__from_key")} AS ${q("__requested_key")},
|
|
125
|
+
${q("edges")}.${q("__to")} AS ${q("node")},
|
|
126
|
+
${q("edges")}.${q("__to_key")} AS ${q("__node_key")}
|
|
127
|
+
FROM ${edges} AS ${q("edges")}
|
|
128
|
+
INNER JOIN ${requested} AS ${q("requested")}
|
|
129
|
+
ON ${q("edges")}.${q("__from_key")} =
|
|
130
|
+
${prepared.key(`${q("requested")}.${q("node")}`)}
|
|
131
|
+
), ${common} AS (
|
|
132
|
+
SELECT MIN(${q("node")}) AS ${q("node")}, ${q("__node_key")}
|
|
133
|
+
FROM ${memberships}
|
|
134
|
+
GROUP BY ${q("__node_key")}
|
|
135
|
+
HAVING COUNT(DISTINCT ${q("__requested_key")}) = 2
|
|
136
|
+
)
|
|
137
|
+
SELECT ${q("node")}
|
|
138
|
+
FROM ${common}
|
|
139
|
+
ORDER BY ${q("__node_key")}`;
|
|
140
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
import { type GraphTemporalOptions } from "../helpers/prepareGraphTemporalSql.js";
|
|
3
|
+
type ConnectedComponentsOptions = GraphTemporalOptions & {
|
|
4
|
+
mode?: "weak" | "strong";
|
|
5
|
+
outputTable?: string | boolean;
|
|
6
|
+
};
|
|
7
|
+
export default function connectedComponents(simpleTable: SimpleTable, sourceColumn: string, targetColumn: string, options?: ConnectedComponentsOptions): SimpleTable;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=connectedComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectedComponents.d.ts","sourceRoot":"","sources":["../../src/methods/connectedComponents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD,OAAgC,EAC9B,KAAK,oBAAoB,EAG1B,MAAM,uCAAuC,CAAC;AAM/C,KAAK,0BAA0B,GAAG,oBAAoB,GAAG;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,0BAA+B,GACvC,WAAW,CAqFb"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = connectedComponents;
|
|
40
|
+
const buildChronologicalGraphComponentsSql_js_1 = __importDefault(require("../helpers/buildChronologicalGraphComponentsSql.js"));
|
|
41
|
+
const buildWeakGraphComponentsSql_js_1 = __importDefault(require("../helpers/buildWeakGraphComponentsSql.js"));
|
|
42
|
+
const getGraphEndpointColumns_js_1 = __importDefault(require("../helpers/getGraphEndpointColumns.js"));
|
|
43
|
+
const prepareGraphTemporalSql_js_1 = __importStar(require("../helpers/prepareGraphTemporalSql.js"));
|
|
44
|
+
const prepareGraphTraversal_js_1 = require("../helpers/prepareGraphTraversal.js");
|
|
45
|
+
const queueGraphResult_js_1 = __importDefault(require("../helpers/queueGraphResult.js"));
|
|
46
|
+
const quoteIdentifier_js_1 = __importDefault(require("../helpers/quoteIdentifier.js"));
|
|
47
|
+
const validateGraphTemporalEvents_js_1 = __importDefault(require("../helpers/validateGraphTemporalEvents.js"));
|
|
48
|
+
function connectedComponents(simpleTable, sourceColumn, targetColumn, options = {}) {
|
|
49
|
+
if (typeof sourceColumn !== "string") {
|
|
50
|
+
throw new TypeError("connectedComponents() sourceColumn must be a string.");
|
|
51
|
+
}
|
|
52
|
+
if (typeof targetColumn !== "string") {
|
|
53
|
+
throw new TypeError("connectedComponents() targetColumn must be a string.");
|
|
54
|
+
}
|
|
55
|
+
if (options === null || typeof options !== "object" || Array.isArray(options)) {
|
|
56
|
+
throw new TypeError("connectedComponents() options must be an object.");
|
|
57
|
+
}
|
|
58
|
+
if (options.mode !== undefined &&
|
|
59
|
+
!["weak", "strong"].includes(options.mode)) {
|
|
60
|
+
throw new TypeError('connectedComponents() options.mode must be "weak" or "strong".');
|
|
61
|
+
}
|
|
62
|
+
if (options.outputTable !== undefined &&
|
|
63
|
+
typeof options.outputTable !== "string" &&
|
|
64
|
+
typeof options.outputTable !== "boolean") {
|
|
65
|
+
throw new TypeError("connectedComponents() options.outputTable must be a string or boolean.");
|
|
66
|
+
}
|
|
67
|
+
const temporalOptions = (0, prepareGraphTemporalSql_js_1.prepareGraphTemporalOptions)(options, undefined, "connectedComponents()");
|
|
68
|
+
if (temporalOptions !== undefined && options.mode !== "strong") {
|
|
69
|
+
throw new TypeError('connectedComponents() chronological options require options.mode to be explicitly set to "strong".');
|
|
70
|
+
}
|
|
71
|
+
options = structuredClone(options);
|
|
72
|
+
const mode = options.mode ?? "weak";
|
|
73
|
+
const parameters = { sourceColumn, targetColumn, options };
|
|
74
|
+
return (0, queueGraphResult_js_1.default)(simpleTable, {
|
|
75
|
+
method: "connectedComponents()",
|
|
76
|
+
parameters,
|
|
77
|
+
outputTable: options.outputTable,
|
|
78
|
+
preflight: temporalOptions === undefined
|
|
79
|
+
? undefined
|
|
80
|
+
: (input) => (0, validateGraphTemporalEvents_js_1.default)(input, temporalOptions, "connectedComponents()", parameters),
|
|
81
|
+
values: (schema) => {
|
|
82
|
+
const temporal = validateInputs(schema, sourceColumn, targetColumn, temporalOptions).temporal;
|
|
83
|
+
return temporal === undefined ? [] : [temporal.gapParameter];
|
|
84
|
+
},
|
|
85
|
+
buildSelect: (input, schema) => connectedComponentsSelect(input, schema, sourceColumn, targetColumn, mode, temporalOptions),
|
|
86
|
+
outputSchema: (schema) => ({
|
|
87
|
+
componentId: "BIGINT",
|
|
88
|
+
node: validateInputs(schema, sourceColumn, targetColumn, temporalOptions).endpoints.idType,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function validateEndpoints(schema, source, target) {
|
|
93
|
+
return (0, getGraphEndpointColumns_js_1.default)(schema, source, target, "connectedComponents()");
|
|
94
|
+
}
|
|
95
|
+
function validateInputs(schema, source, target, temporalOptions) {
|
|
96
|
+
const endpoints = validateEndpoints(schema, source, target);
|
|
97
|
+
const temporal = temporalOptions === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: (0, prepareGraphTemporalSql_js_1.default)(schema, temporalOptions, "connectedComponents()");
|
|
100
|
+
return { endpoints, temporal };
|
|
101
|
+
}
|
|
102
|
+
function connectedComponentsSelect(input, schema, source, target, mode, temporalOptions) {
|
|
103
|
+
const prepared = (0, prepareGraphTraversal_js_1.prepareGraphSql)(input, schema, source, target, "connectedComponents()");
|
|
104
|
+
if (temporalOptions !== undefined) {
|
|
105
|
+
return (0, buildChronologicalGraphComponentsSql_js_1.default)(prepared, (0, prepareGraphTemporalSql_js_1.default)(schema, temporalOptions, "connectedComponents()"));
|
|
106
|
+
}
|
|
107
|
+
const relationNames = mode === "weak"
|
|
108
|
+
? [
|
|
109
|
+
"graph_edges",
|
|
110
|
+
"graph_nodes",
|
|
111
|
+
"graph_component_labels",
|
|
112
|
+
"graph_component_roots",
|
|
113
|
+
]
|
|
114
|
+
: [
|
|
115
|
+
"graph_edges",
|
|
116
|
+
"graph_nodes",
|
|
117
|
+
"graph_reachable",
|
|
118
|
+
"graph_component_members",
|
|
119
|
+
"graph_component_roots",
|
|
120
|
+
];
|
|
121
|
+
const relations = prepared.relationNames(relationNames);
|
|
122
|
+
const edges = relations.graph_edges;
|
|
123
|
+
const nodes = relations.graph_nodes;
|
|
124
|
+
const roots = relations.graph_component_roots;
|
|
125
|
+
const q = quoteIdentifier_js_1.default;
|
|
126
|
+
const common = `${edges} AS (
|
|
127
|
+
${prepared.edges(mode === "weak" ? "both" : "outgoing")}
|
|
128
|
+
), ${nodes} AS (
|
|
129
|
+
SELECT ${q("__from")} AS ${q("node")},
|
|
130
|
+
${q("__from_key")} AS ${q("__key")}
|
|
131
|
+
FROM ${edges}
|
|
132
|
+
UNION
|
|
133
|
+
SELECT ${q("__to")} AS ${q("node")},
|
|
134
|
+
${q("__to_key")} AS ${q("__key")}
|
|
135
|
+
FROM ${edges}
|
|
136
|
+
)`;
|
|
137
|
+
if (mode === "weak") {
|
|
138
|
+
const labels = relations.graph_component_labels;
|
|
139
|
+
return `WITH RECURSIVE ${common}, ${(0, buildWeakGraphComponentsSql_js_1.default)(edges, nodes, labels, roots)}
|
|
140
|
+
SELECT ${q("roots")}.${q("componentId")}, ${q("labels")}.${q("node")}
|
|
141
|
+
FROM ${labels} AS ${q("labels")}
|
|
142
|
+
INNER JOIN ${roots} AS ${q("roots")}
|
|
143
|
+
ON ${q("labels")}.${q("__root_key")} =
|
|
144
|
+
${q("roots")}.${q("__root_key")}
|
|
145
|
+
ORDER BY ${q("labels")}.${q("__node_key")}`;
|
|
146
|
+
}
|
|
147
|
+
const reachable = relations.graph_reachable;
|
|
148
|
+
const members = relations.graph_component_members;
|
|
149
|
+
return `WITH RECURSIVE ${common}, ${reachable}(
|
|
150
|
+
${q("__start_key")}, ${q("__node_key")}
|
|
151
|
+
) AS (
|
|
152
|
+
SELECT ${q("__key")}, ${q("__key")} FROM ${nodes}
|
|
153
|
+
UNION
|
|
154
|
+
SELECT ${q("reached")}.${q("__start_key")},
|
|
155
|
+
${q("edges")}.${q("__to_key")}
|
|
156
|
+
FROM ${reachable} AS ${q("reached")}
|
|
157
|
+
INNER JOIN ${edges} AS ${q("edges")}
|
|
158
|
+
ON ${q("reached")}.${q("__node_key")} =
|
|
159
|
+
${q("edges")}.${q("__from_key")}
|
|
160
|
+
), ${members} AS (
|
|
161
|
+
SELECT ${q("nodes")}.${q("node")}, ${q("nodes")}.${q("__key")},
|
|
162
|
+
MIN(${q("forward")}.${q("__start_key")}) AS ${q("__root_key")}
|
|
163
|
+
FROM ${nodes} AS ${q("nodes")}
|
|
164
|
+
INNER JOIN ${reachable} AS ${q("forward")}
|
|
165
|
+
ON ${q("nodes")}.${q("__key")} =
|
|
166
|
+
${q("forward")}.${q("__node_key")}
|
|
167
|
+
INNER JOIN ${reachable} AS ${q("reverse")}
|
|
168
|
+
ON ${q("forward")}.${q("__start_key")} =
|
|
169
|
+
${q("reverse")}.${q("__node_key")}
|
|
170
|
+
AND ${q("nodes")}.${q("__key")} =
|
|
171
|
+
${q("reverse")}.${q("__start_key")}
|
|
172
|
+
GROUP BY ${q("nodes")}.${q("node")}, ${q("nodes")}.${q("__key")}
|
|
173
|
+
), ${roots} AS (
|
|
174
|
+
SELECT ${q("__root_key")},
|
|
175
|
+
CAST(row_number() OVER (ORDER BY ${q("__root_key")}) - 1 AS BIGINT)
|
|
176
|
+
AS ${q("componentId")}
|
|
177
|
+
FROM (SELECT DISTINCT ${q("__root_key")} FROM ${members})
|
|
178
|
+
AS ${q("distinct_roots")}
|
|
179
|
+
)
|
|
180
|
+
SELECT ${q("roots")}.${q("componentId")}, ${q("members")}.${q("node")}
|
|
181
|
+
FROM ${members} AS ${q("members")}
|
|
182
|
+
INNER JOIN ${roots} AS ${q("roots")}
|
|
183
|
+
ON ${q("members")}.${q("__root_key")} =
|
|
184
|
+
${q("roots")}.${q("__root_key")}
|
|
185
|
+
ORDER BY ${q("members")}.${q("__key")}`;
|
|
186
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
type DegreeOptions = {
|
|
3
|
+
count?: "edges" | "neighbors";
|
|
4
|
+
weight?: string;
|
|
5
|
+
outputTable?: string | boolean;
|
|
6
|
+
};
|
|
7
|
+
export default function degree(simpleTable: SimpleTable, sourceColumn: string, targetColumn: string, options?: DegreeOptions): SimpleTable;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=degree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"degree.d.ts","sourceRoot":"","sources":["../../src/methods/degree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAQvD,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,aAAkB,GAC1B,WAAW,CAoEb"}
|