Year 2 block graphs: Smartie block graphs Year 2 amended

Posted on

Statistics in Year 2 (age 6–7)

 

In Year 2, your child will learn to draw simple charts and graphs. They will be able to sort categories by their quantities and will be able to compare sets of data.

The key words for this section are block graph, pictogram, and tally chart.

 

What your child will learn

Take a look at the National Curriculum expectations for statistics in Year 2 (age 6–7):

Draw pictograms, tally charts, block diagrams, and tables

Your child will record, collate, organise, and compare information using simple pictograms, tables, tally charts, and block graphs.

A pictogram is a graph that uses pictures to represent quantity:

A tally chart uses marks to represent numbers:

Your child will use block graphs (or block diagrams) where types of items are shown on the x-axis, the number of items is shown on the y-axis, and one block represents one item. A block graph is made up of separate blocks, and children can count the blocks to find out how many are in the group:

Count objects in multiple category and sort the categories by quantity

Your child will count the number of objects in different categories (such as types of fruit), and they will say which category has the most or least objects.

Your child will ask and answer simple questions about pictograms, tally charts, block graphs, and simple tables. For example:

How many children like grapes?

How many children like apples and bananas?

How many more children prefer apples to grapes?

Total and compare categorical data

Your child will ask and answer questions about data they collect. For example:

How many children took part in the survey?

What was their most popular option?

How to help at home

There are lots of everyday ways you can help your child to understand statistics. Here are just a few ideas.

 

1. Present data

In school, your child will be learning to present data with simple tables, pictograms, tally charts, and block graphs. You can encourage your child at home by having them investigate topics that particularly interest them and then present their data in tables, charts, and graphs.

For instance, your child could collect information about the planets in our solar system, favourite book characters, or football. See if they can create their own tables, charts, and graphs to represent the data in new and interesting ways. For example, they could by compare football players by goals scored so far this season.

Your child can record their findings using tables and present them with pictograms or block graphs.

Your child might need extra help when it comes to creating block graphs. Block graphs show types of items on the x-axis, the number of items on the y-axis, and have one block representing each item:

Once your child has practised lots of different ways of showing data, your child should be able to pick when it is best to use a block graph and when it is best to use a different method. They should be able to explain why.

 

2. Conduct a survey

If your child would prefer to gather their own data, why not do a survey? They could ask family and friends about their favourite food, film, sport, or anything else that takes their fancy.

Encourage your child to analyse their data and discuss any interesting findings. For example, did lots of people have the same favourite food? How many more people chose the most popular choice compared to the least popular choice?

Ask questions about the data they have found and encourage your child to begin asking their own questions, such as, ‘If I asked this question at school, would I get different results?’

 

3. Interpret data

You can help your child learn to interpret data in the form of tables, pictograms, tally charts, and block graphs by encouraging them to explore interesting topics. For example, if your child is interested in football, encourage them to interpret football team statistics in tables, charts, and graphs. You can find lots of examples online and in football magazines.

Look at non-fiction texts together. Can your child find any data presented in interesting ways? Encourage them to chat about the data they find and point out anything they would not have expected.

Block Diagrams Year 2 Statistics Resource Pack – Classroom Secrets

Block Diagrams Year 2 Resource Pack includes a teaching PowerPoint and differentiated varied fluency and reasoning and problem solving resources for Spring Block 2.

Not a member? Sign up here.

What’s included in the pack?

This pack includes:

  • Block Diagrams Year 2 Teaching PowerPoint.
  • Block Diagrams Year 2 Varied Fluency with answers.
  • Block Diagrams Year 2 Reasoning and Problem Solving with answers.

National Curriculum Objectives

Mathematics Year 2: (2S1) Interpret and construct simple pictograms, tally charts, block diagrams and simple tables

Mathematics Year 2: (2S2a) Ask and answer simple questions by counting the number of objects in each category and sorting the categories by quantity

Mathematics Year 2: (2S2b) Ask and answer questions about totalling and comparing categorical data

Differentiation For Year 2 Block Diagrams:

Varied Fluency
Developing Questions to support constructing and interpreting block diagrams where each block represents 1. Questions refer to totalling and comparing data.
Expected Questions to support constructing and interpreting block diagrams where each block represents 2, 5 or 10. Questions refer to totalling and comparing data.
Greater Depth Questions to support constructing and interpreting block diagrams where each block represents 2, 5 or 10, with some use of half blocks. Not all increments marked on the scale. Questions refer to totalling and comparing data.

Reasoning and Problem Solving
Questions 1, 4 and 7 (Problem Solving)
Developing Use the stem sentences to create questions about the block diagram. Each block represents 1 and question stems refer to totalling and comparing data.
Expected Use the stem sentences to create questions about the block diagram. Each block represents 2, 5 or 10 and question stems refer to totalling and comparing data.
Greater Depth Use the stem sentences to create questions about the block diagram. Each block represents 2, 5 or 10, with some half blocks used. Question stems refer to totalling and comparing data. Not all increments are marked on the scale.

Questions 2, 5 and 8 (Reasoning)
Developing Explain which statement about the block diagram is correct. Each block represents 1 and statements refer to totalling and comparing data.
Expected Explain which statement about the block diagram is correct. Each block represents 2, 5 or 10 and statements refer to totalling and comparing data.
Greater Depth Explain which statement about the block diagram is correct. Each block represents 2, 5 or 10, with some half blocks used. Statements refer to totalling and comparing data. Not all increments are marked on the scale.

Questions 3, 6 and 9 (Reasoning)
Developing Explain what is the same and what is different between two different charts. In block diagrams, each block represents 1.
Expected Explain what is the same and what is different between three different charts. In block diagrams, each block represents 2, 5 or 10.
Greater Depth Explain what is the same and what is different between different charts. In block diagrams, each block represents 2, 5 or 10, with some half blocks used. Not all increments are marked on the scale.

This resource is available to download with a Premium subscription.

Instruction for students studying on a contract basis

Tuition fees

Tuition fees are paid by bank transfer in rubles twice a year, separately for each semester in the amount of 50% of the tuition fee for the academic year:

  • per 1st semester the first course — within 7 calendar days from the date of signing the contract;
  • for subsequent semesters — no later than 14 calendar days from the start of the next semester.

Transfer of funds is carried out on the basis of a concluded agreement in two payments:

  • 70% of the tuition fee — to the account of the Faculty of Law of Moscow State University;
  • 30% of the tuition fee — to the account of Moscow State University.

Within the specified time it is necessary not only to make payment, but also to provide economists for the contractual work of the faculty with copies of payment documents. Copies are submitted to the address: Moscow, Leninskiye Gory, 1, building 13, office. 604B or email address: [email protected]

At the same time:

— a student who has financial debt to pay for tuition is not allowed to pass the session;

— in cases where the session is not closed on time and the student has academic debts, but there is also a financial debt to pay for the current semester, the student is not allowed to retake the test or exam of the teachers’ commission.

Please note that only Customer under the contract, it is his details that must be indicated in the payment documents in the «Payer» column. The return of unused funds, in the event of a student being expelled, is also made exclusively to the account of the customer (payer).

Payment for tuition at Moscow State University is made on the basis of personal payment documents (receipts). To receive a receipt, the student must go to his personal account on the portal of the educational department of the faculty cacs.law.msu.ru and select the «account» section in the drop-down menu in the upper corner. In case of problems, contact the email address. mail [email protected] .

Attention!

In case of violation by the customer of the terms and conditions of payment, the contract may be terminated by the contractor unilaterally, and the student will be expelled for financial debt, which will be recovered in court.

Notification of students and customers about the presence of financial arrears in tuition fees is carried out by posting relevant information on the website of the Faculty of Law of Moscow State University and on the information stands of contract economists and inspectors of the relevant courses.

Documents required to pay for tuition if the customer under the contract is a legal entity

Location: Moscow, Leninskiye Gory, 1, building 13, room 604B).

Consultations on tuition fees

You can get all answers to questions on tuition fees in the planning and financial department of the faculty from contract economists at the address: Moscow, Leninskiye Gory, 1, building 13, cab. 604B/629A. Admission of students is carried out in accordance with the schedule (see on the information stands of the department and on the website of the faculty in section PAID PROGRAMS) . During non-reception hours, for urgent questions, you can contact the office. 629A.

Contact details of the faculty economists:

  • telephones: 8 (499) 706-00-63; 8 (499) 706-00-60 (ext. 122-124)
  • e-mail: [email protected]

Payment through maternity capital

The current legislation of the Russian Federation provides for the right of the customer to pay for studies with the help of maternity capital. To make a payment, you must submit a copy of the certificate for maternity capital (a document confirming the right to use maternity capital) and an application with a request to draw up an additional agreement no later than 2.5-3 months before the start of semester . In this regard, payment from maternity capital for the 1st course is made from the 2nd semester. Documents are submitted to an economist for contract work at the address: Moscow, Leninskiye Gory, 1, building 13, office 604B/629A.

Further, the additional agreement is submitted by the customer to the PFR department at the place of residence for payment.

Attention!

Drawing up an additional agreement to pay for tuition with maternity capital is a lengthy procedure, therefore, in order to avoid conflict situations and the occurrence of financial debt, you should not delay the submission of documents.

Payment through an educational loan

The current legislation of the Russian Federation provides for the right of a student to pay for his studies with the help of an education loan with state support. In order to receive from the faculty the documents necessary for filling out a loan application, the student provides a letter from the bank about the intention to provide a loan to the student, indicating the details of the bank. Documents are submitted to an economist for contract work at the address: Moscow, Leninskiye Gory, 1, building 13, office. 604B/629A.

Attention!

Applying for a loan for education with state support is a lengthy procedure, therefore, in order to avoid conflict situations and the occurrence of financial debt that entails a violation of the terms of the contract and the terms of payment for tuition, letters from the bank about the intention to provide a loan to a student are accepted no later than September 10 in the autumn semester and February 10 in the spring semester .

The right to transfer students at Moscow State University from paid education to free education and the procedure for its implementation

The current legislation of the Russian Federation provides for the right of a student to switch from paid to free education (Federal Law «On Education in the Russian Federation» dated December 29, 2012 No. 273-FZ, art. 34, part 14).

According to the Procedure established by the Ministry of Education and Science of Russia (Order No. 443 dated June 6, 2013, as amended by orders No. 1286 dated September 25, 2014, No. 315 dated April 7, 2017), the transition is carried out to the vacant budget place in the absence of from the student at the time of application, academic debt (for credits, exams, term papers), disciplinary sanctions, arrears in tuition fees and compliance by the student with the following conditions :

a) passing exams for two semesters pre-application training for «excellent» or «excellent» and «good» or «good». The period of compliance with this condition begins no earlier than the next day after the end of the relevant session of the relevant semester and ends on the last day of the next session of the next semester;

b) assignment to the following categories of citizens:

  • orphans and children left without parental care, as well as persons from among orphans and children left without parental care. The period of compliance with this condition is valid until the age of 23;
  • 90,009 citizens under the age of twenty who have only one parent — a disabled person of group I, if the average per capita income of the family is below the subsistence level established in the corresponding subject of the Russian Federation. The period of compliance with this condition is valid from the moment the documents confirming belonging to this category are submitted to Moscow State University during the period of validity of the certificate certifying the level of average per capita family income;

  • women who gave birth to a child during the period of study;

c) the loss of one or both parents (legal representatives) or a single parent (legal representative) by a student during the period of study. The period of compliance with this condition is valid from the moment of submission of documents confirming belonging to this category at Moscow State University and until the end of training.

We recommend you immediately after the occurrence of one of the above conditions (a) — c)) submit a personal reasoned application (addressed to the rector of Moscow State University) with a request to switch from paid education to free education to the educational department to a specialist in educational and methodological work Ekaterina Valerievna Norina, office 409B, tel. +7 (499) 706-00-60 (ext. 301, 303). Such a declaration is valid for the period of compliance with the relevant condition.

It is recommended to attach to the application :

— received in the trade union committee of the faculty (e-mail: [email protected]) reference or recommendation for the transition from paid to free education (if the student has not yet joined a trade union, then he can join),

— received by in the student council of faculty (email: studsovetlaw@mail. ru or web page VK: https://vk.com/studsovetlaw) reference or recommendation for the transition from paid to free education,

— and, if any, diplomas, certificates, characteristics, confirming special student achievements in educational, research, social, cultural, creative and sports activities of Moscow State University .

In the presence (appearance) of a vacant state-funded place (places), your application is considered by the commission in strict accordance with the criteria established by the Academic Council of Moscow State University for determining the priority of the transition of students at Moscow State University from paid to free education.

You can also find information on the procedure for the transition of students at MSU from paid education to free education on the MSU website in the section «Study» — «General Information» — «Transition of students from paid education to free education», on the faculty website in the section «Education «- «Educational process» — «Information for students on the procedure for transferring from paid education to free education», and the information stand of the faculty (near room 409B).

I have read this information:

______________________________ (date) (signature)

introduction and acquaintance with the best libraries / Habr

A graph is a mathematical data structure that is a set of connected elements. Because graphs are inherently very flexible and allow information to be stored in a familiar and readable form, they have always been heavily used in computer science and technology. With the advent of machine learning and deep learning, graphs have gained even more popularity, creating a new direction — machine learning on graphs.

In this article I will tell you about the most useful Python libraries that I have used for network/graph analysis, visualization and machine learning. More specifically, these will be:

  • NetworkX for general graph analysis;
  • PyVis for interactive visualization of graphs directly in the browser;
  • PyG and DGL for solving various machine learning problems on graphs.

But first, let me say a few words about graph theory and machine learning on graphs, pointing out some useful educational sources along the way. If you do not know what a graph or machine learning on graphs is, then this is a great opportunity to lift the veil of mystery.

Brief introduction to graph theory and machine learning on graphs

A graph is simply a collection of interconnected elements.

However, the fact that these elements (called nodes) can contain any information and be connected in any way (using edges) makes a graph the most generalized data structure. In fact, any data familiar to us, regardless of their complexity, can be represented as a simple graph. For example, an image is in the form of a grid of pixels, and text is in the form of a sequence or chain of words.

You might wonder if graphs are really that important? The fact is that some tasks simply cannot be solved or even formulated without them, since it is impossible to structure some information. Imagine this situation: you need to visit a number of cities, say for tourism or work purposes. You have information about the distance between cities or, for example, the cost of travel by different modes of transport — that’s even more interesting. How to plan the best route in this situation in order to spend the minimum amount of money or travel the minimum distance?

Moreover, this is a rather practical task — imagine how relevant it is at least in the same logistics — and is an example of one that cannot be solved without graphs. Think about how you can represent this data, and in any case, you will come to a weighted graph anyway (graphs whose edges have a designated value are called weighted). By the way, if each city needs to be visited only once, then we will already have the well-known traveling salesman problem (TSP), which is not so easy to solve. One of the reasons for the difficulty is that the number of possible routes grows very quickly, and even for 7 cities there are as many as 360 of them!

Solving the traveling salesman problem with 7 cities using the brute force method

Graph theory was invented in the 18th century and used in the study of graphs, as well as solving various related problems: finding a possible or optimal path in a graph, building and developing trees ( a special kind of graphs) and so on. This theory has been successfully applied in the social sciences, chemistry, biology and other fields of knowledge. However, with the advent of computers, the technique of using graphs has reached a new level.

The main thing here is that the very basis of the graph — a set of related elements, often different and with different connections — turns out to be very useful for modeling real-world problems and datasets. This is where graph machine learning comes into play, although many amazing problems have been solved before it was even introduced. When humanity collected all kinds of data sets and created technologies for modeling them (for example, graph convolutional networks (GCN), similar to convolutional neural networks (CNN)), a wide range of problems opened up before it:

  • at the node level (e.g. node classification) — Assign a label to each node in the graph. An example of it will be given below, in which you need to divide a group of people into two clusters, based on information about their connections with each other. But at the same time, there are a lot of options for its use. The basic idea here comes from the field of social science, which says that we are dependent on our environment. In fact, any entity can be more effectively classified if we take into account not only some of its characteristics, but also data about its neighbors. For example, if your friends smoke, then you probably do too. Well, or if your friends go to the gym, then this most likely applies to you.
  • at the edge level (e.g. edge prediction) – involves predicting the presence of an edge between two nodes or, more commonly, an edge type (graphs that have multiple edge types are called multigraphs). This type of problem is very relevant for working with knowledge graphs, which we will learn more about shortly.
  • at the level of graphs . This includes graph classification, graph generation, and so on. This direction is especially useful for biology and chemistry, since molecules can be represented as graphs. The phrase classification of molecules (finding out whether a molecule has certain properties) or the generation of molecules (especially medicines) sounds much cooler than «graph-level problems».

Below we will analyze examples of graphs from real life. One of the most famous graph datasets is the karate club dataset. In it, each node represents a person (a member of the club), and each edge represents two members who interacted outside the club.

Visualization of a karate club dataset

A typical task here is to find two groups of people into which the club is divided after a dispute between two instructors (now it can be considered as a binary (or 2-class) classification of nodes). This dataset was compiled in 1977 and became a classic example of a social network of people or a community structure.

Another type of graph that is well understood by humans and therefore very useful for machine learning models is the knowledge graph. In it, the node represents a certain entity or concept, and the edge indicates the relationship of a pair of similar entities. Thus, the structure node-edge-node stores a specific fact of knowledge about the world or some system.

A simple example of a knowledge graph

The example above contains two types of edges: “is” ( is ) and “eats” ( eat ), so it is a multigraph. The structure Dogs-is-Animals tells us that the set dogs is a subset of animals . Simply put, dogs are animals.

Wikidata presents a free knowledge base from Wikipedia, which is constantly updated and contains more than 100 million nodes. It contains more than 400 types of ribs, including part of , different from , opposite of , population and location , that is, it is clearly deeply thought out.

Top 20 most common links in the wikidata knowledge base for 2020

This huge database contains a lot of information about the world around us. It still amazes me that mankind managed to collect all this data, and that machines can now process it.

Another highlight is wikidata’s excellent visualization capabilities. For example, here you see a graph of the connectedness of the US states. Note that no one drew it — it’s just a subgraph of the general wikidata graph. We have only taken US states as nodes and P47 (borders on) as edges.

Connectivity of the US states

Take a look at the Wikidata Graph Builder and other visualizations. Here are some that I personally find interesting:

  • a map of the relationship between master and student from the time of Socrates to the Hellenistic period;
  • interactive timelines with historical events;
  • Pan Pan panda family tree.

▍ More about boxes

If, after this brief overview, you are interested in learning more about graphs, I recommend the excellent work Gentle Introduction to Graph Neural Networks by Google Research. In this article, you can find additional examples and interactive visualizations.

I also recommend the Graph Theory Algorithms course on freeCodeCamp.org, which talks about various graph theory algorithms, or Stanford CS224W: Machine Learning with Graphs, which will help you get on the path of mastering machine learning on graphs.

Well, we’ll move on to getting to know the Python libraries.

NetworkX — general graph analysis

If you need to do any graph operations with Python, you will quickly stumble upon the NetworkX library. This is perhaps the most fundamental and widespread library for network analysis, providing a wide range of functionality:

  • data structures for storing and processing undirected/directed graphs and multigraphs;
  • set of ready-made graph algorithms;
  • basic visualization tools.

This library is quite intuitive and easy to use. At the same time, most of the basics, like graph data structures, will be the same or at least similar in all popular libraries for working with graphs. For a better understanding, you can create a simple graph and visualize it with the following code:0007

 import matplotlib.pyplot as plt
import networkx as nx
G = nx.Graph() # create a graph object
# define a list of nodes (node ​​IDs)
nodes = [1, 2, 3, 4, 5]
# define a list of edges
# list of tuples, each representing an edge
# tuple (id_1, id_2) means that nodes id_1 and id_2 are connected by an edge
edges = [(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (5, 5)]
# add information to the graph object
G.add_nodes_from(nodes)
G.add_edges_from(edges)
# draw a graph and display it
nx.draw(G, with_labels=True, font_weight='bold')
plt.show() 

NetworkX simple visualization

When it comes to algorithms, NetworkX is quite impressive in this regard, offering hundreds of ready-made options.

All in all, this is an efficient, scalable, and powerful library that will definitely come in handy when analyzing graphs.

▍ Link

https://networkx.org/

PyVis — Interactive Graph Visualization

If we consider using NetworkX for visualization, then it is quite suitable for small graphs. In cases where you need more flexibility or interactivity, it is preferable to pay attention to PyVis. The situation here is similar to choosing between matplotlib and plotly. Matplotlib is great for building quick and simple visualizations, but if you want to be able to interact with the graph or share it with someone else, it’s better to use more powerful tools.

Built on top of the VisJS library, PyVis allows you to create interactive visualizations in the browser with simple code. Let’s use it to build the graph from the example above.

 from pyvis.network import Network
net = Network() # create a graph object
# adding nodes
net.add_nodes(
    [1, 2, 3, 4, 5], # node ids
    label=['Node #1', 'Node #2', 'Node #3', 'Node #4', 'Node #5'], # node labels
    # node titles (display on mouse hover)
    title=['Main node', 'Just node', 'Just node', 'Just node', 'Node with self-loop'],
    color=['#d47415', '#22b512', '#42adf5', '#4a21b0', '#e627a3'] # node colors (HEX)
)
# add the same list of nodes as in the previous example
net. add_edges([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (5, 5)])
net.show('graph.html') # save visualization in 'graph.html' 

This code will create a file graph.html , opening which you can interact with your visualization: zoom in, drag its elements and perform other manipulations.

Rendering example with PyVis

Looks interesting, doesn’t it? This library even allows you to use the web UI to dynamically adjust the display configuration. You can get acquainted with all its main features in the official documentation.

▍ Link

https://pyvis.readthedocs.io/en/latest/

Graph Machine Learning with DGL and PyG

Now let’s move on to a more advanced topic — machine learning on graphs. Here I will introduce you to two of the most popular libraries: DGL and PyG.

DGL (Deep Graph Library) appeared in 2018. In contrast to PyG (PyTorch Geometric), which is built on top of PyTorch and only works with PyTorch tensors, DGL supports many machine learning frameworks, including PyTorch, TensorFlow, and MXNet.

Both libraries offer well-known Graph Neural Network (GNN) implementations such as GraphSAGE, GAT (Graph Attention Network), GIN (Graph Isomorphism Network) and others. With their help, it will be easy to build a model from ready-made blocks — this process is very similar to simple PyTorch or TensorFlow.

Here’s how PyG creates a two-layer GCN model to classify nodes:

 import torch
from torch_geometric.nn import GCNConv
class PyG_GCN(torch.nn.Module):
    def __init__(self, in_channels, hidden_channels, out_channels):
        super().__init__()
        # define two layers of a graph convolutional network
        self.conv1 = GCNConv(in_channels, hidden_channels)
        self.conv2 = GCNConv(hidden_channels, out_channels)
    def forward(self, x, edge_index):
        # x: node features matrix in the form (num_nodes, in_channels)
        # edge_index: graph link matrix in the form (2, num_edges)
        x = self.conv1(x, edge_index).relu()
        x = self.conv2(x, edge_index)
        return x
# for Cora citation database
num_features = 1433
num_classes = 7
num_hidden = 16
model = PyG_GCN(num_features, num_hidden, num_classes) 

And here is the same code for DGL:

 import torch
import torch. nn.functional as F
from dgl.nn import GraphConv
class DGL_GCN(torch.nn.Module):
    def __init__(self, in_channels, hidden_channels, out_channels):
        super(DGL_GCN, self).__init__()
        # define two layers of a graph convolutional network
        self.conv1 = GraphConv(in_channels, hidden_channels)
        self.conv2 = GraphConv(hidden_channels, out_channels)
    def forward(self, g, in_feat):
        # g: graph object in DGL containing information about node relationships
        # in_feat: feature matrix of nodes in the format (num_nodes, in_channels)
        h = self.conv1(g, in_feat)
        h = F.relu(h)
        h = self.conv2(g, h)
        return h
# for Cora citation database
num_features = 1433
num_classes = 7
num_hidden = 16
model = DGL_GCN(num_features, num_hidden, num_classes) 

If you are familiar with deep learning and PyTorch, then both of these snippets should be clear enough to you.

As you can see, the model definitions in both libraries are very similar. At the same time, the training loop in the case of PyG can be written using the basic PyTorch, but in the case of DGL it will require some changes (since graph objects in DGL store the entire data set, and training / validation / test samples must be accessed using binary masks) .

Here we have some difference in data presentation: we see that it is due to at least different input parameters for method forward . In fact, PyG saves everything as PyTorch tensors, and in DGL you need to use a separate graph object for this, and the internals of this library are more like NetworkX.

Not much of a problem though — you can convert a PyG graph object to a DGL graph and vice versa with just a few lines of code. More significant here will be the questions: “How else do these libraries differ, and which one should I choose?”

DGL or PyG

Trying to figure out which one is better, you will constantly come up with the same answer: «Try both and choose the one that suits you best. » Okay, but how are they different? Here, too, there is no clear clarity, and a typical answer would point to their significant similarity.

So it is. Moreover, you yourself saw this in the code example above. Naturally, with in-depth analysis, you can find some differences: here is a good list of resources, including reflections from the authors of the libraries themselves, and here you will find a detailed and versatile comparison of them.

As a rule, you will really need to try both to choose the most suitable one. If we talk about the pronounced differences, then DGL has a lower-level API, which makes it less convenient and understandable when implementing new ideas. But this library is more flexible — it is not limited to message passing networks (classical graph convolutional networks) and implements a number of principles that PyG cannot provide, for example, Tree-LSTM.

PyTorch Geometric, in contrast, has an API that is as easy to use as possible, and therefore more attractive to researchers who are interested in the rapid implementation of fresh ideas, such as new GNN implementations. Recently, the popularity of PyG has been growing, helped by the introduction of important updates in version 2.0 and the high activity of strong participants in the project, among which Stanford University is present.

Number of DGL and PyG searches in the last 5 years

So I recommend you try both of these libraries, starting with PyG.

If you are working on a relatively familiar graph problem (such as knot classification, graph classification, and so on), both PyG and DGL offer many GNN implementations for this. At the same time, with the help of PyG, it will be easier to implement your own GNN as any research project.

However, if you want to have full control over the internal processes or implement something more complex than a message passing structure, your choice will most likely fall on DGL.

▍ Links

  • official PyG website, PyG documentation;
  • DGL official website, DGL documentation.

Conclusion

The target audience of this article, that is, people interested in working with graphs, is rather small.

By alexxlab

Similar Posts