Graph Neural Networks for Knowledge Graph Edge Prediction
Introduction to Graphs
What is a Graph?
At its core, a graph is a way to represent connections. Think of a map. You have cities, and you have roads connecting those cities. In graph theory, the cities are called nodes and the roads are called edges.
These two simple concepts, nodes and edges, are the building blocks for modeling all sorts of complex systems. They can represent social networks, computer networks, molecular structures, or even the flow of tasks in a project.
Node
noun
A fundamental unit of a graph that represents an entity or an object. It's also commonly called a vertex.
And the connections between them are just as important.
Edge
noun
A connection between two nodes in a graph. It represents a relationship or interaction.
Different Kinds of Relationships
Not all relationships are the same, so we have different types of graphs to model them. One key distinction is whether the connection goes both ways.
An undirected graph is like a Facebook friendship. If you are friends with someone, they are also friends with you. The relationship is mutual. An edge between two nodes is a two-way street.
A directed graph is more like following someone on Instagram. You might follow a celebrity, but that doesn't mean they follow you back. The relationship has a specific direction. An edge is a one-way street, shown with an arrow.
Another difference is whether the connection has a value attached to it.
An unweighted graph simply shows that a connection exists. Are two people friends? Yes or no. Is there a road between two cities? Yes or no.
A weighted graph adds a value, or "weight," to each edge. This weight can represent anything: the distance between two cities, the strength of a social connection, or the cost of sending data between two computers. These weights add a rich layer of information.
Describing Nodes and Connections
Once we have a graph, we need a language to talk about its properties. A few basic terms are essential.
Two nodes are adjacent if there is an edge directly connecting them. In our city map analogy, two cities are adjacent if there's a direct road between them with no other cities in between.
The degree of a node is simply the number of edges connected to it. If a city has 4 roads leading out of it, its node has a degree of 4. This tells us how connected that node is to the rest of the graph.
For directed graphs, we get more specific. In-degree is the number of edges pointing to a node, while out-degree is the number of edges pointing away from it. An Instagram celebrity has a very high in-degree (many followers) and a low out-degree (follows few people).
Finally, connectivity describes whether you can get from any node to any other node in the graph. If a graph is connected, it means it's all one piece. If it's disconnected, it consists of two or more separate clusters of nodes with no edges between them.
These fundamental concepts are the starting point for analyzing relationships and structures in almost any kind of data.