GDS 알고리즘 실행
그래프를 메모리에 로드하고 알고리즘을 구성하는 작업을 포함하여 GDS 라이브러리의 다양한 그래프 알고리즘을 실행하는 방법을 학습합니다.
GDS 알고리즘 실행은(는) CoddyKit의 무료 Neo4j Graph Database Fundamentals 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Neo4j Graph Database Fundamentals 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Neo4j Graph Database Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
GDS Algorithm Workflow
The Graph Data Science (GDS) library in Neo4j helps us run powerful graph algorithms. To use GDS, you generally follow a three-step process:
- Project: Load a subset of your graph into GDS's optimized in-memory store.
- Execute: Run an algorithm on this in-memory graph.
- Write Back: Optionally, write the results back to your Neo4j database.
Projecting Your Graph
Before running an algorithm, GDS needs to know which part of your database graph to analyze. This process is called graph projection.
You define which nodes and relationships, based on their labels and types, should be copied into GDS's fast in-memory representation. This makes algorithm execution much quicker.
Projecting Nodes Only
Let's project a simple graph containing only nodes with the label Person. We give our projected graph a name, like myGraph.
The gds.graph.project procedure creates this in-memory graph.
CALL gds.graph.project(
'myGraph',
'Person',
{}
) YIELD graphName, nodeCount, relationshipCount;Projecting Nodes and Relationships
More commonly, you'll project both nodes and relationships. Here, we project Person nodes and their KNOWS relationships.
We specify the node label and the relationship type. You can also add properties to the projection.
CALL gds.graph.project(
'socialGraph',
'Person',
'KNOWS'
) YIELD graphName, nodeCount, relationshipCount;Executing GDS Algorithms
Once your graph is projected, you can run various algorithms. GDS algorithms often have different execution modes:
- Stream: Returns results directly as a stream of rows. Great for immediate analysis.
- Stats: Returns only summary statistics about the algorithm's run.
- Write: Writes the results back to your Neo4j database as new properties or relationships.
PageRank Stream Example
Let's run the PageRank algorithm on our socialGraph in stream mode. PageRank helps identify influential nodes.
We use gds.pageRank.stream and pass the name of our projected graph.
CALL gds.pageRank.stream('socialGraph')
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).name AS person, score
ORDER BY score DESC
LIMIT 5;Customizing Algorithm Settings
GDS algorithms are highly configurable. You can pass a map of parameters to fine-tune their behavior.
Common parameters include maxIterations, dampingFactor (for PageRank), or concurrency. Always check the GDS documentation for specific algorithm parameters.
PageRank with Custom Settings
Here, we run PageRank with a custom dampingFactor and limit the maxIterations. This gives you more control over the algorithm's execution and convergence.
CALL gds.pageRank.stream(
'socialGraph',
{
maxIterations: 10,
dampingFactor: 0.8
}
)
YIELD nodeId, score
RETURN gds.util.asNode(nodeId).name AS person, score
ORDER BY score DESC
LIMIT 5;Persisting Algorithm Results
Often, you'll want to store the results of an algorithm back into your Neo4j database. This allows you to query them later or use them in further analysis.
The write mode of GDS algorithms adds new properties to nodes or creates new relationships based on the algorithm's output.
Writing PageRank Scores
To write results, use the .write procedure, like gds.pageRank.write. You need to specify the property name where the score will be stored on the original nodes.
After running this, each Person node in your database will have a new property, pageRankScore.
CALL gds.pageRank.write(
'socialGraph',
{
writeProperty: 'pageRankScore'
}
)
YIELD nodeCount, ranIterations, didConverge;GDS Workflow Check
Which of the following are essential steps in the typical GDS algorithm workflow?
Running GDS Algorithms Recap
Great job! You've learned the core steps for running GDS algorithms:
- Projecting your graph into GDS memory using
gds.graph.project. - Executing algorithms in stream, stats, or write modes.
- Configuring algorithms with custom parameters.
- Writing back results to your Neo4j database for persistence.
Next, you'll explore advanced GDS pipelines and integration with machine learning!
자주 묻는 질문
“GDS 알고리즘 실행” 강의는 무료인가요?
네 — “GDS 알고리즘 실행” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Neo4j Graph Database Fundamentals 강의 전체를 잠금 해제할 수 있습니다. Neo4j Graph Database Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.
“GDS 알고리즘 실행”에서 뭘 배우나요?
그래프를 메모리에 로드하고 알고리즘을 구성하는 작업을 포함하여 GDS 라이브러리의 다양한 그래프 알고리즘을 실행하는 방법을 학습합니다. 브라우저에서 직접 실행하는 실습 코드로 Neo4j Graph Database Fundamentals을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Neo4j Graph Database Fundamentals을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Neo4j Graph Database Fundamentals은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.
“GDS 알고리즘 실행” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Neo4j Graph Database Fundamentals 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Neo4j Graph Database Fundamentals 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.