Graph Databases

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Edge - Properties

A commonly used property is called the weight of an edge. Weights represent some value about the relationship.

Neo4j - Graph Database

A graph database stores data in a graph, the most generic of data structures.

What is Graph?

A graph is composed of two elements: nodes and relationships.

Multigraph

A multigraph is a graph with multiple edges between vertices. ➢ For example, a shipping company. The company could use a graph database for determining the least costly way to ship items between cities. Multiple edges between cities could represent various shipping options, such as shipping by truck, train, or plane. Each edge would have its own properties, such as the time taken to transport an item between two cities, cost per kilogram to ship, and so forth.

Neo4j Highlights

A native graph database. Neo4j is built from the ground up to be a graph database. The architecture is designed for optimizing fast management, storage, and traversal of nodes and relationships.

Vertex

A vertex (nodes) represents an entity marked with a unique identifier. Analogous to a primary key in a relational database.

Edge

An edge, also known as a link or arc, defines relationships between vertices

Betweenness

Betweenness is a measure of how much of a bottleneck a given vertex is. ▪ Imagine a city on a river that has many roads but only one bridge ▪ Betweenness helps identify potentially vulnerable parts of a network.

Closeness

Closeness is a property of a vertex that indicates how far the vertex is from all others in the graph. ▪ Closeness is an important measure if you want to understand the spread of information in a social network, an infectious disease in a community, or movement of materials in a distribution network. ▪ Vertices with high closeness values can reach other vertices in the network faster than vertices with smaller closeness values.

Degree

Degree is the number of edges linked to a vertex and is one way to measure the importance of any given vertex in a graph. ▪ Vertices with high degrees are more directly connected to other vertices than vertices with low degrees. ▪ Degree is important when addressing problems of spreading information or properties through a network.

Graph Algorithms

Most common algorithms to solve the Shortest Path problem: ▪ Dijkstra's Algorithm ▪ Incremental Network Expansion (INE) ▪ Incremental Euclidean Restriction (IER) ▪ Range Network Expansion (RNE) ▪ Range Euclidean Restriction (RER) --- There are two basic types of graph search algorithms: ▪ depth-first, and ▪ breadth-first.

Cypher

Neo4j's graph query language

Neo4j - Nodes

Nodes are used to represent entities.

Neo4j - Relationships

Relationships between nodes are the key feature of graph databases, as they allow for finding related data. A relationship connects two nodes, and is guaranteed to have a valid source and target node.

Edge - Types

There are two types of edges: directed and undirected.

Neo4j - Labels

a named graph construct that is used to group nodes into sets All nodes labeled with the same label belongs to the same set. ▪ A node may be labeled with any number of labels, including none, making labels an optional addition to the graph.

Path

a set of vertices along with the edges between those vertices. ▪ If edges are directed, the path is a directed path. If the graph is undirected, the paths in it are undirected paths.

Loop

an edge that connects a vertex to itself.

ACID

atomicity, consistency, isolation, durability - properties of database transactions to guarantee the validity

Operations on Graphs

inserting, reading, updating, and deleting data. ▪ Three important operations unique to graphs: ▪ Union of graphs ▪ Intersection of graphs ▪ Graph traversal

Neo4j - Properties

named values where the name (or key) is a string. The supported property value types: boolean binary logic value integer 64-bit integer float 64-bit IEEE 754 floating-point number string sequence of Unicode characters

Union of Graphs

the combined set of vertices and edges in a graph.

Graph Traversal

the process of visiting all vertices in a graph in a particular way.

Intersection of Graphs

the set of vertices and edges that are common to both graphs.

Bipartite Graph

▪ A bipartite graph, or bigraph, is a graph with two distinct sets of vertices where each vertex in one set is only connected to vertices in the other set. ▪ Bipartite graphs are useful when modeling relationships between different types of objects. ▪ For example, one set of vertices might represent businesses and another might represent people. An edge between a given person and a business appears if the person works for that business. ▪ Other examples include teachers and students, members and groups, and train cars and trains.

Flow Network

▪ A flow network is a directed graph in which each edge has a capacity and each vertex has a set of incoming and outgoing edges. ▪ The sum of the capacity of incoming edges cannot be greater than the sum of the capacity of outgoing edges. ▪ They can also be used to model processes with continuous flows, such as a network of storm drains that take in rainwater (source) and allow it to flow into a river (sink).

Graph Databases

▪ A graph database is based on a branch of mathematics known as graph theory. ▪ The techniques in this area of mathematics are useful for analyzing connections and links between entities.

Weighted Graph

▪ A weighted graph is a graph in which each edge has a number assigned to it. The number can reflect a cost, a capacity, or some other measure of an edge.

Undirected and Directed Graphs

▪ An undirected graph is one in which the edges are not directed. ➢ This type of graph is used for modeling relations or flows where direction does not make sense. For example, you can model couples in a domestic relationship using undirected edges. ▪ Directed graphs are graphs with directed edges. ➢ You can model a parent-child relationship with directed edges.

Indexes

▪ Cypher enables the creation of indexes on one or more properties for all nodes that have a given label: o An index that is created on a single property for any given label is called a single property index. o An index that is created on more than one property for any given label is called a composite index. ▪ Once an index has been created, it will automatically be managed and kept up to date by the database when the graph is changed. Neo4j will automatically pick up and start using the index once it has been created and brought online.

Graph Algorithms - BFS

▪ On the contrary from the Depth-First, dealing with semantically rich graph databases allows for informed searches, which conduct an early termination of a search if nodes with no compatible outgoing relationships are found. ▪ As a result, informed searches also have lower execution times. ▪ Breadth-first algorithms conduct searches by exploring the graph one layer at a time. ▪ They begin with nodes one level deep away from the start node, followed by nodes at depth two, then depth three, and so on until the entire graph has been traversed.

Order and Size

▪ Order and size are measures of how large a graph is. The order of a graph is the number of vertices, whereas the size of a graph is the number of edges in a graph.

Properties of Graphs and Nodes

▪ Several properties of graphs and nodes are useful when comparing and analyzing graphs: o Isomorphisms o Order and Size o Degree o Closeness o Betweenness

Graph - Shortest Path

▪ Shortest Path problem is the problem of finding a path between two vertices in a graph with the most minimum sum of the weights of its edges. ▪ Example: finding Shortest Path from A to F ▪ The Shortest Path is A→ C → E → D → F = 20

Graph Algorithms - DFS

▪ The Depth-First Algorithm travels from a starting node to some end node before repeating the search down a different path from the same start node until the query is answered. ▪ Generally, depth-first is a good choice when trying to discover discrete pieces of information. They are also a good strategy for general graph traversals. ▪ The most classic or basic level of depth-first is an uninformed search, where the algorithm searches a path until it reaches the end of the graph, then backtracks to the start node and tries a different path.

Isomorphism

▪ Two graphs are considered isomorphic if for each vertex in the first graph, there is a corresponding vertex in the other graph. ▪ Graph isomorphism is important if you are trying to detect patterns in a set of graphs.


संबंधित स्टडी सेट्स

Chapter 12- Nervous System Physiology Homework

View Set

Protons, neutrons, electrons unit

View Set

A&P Final Mastering questions (Heart)

View Set

MTA 98-366 Networking Fundamentals Lesson 4 Practice Questions

View Set

Behavioral Genetics and Epigenetics

View Set

Ch 4 Respiratory disorders lz peds exam 3

View Set

Art Appreciation Final Exam Study Guide

View Set