0% found this document useful (0 votes)
158 views15 pages

Heterogeneous Graphs

A heterogeneous graph is a type of graph where the nodes or edges can have different types or attributes. Heterogeneous graphs encompass a range of node and edge categories and attribute diversity. They find utility across diverse domains like social networks, recommendation systems, and biological networks.

Uploaded by

zubairnaeem 92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views15 pages

Heterogeneous Graphs

A heterogeneous graph is a type of graph where the nodes or edges can have different types or attributes. Heterogeneous graphs encompass a range of node and edge categories and attribute diversity. They find utility across diverse domains like social networks, recommendation systems, and biological networks.

Uploaded by

zubairnaeem 92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Heterogeneous

z
Graph
Hamza Naeem

21-CS-09
z

Definition

• A heterogeneous graph is a type of graph where the nodes or


edges can have different types or attributes. In other words, in a
heterogeneous graph, the entities represented by nodes and the
relationships between them represented by edges can vary in type
or have associated attributes.
z
Graphical representation
z
Graphical representation
z
Properties and characteristics
 Variety of Node and Edge Categories: Heterogeneous graphs encompass a range of
node and edge categories. Nodes represent distinct entities, while edges symbolize
relationships among these entities. Each category of nodes and edges may carry
unique semantics and features.

 Attribute Diversity: Nodes and edges within heterogeneous graphs can exhibit a
wide array of attributes. These attributes furnish additional context about the entities
and relationships they signify, including textual descriptions, numerical values,
temporal information, and other pertinent data types.

 Wide-ranging Applications: Heterogeneous graphs find utility across diverse


domains, spanning social networks, recommendation systems, knowledge graphs,
biological networks, and e-commerce platforms. They furnish a versatile framework
for modeling and scrutinizing intricate relational data in these domains.
z
Representation and Modelling

• To represent heterogeneous graphs, various data structures and models are


utilized, including:
• Adjacency matrices: Matrices where rows and columns represent different types of
nodes, and entries denote the presence or absence of edges between them.
• Adjacency lists: Lists that store neighbors of each node along with their types or
attributes.
• Tensor representations: Multi-dimensional arrays that capture higher-order
relationships between nodes and edges of different types.

• Modeling heterogeneous graphs often involves incorporating node and edge


attributes, as well as considering the semantics of different types of
relationships.
z
Adjacent Matrices
z
Tensor flow representation
z
Bipartite Graph

 A bipartite graph is a graph whose vertices can be divided into two


disjoint sets such that every edge connects a vertex from one set to a
vertex in the other set.
z
Signed Graph

 A signed graph is a graph in which each edge is labeled with a


positive or negative sign, indicating whether the relationship between
the connected vertices is positive or negative.
z
Temporal Graph
 Temporal graphs are graphs where edges or nodes have associated time stamps
or time intervals, indicating when they are active or when relationships occur.
z
Multi-Modal Graph

 Multimodal graphs represent heterogeneous data with multiple types


of nodes and edges, each associated with distinct modes or attributes.
z
Spatial Graph (Types)

 Spatial graphs incorporate spatial information, where nodes or edges


are associated with geographical coordinates or positions in space.
z
Applications

• Social Networks: Heterogeneous graphs are used to model social networks


where nodes represent users, products, and activities, and edges represent
relationships such as friendships, purchases, or interactions.

• Recommender Systems: In recommendation systems, heterogeneous graphs


help model user-item interactions, incorporating user preferences, item
attributes, and contextual information to generate personalized
recommendations.

• Biological Networks: Heterogeneous graphs are applied in bioinformatics to


model molecular interactions, genetic pathways, and protein-protein
interactions, facilitating the study of complex biological systems.
z
Coding
import dgl
import torch

data_dict = {
('user', 'watches', 'movie'): (torch.tensor([0, 0, 1, 2]),

torch.tensor([0, 1, 0, 1])),
('director', 'directs', 'movie'): (torch.tensor([0, 1]),

torch.tensor([1, 0]))
}
hetero_graph = dgl.heterograph(data_dict)
hetero_graph

You might also like