refactoring
Changing the structure of a graph without changing what it represents, usually to make queries simpler, faster or more logical.
Example
Before, the country a film was made in is a property of the film.
After, it is a node the films share.
cypher
MATCH (m:Movie)
MERGE (c:Country {name: m.country})
MERGE (m)-[:RELEASED_IN]->(c)
REMOVE m.countryBoth graphs record the same two facts. In the second, a query reaches Apollo 13 from Toy Story by following two relationships. Before, it had to scan the country property of every film.
Lessons that use this term
The lesson and course links below open in a new tab.
17 lessons use this term. Results are ordered by term density.
Graph Data Modeling Fundamentals23 mentions
- RefactoringRefactoring the Graphis the process of changing the data model and the2 mentions
- Eliminating Complex Data in NodesEliminating Duplicate Dataneed not be retrieved to get at the complex data, then you might consider refactoring the graph as shown3 mentions
- Specializing ACTED_IN and DIRECTED RelationshipsUsing Specific Relationshipsthis refactoring, we can now confirm that our rewritten query works for the use3 mentions
- Adding Language nodesEliminating Duplicate Datais the Cypher code for the use case before the refactoring1 mention
- Retesting After RefactoringRefactoring the Graphdetermine if any of the queries need to be rewritten to take advantage of the refactoring4 mentions
- Adding the Director LabelRefactoring the Graphrefactoring the graph, you must test any use cases that are1 mention
- Adding Language DataEliminating Duplicate Dataadd a languages property to each Movie node in the instance model, before refactoring to eliminate the1 mention
- What is Graph Data Modeling?Getting Startedthe refactoring on the graph and retest using2 mentions
- Adding Genre nodesEliminating Duplicate Datacan check the outcome of the refactoring by running this1 mention
- Specific RelationshipsUsing Specific Relationshipsa result of the refactoring, the previous two queries can be rewritten and will definitely perform better for a large2 mentions
- Specializing RATED RelationshipsUsing Specific Relationshipsthe refactoring where we removed the genres and languages properties from the nodes, we will not remove the rating property from1 mention
- Refactoring Duplicate DataEliminating Duplicate Datais what the instance model looks like after the refactoring1 mention
- Labels in the GraphRefactoring the Graph1 mention
Neo4j Management, Optimization, and Refactoring Workshop11 mentions
- Why refactor?Graph refactoringthis lesson, you will learn about the importance of graph refactoring and when it's necessary to improve performance and8 mentions
- Challenge: Refactor the graphGraph refactoringthe challenge above and are looking for an extra challenge, you can try refactoring the graph to calculate and store the total cost of an order by summing the price of the products in the1 mention
- Normalizing a property to a nodeGraph refactoringparticularly when dealing with large datasets, to create constraints before refactoring your2 mentions
Get started with Graph Data Science2 mentions
- Understanding graph data scienceGet started with the Graph Data Science libraryThis refactoring isn't fast, and it's not computationally efficient2 mentions