Week 7 L1 Flashcards
What do we mean by ad-hoc
When necessary or needed
What are the downsides of relational relationships
need to define FK when using associative table
cannot add in ad-hoc way
recursive use of joins can be complex and slow
What are the fundamentals of graph dbs ?
They are schemaless
Each node can have different properties like document DBS
A node can have a relationship with any other node
node pairs can have one or more relationship
What are the key features of graph db relationships ?
Relationships have a type - any pair of nodes can have a relationship of any type
Relationships can have properties - relationships can be considered as nodes that join other nodes
What do nodes represent
Nodes represent entities e.g. people in social networks, locations in distribution services
What do edges represent
Edges represent relationships e.g. likes, plays, friends of , delivers to
What do we mean by directional edges ?
Node to an edge is either incoming or outgoing for example A likes B does not mean B likes A
What do properties do to a relationship
They add meaning
What do nodes have ?
Lables and properties
What do edges have ?
Types and properties
What is relationship depth
Measured edges between one node and another
What do we mean by graph traversal?
Means visiting nodes by following edges
Traversal starts with a chosen node.
Can follow incoming or outgoing nodes so travel in either direction
What are the different types of traversal
Depth first traversal- Follows as far as possible along each edge to its end node then backtracks and follows the next unvisited edge and so on
Breadth first traversal
Follows the neighbouring nodes first then follows the next depth of neighbours and so on
Why would you use indexes in graph databases ?
Speeds up search for specific nodes or edges.
Useful for finding the starting nodes for traversal.
Without index whole graph might be scanned.
Index for types of nodes etc
How would you do a “who likes me “query?
Traverse the incoming nodes to me to depth 1 with edge type like