Embedding dei grafi con GDS
Imparate come Graph Data Science genera embedding dei nodi che trasformano la struttura del grafo in vettori per il machine learning.
Embedding dei grafi con GDS è una lezione Neo4j Graph Database Fundamentals gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Neo4j Graph Database Fundamentals, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Neo4j Graph Database Fundamentals include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
From Graphs to Vectors
Machine learning models work with numbers, not graph topology. Graph embeddings convert each node into a fixed-length vector that captures its position and neighborhood.
Why Embeddings Help
Once nodes are vectors, you can feed them into classifiers, clustering, and similarity search. Similar nodes end up close together in vector space.
Projecting a Graph
Embeddings run on an in-memory graph projection in GDS. First project the nodes and relationships you care about.
CALL gds.graph.project(
'embedGraph',
'Person',
'FRIEND'
);FastRP
FastRP (Fast Random Projection) is a quick, scalable embedding algorithm. It is a great default for large graphs.
CALL gds.fastRP.stream('embedGraph', { embeddingDimension: 128 })
YIELD nodeId, embedding
RETURN gds.util.asNode(nodeId).name AS name, embedding
LIMIT 5;Node2Vec
Node2Vec uses biased random walks to learn embeddings that balance local and global structure. It is slower but often richer than FastRP.
CALL gds.node2vec.stream('embedGraph', { embeddingDimension: 128, walkLength: 80 })
YIELD nodeId, embedding
RETURN nodeId, embedding
LIMIT 5;GraphSAGE
GraphSAGE is an inductive method: it learns a function that can embed even new nodes not seen during training, using their features.
Choosing Dimensions
The embedding dimension trades expressiveness for cost. Common values are 64, 128, or 256. Larger is more detailed but heavier.
Writing Embeddings Back
Use the write mode to store embeddings as a node property, so other queries and tools can use them.
CALL gds.fastRP.write('embedGraph', {
embeddingDimension: 128,
writeProperty: 'embedding'
});Using Embeddings for Similarity
With vectors stored, compute cosine similarity between embeddings to find nodes that are structurally alike.
MATCH (a:Person {name: 'Alice'}), (b:Person)
WHERE a <> b
RETURN b.name, gds.similarity.cosine(a.embedding, b.embedding) AS sim
ORDER BY sim DESC LIMIT 5;Embeddings in ML Pipelines
Embeddings are powerful features for GDS machine learning pipelines: node classification and link prediction both benefit from them.
Choosing an Algorithm
Use FastRP for speed at scale, Node2Vec for richer structure, and GraphSAGE when you must embed unseen nodes.
Quick Check
Test your embeddings knowledge.
Recap
You learned graph embeddings in GDS:
- Embeddings turn nodes into vectors
- FastRP is fast and scalable
- Node2Vec uses biased random walks
- GraphSAGE handles unseen nodes
- Write embeddings back and use them in ML pipelines
Domande Frequenti
La lezione «Embedding dei grafi con GDS» è gratuita?
Sì — il testo completo di «Embedding dei grafi con GDS» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Neo4j Graph Database Fundamentals, passa a CoddyKit PRO. Il corso Neo4j Graph Database Fundamentals include 4 lezioni in totale.
Cosa imparerò in «Embedding dei grafi con GDS»?
Imparate come Graph Data Science genera embedding dei nodi che trasformano la struttura del grafo in vettori per il machine learning. Eserciti Neo4j Graph Database Fundamentals con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Neo4j Graph Database Fundamentals?
Non è richiesta alcuna esperienza precedente. Neo4j Graph Database Fundamentals su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Embedding dei grafi con GDS»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Neo4j Graph Database Fundamentals?
Sì. Ogni lezione Neo4j Graph Database Fundamentals include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Introduzione alla libreria GDS
- Esecuzione degli algoritmi GDS
- Pipeline GDS e machine learning
- Embedding dei grafi con GDS