CS224W: Machine Learning With Graphs Jure Leskovec, Http .

Transcription

CS224W: Machine Learning with GraphsJure Leskovec, Stanford Universityhttp://cs224w.stanford.edu

The class meets Tue and Thu 1:30-3:00pmPacific Time in person Videos of the lectures will be recorded and postedon Canvas Structure of lectures: 60-70 minutes of a lecture During this time you can ask questions 10-20 minutes of a live Q&A/discussion session atthe end of the lecture9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs2

9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs3

DateTue, Sep 21Thu, Sep 23TopicDate1. Introduction; Machine Learningfor Graphs2. Traditional Methods for ML onGraphsTue, Oct 26Thu, Oct 28Tue, Sep 283. Node EmbeddingsThu, Nov 4Thu, Sep 304. Link Analysis: PageRankTue, Nov 9Tue, Oct 5Thu, Oct 7Tue, Oct 12Thu, Oct 145. Label Propagation for NodeClassification6. Graph Neural Networks 1: GNNModel7. Graph Neural Networks 2: DesignSpace8. Applications of Graph NeuralNetworksTue, Oct 199. Theory of Graph Neural NetworksThu, Oct 2110. Knowledge Graph Embeddings9/22/2021Thu, Nov 11Topic11. Reasoning over KnowledgeGraphs12. Frequent Subgraph Miningwith GNNs13. Community Structure inNetworks14. Traditional GenerativeModels for Graphs15. Deep Generative Models forGraphsTue, Nov 1616. Advanced Topics on GNNsThu, Nov 1817. Scaling Up GNNsFri, Nov 19EXAMTue, Nov 3018. Guest lecture: TBDThu, Dec 219. GNNs for ScienceJure Leskovec, Stanford CS224W: Machine Learning with Graphs4

http://cs224w.stanford.edu Slides posted before the class Readings: Graph Representation Learning Book byWill Hamilton Research papers Optional readings: Papers and pointers to additional literature This will be very useful for course projects9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs5

Ed Discussion: Access via link on Canvas Please participate and help each other! Don’t post code, annotate your questions, search foranswers before you ask We will post course announcements to Ed (makesure you check it regularly) Please don’t communicate with prof/TAs viapersonal emails, but always use: re Leskovec, Stanford CS224W: Machine Learning with Graphs6

OHs will be virtual We will have OHs every day, starting from 2nd weekof the course See http://web.stanford.edu/class/cs224w/oh.htmlfor Zoom links and link to 0pmJure Leskovec, Stanford CS224W: Machine Learning with Graphs7

Final grade will be composed of: Homework: 25% 3 written homeworks, each worth 8.3% Coding assignments: 20% 5 coding assignments using Google Colab, each worth 4% Exam: 35% Course project: 20% Proposal: 20%; Final report: 70%; Poster: 10% Extra credit: Ed participation, PyG/GraphGym codecontribution Used if you are on the boundary between grades9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs8

How to submit? Upload via Gradescope You will be automatically registered to Gradescope onceyou officially enroll in CS224W Homeworks, Colabs (numerical answers), andproject deliverables are submitted on Gradescope Total of 2 Late Periods (LP) per student Max 1 LP per assignment (no LP for the final report) LP gives 4 extra days: assignments usually due onThursday (11:59pm) with LP, it is due the followingMonday (11:59pm)9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs9

Homeworks (25%, n 3) Written assignments take longer and take time( 10-20h) – start early! A combination of data analysis, algorithm design, andmath Colabs (20%, n 5) We have more Colabs but they are shorter( 3-5h); Colab 0 is not graded. Get hands-on experience coding and training GNNs;good preparation for final projects and industry9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs10

Single exam: Friday, Nov 19 Take-home, open-book, timed Administered via Gradescope Released at 10am PT on Friday, available until 10amPT the following day Once you open it, you will have 100 minutes tocomplete the exam Content Will have written questions (similar to Homework), willpossibly have a coding section (similar to Colabs) More details to come!9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs11

Two options (1) Default project (predefined task) (2) Custom project (open-ended) Logistics Groups of up to 3 students Groups of 1 or 2 are allowed; the team size will be takenunder consideration when evaluating the scope of the project.But 3 person teams can be more efficient. Google Cloud credits We will provide 50 in Google Cloud credits to each student You can also get 300 with Google Free tier) Read: http://cs224w.stanford.edu/info.html9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs12

AssignmentDue on (11:59pm PT)Colab 0Colab 1Homework 1Project ProposalColab 2Homework 2Colab 3Homework 3Colab 4EXAMColab 5Project ReportNot gradedThu, Oct 7 (week 3)Thu, Oct 14 (week 4)Tue, Oct 19 (week 5)Thu, Oct 21 (week 5)Thu, Oct 28 (week 6)Thu, Nov 4 (week 7)Thu, Nov 11 (week 8)Thu, Nov 18 (week 9)Fri, Nov 19 (week 9)Thu, Dec 2 (week 11)Thu, Dec 9 (No Late Periods!)9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs13

Make sure you readand understand it! We strictly enforce the Stanford Honor Code Violations of the Honor Code include: Copying or allowing another to copy from one’s own paperUnpermitted collaborationPlagiarismGiving or receiving unpermitted aid on a take-home examinationRepresenting as one’s own work the work of anotherGiving or receiving aid on an assignment under circumstances inwhich a reasonable person should have known that such aid wasnot permitted The standard sanction for a first offense includes a onequarter suspension and 40 hours of community service.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs14

The course is self-contained.No single topic is too hard by itself.But we will cover and touch upon many topicsand this is what makes the course hard. Good background in: Machine Learning Algorithms and graph theory Probability and statistics Programming: You should be able to write non-trivial programs (in Python) Familiarity with PyTorch is a plus9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs15

We use PyG (PyTorch Geometric): The ultimate library for Graph Neural Networks We further recommend: GraphGym: Platform for designing Graph NeuralNetworks. Modularized GNN implementation, simple hyperparametertuning, flexible user customization Both platforms are very helpful for the course project(save your time & provide advanced GNNfunctionalities) Other network analytics tools: SNAP.PY, NetworkX9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs16

CS224W: Machine Learning with GraphsJure Leskovec, Stanford Universityhttp://cs224w.stanford.edu

Why Graphs?Graphs are a generallanguage for describing andanalyzing entities withrelations/interactions9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs18

9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs19

Graph9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs20

Image credit: SalientNetworksEvent GraphsImage credit: WikipediaFood Webs9/22/2021Computer NetworksDisease PathwaysImage credit: PinterestImage credit: visitlondon.comParticle NetworksUnderground NetworksJure Leskovec, Stanford CS224W: Machine Learning with Graphs21

Image credit: ScienceImage credit: MediumSocial NetworksEconomic Networks Communication NetworksImage credit: Missoula Current NewsCitation Networks9/22/2021Image credit: Lumen LearningInternetJure Leskovec, Stanford CS224W: Machine Learning with GraphsImage credit: The ConversationNetworks of Neurons22

Image credit: Maximilian Nickel et alKnowledge GraphsImage credit: ese.wustl.eduRegulatory NetworksImage credit: ResearchGateImage credit: MDPICode GraphsMolecules9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with GraphsImage credit: math.hws.eduScene GraphsImage credit: Wikipedia3D Shapes23

Image credit: Maximilian Nickel et alKnowledge GraphsMain question:Image credit: ese.wustl.eduRegulatory NetworksImage credit: math.hws.eduScene GraphsHow do we take advantage ofrelational structure for betterprediction?Image credit: ResearchGateImage credit: MDPICode GraphsMolecules9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with GraphsImage credit: Wikipedia3D Shapes26

Complex domains have a rich relationalstructure, which can be represented as arelational graphBy explicitly modeling relationships weachieve better performance!9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs27

ImagesText/SpeechModern deep learning toolbox is designedfor simple sequences & grids9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs28

Moderndeep learning toolboxis designed forsequences & grids9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs29

Not everythingcan be represented asa sequence or a gridHow can we develop neuralnetworks that are much morebroadly applicable?New frontiers beyond classic neuralnetworks that only learn on imagesand sequences9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs30

Graphs are the new frontierof deep learningGraphs connect things.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs31

9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs32

Networks are complex. Arbitrary size and complex topologicalstructure (i.e., no spatial locality like grids)vs.TextNetworks ImagesNo fixed node ordering or reference pointOften dynamic and have multimodal features9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs33

How can we develop neural networksthat are much more broadlyapplicable?Graphs are the new frontierof deep learning9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs34

zInput: Network9/22/2021Predictions: Node labels,New links, Generatedgraphs and subgraphsJure Leskovec, Stanford CS224W: Machine Learning with Graphs35

(Supervised) Machine Learning Lifecycle:This feature, that feature. Every single arningAlgorithmRepresentationLearning -Automaticallylearn the featuresJure Leskovec, Stanford CS224W: Machine Learning with GraphsModelDownstreamprediction task36

Map nodes to d-dimensionalembeddings such that similar nodes inthe network are embedded closetogetherrepresentationnodeLearn a neural networku9/22/2021Feature representation,embeddingJure Leskovec, Stanford CS224W: Machine Learning with Graphs37

We are going to cover various topics in MachineLearning and Representation Learning for graphstructured data: Traditional methods: Graphlets, Graph Kernels Methods for node embeddings: DeepWalk, Node2Vec Graph Neural Networks: GCN, GraphSAGE, GAT,Theory of GNNs Knowledge graphs and reasoning: TransE, BetaE Deep generative models for graphs: GraphRNN Applications to Biomedicine, Science, Industry9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs38

DateTue, Sep 21Thu, Sep 23TopicDate1. Introduction; Machine Learningfor Graphs2. Traditional Methods for ML onGraphsTue, Oct 26Thu, Oct 28Tue, Sep 283. Node EmbeddingsThu, Nov 4Thu, Sep 304. Link Analysis: PageRankTue, Nov 9Tue, Oct 5Thu, Oct 7Tue, Oct 12Thu, Oct 145. Label Propagation for NodeClassification6. Graph Neural Networks 1: GNNModel7. Graph Neural Networks 2: DesignSpace8. Applications of Graph NeuralNetworksTue, Oct 199. Theory of Graph Neural NetworksThu, Oct 2110. Knowledge Graph Embeddings9/22/2021Thu, Nov 11Topic11. Reasoning over KnowledgeGraphs12. Frequent Subgraph Miningwith GNNs13. Community Structure inNetworks14. Traditional GenerativeModels for Graphs15. Deep Generative Models forGraphsTue, Nov 1616. Advanced Topics on GNNsThu, Nov 1817. Scaling Up GNNsFri, Nov 19EXAMTue, Nov 3018. Guest lecture: TBDThu, Dec 219. GNNs for ScienceJure Leskovec, Stanford CS224W: Machine Learning with Graphs39

CS224W: Machine Learning with GraphsJure Leskovec, Stanford Universityhttp://cs224w.stanford.edu

Node y(subgraph)levelEdge-level9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs41

Node classification: Predict a property of a node Example: Categorize online users / items Link prediction: Predict whether there are missinglinks between two nodes Example: Knowledge graph completion Graph classification: Categorize different graphs Example: Molecule property prediction Clustering: Detect if nodes form a community Example: Social circle detection Other tasks: Graph generation: Drug discovery Graph evolution: Physical simulation9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs42

Node classification: Predict a property of a node Example: Categorize online users / items Link prediction: Predict whether there are missinglinks between two nodes Example: Knowledge graph completion orizeML taskslead to Example:Molecule ng: Detect if nodes form a community Example: Social circle detection Others: Graph generation: Drug discovery Graph evolution: Physical simulation9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs43

A protein chain acquires its native 3D structureImage credit: DeepMind9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs45

Computationally predict a protein’s 3D structurebased solely on its amino acid sequenceImage credit: DeepMind9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs46

Image credit: DeepMindImage credit: SingularityHub9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs47

Key idea: “Spatial graph” Nodes: Amino acids in a protein sequence Edges: Proximity between amino acids (residues)Image credit: DeepMindSpatial graph9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs48

Users interacts with items Watch movies, buy merchandise, listen to music Nodes: Users and items Edges: User-item interactions Goal: Recommend items users might likeUsersInteractions“You might also like”Items9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs50

Ying et al., Graph Convolutional Neural Networks for Web-Scale Recommender Systems, KDD 2018Task: Recommend related pins to usersTask: Learn nodeembeddings such thatQuery pinPredict whether two nodes in a graph are related9/22/2021Jure Les kovec, Stanford CS224W: Ma chine Learning with Graphs8

PrescribedManypatients take multiple drugsDrugto treatdrugsside effectcomplex or co-existing diseases: 46% of people ages 70-79 take more than 5 drugsMany patients take more than 20 drugs to treatheart disease, depression, insomnia, etc.Task: Given a pair of drugs predictadverse side effects,30%9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphsprob.65%prob.52

Zitnik et al., Modeling Polypharmacy Side Effects with Graph Convolutional Networks, Bioinformatics 2018 Nodes: Drugs & ProteinsEdges: Interactions9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with GraphsQuery: How likelywill Simvastatin andCiprofloxacin, whentaken together,break down muscletissue?53

Zitnik et al., Modeling Polypharmacy Side Effects with Graph Convolutional Networks, Bioinformatics 2018Drug c9/22/2021Drug dJure Leskovec, Stanford CS224W: Machine Learning with GraphsEvidence found54

a9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs56

Nodes: Road segmentsEdges: Connectivity between road segmentsPrediction: Time of Arrival (ETA)Image credit: DeepMind9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs57

Predicting Time of Arrival with Graph NeuralNetworks Used in Google MapsImage credit: DeepMind9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs58

Antibiotics are small molecular graphs Nodes: Atoms Edges: Chemical bondsKonaklieva, Monika I. "Molecular targets of β-lactam-based antimicrobials:beyond the usual suspects." Antibiotics 3.2 (2014): 128-142.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with GraphsImage credit: CNN60

Stokes et al., A Deep Learning Approach to Antibiotic Discovery, Cell 2020 A Graph Neural Network graph classification modelPredict promising molecules from a pool of candidatesStokes, Jonathan M., et al. "A deep learning approach to antibiotic discovery."Cell 180.4 (2020): 688-702.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs61

You et al., Graph Convolutional Policy Network for Goal-Directed Molecular Graph Generation, NeurIPS 2018Graph generation: Generating novel moleculesUse case 1: Generate novel moleculeswith high Drug likeness valueUse case 2: Optimize existing molecules tohave desirable propertiesDrug likeness9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs62

Sanchez-Gonzalez et al., Learning to simulate complex physics with graph networks, ICML 2020Physical simulation as a graph: Nodes: Particles Edges: Interaction between particles9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs63

Sanchez-Gonzalez et al., Learning to simulate complex physics with graph networks, ICML 2020A graph evolution task: Goal: Predict how a graph will evolve overtime9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs64

CS224W: Machine Learning with GraphsJure Leskovec, Stanford Universityhttp://cs224w.stanford.edu

Objects: nodes, verticesInteractions: links, edgesSystem: network, graph9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with GraphsNEG(N,E)66

Movie 1friendActor 2Actor 1MaryPeterMovie 3Movie 2Actor 4brothersActor 3Protein 1friendco-workerTomAlbertProtein 2Protein 5Protein 99/22/2021 N 4 E 4Jure Leskovec, Stanford CS224W: Machine Learning with Graphs67

If you connect individuals that workwith each other, you will explore aprofessional networkIf you connect those that have asexual relationship, you will beexploring sexual networksIf you connect scientific papersthat cite each other, you will bestudying the citation networkImage credit: Euro ScientistsImage credit: ResearchGateIf you connect all papers with the same word in the title,what will you be exploring? It is a network, nevertheless9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs68

How to build a graph: What are nodes? What are edges? Choice of the proper network representationof a given domain/problem determines ourability to use networks successfully: In some cases, there is a unique, unambiguousrepresentation In other cases, the representation is by no meansunique The way you assign links will determine the natureof the question you can study9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs69

Undirected DirectedLinks: undirected Links: directed(symmetrical, reciprocal)(arcs)LADBMFCIDGBAHFC Examples: Collaborations Friendship on Facebook9/22/2021EGExamples: Phone calls Following on TwitterJure Les kovec, Stanford CS224W: Ma chine Learning with Graphs70

A heterogeneous graph is defined as Nodes with node types Edges with relation types Node type Relation type9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu71

Biomedical Knowledge GraphsExample node: MigraineExample edge: (fulvestrant, Treats, Breast Neoplasms)Example node type: ProteinExample edge type (relation): Causes9/22/2021Academic GraphsExample node: ICMLExample edge: (GraphSAGE, NeurIPS)Example node type: AuthorExample edge type (relation): pubYearJure Leskovec, Stanford CS224W: Machine Learning with Graphs, http://cs224w.stanford.edu72

UndirectedNode degree, ki: the numberof edges adjacent to node ikA 4AIn directed networks we definean in-degree and out-degree.DBDirected1 NAvg. degree: k k å ki 2EN i 1NCEGAFSource: Node with kin 0Sink: Node with kout 09/22/2021The (total) degree of a node is thesum of in- and out-degrees.kCin 2Ek NkCout 1Jure Leskovec, Stanford CS224W: Machine Learning with GraphskC 3k in k out73

Bipartite graph is a graph whose nodes can be divided into two disjoint sets U and V such thatevery link connects a node in U to one in V; that is,U and V are independent setsExamples: Authors-to-Papers (they authored)Actors-to-Movies (they appeared in)Users-to-Movies (they rated)Recipes-to-Ingredients (they contain)ABCDEUV“Folded” networks: Author collaboration networks Movie co-rating networks9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs74

Projection U9/22/2021UVJure Leskovec, Stanford CS224W: Machine Learning with GraphsProjection V75

44332211Aij 1Aij 0if there is a link from node i to node j 0 1A 0 1 1001otherwise00011 1 1 0 0 1A 0 0 000100011 0 0 0 Note that for a directed graph (right) the matrix is not symmetric.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs76

UndirectedDirected9/22/20214321æ0ç1çAij ç0çè1100001011ö 1 1 0øAij A jiAii 04321 0 1A 0 0 00010001NåAki ijj 1Nk j å Aiji 1NN11L å ki å Aij2 i 12 ij1 0 0 0 outNkoutinj å Aiji 1NAij ¹ A jiAii 0Jure Leskovec, Stanford CS224W: Machine Learning with GraphsL åki 1Nini åkj 1Noutj å Aiji, j77

9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs78

Most real-world networks are sparseE Emax (or k N-1)Consequence: Adjacency matrix is filled with zeros!(Density of the matrix (E/N2): WWW 1.51x10-5, MSN IM 2.27x10-8)9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs79

Represent graph as a list of edges: 9/22/2021(2, 3)(2, 4)(3, 2)(3, 4)(4, 5)(5, 2)(5, 1)2135Jure Leskovec, Stanford CS224W: Machine Learning with Graphs480

Adjacency list: Easier to work with if network is Large Sparse21 Allows us to quickly retrieve allneighbors of a given node354 1: 2: 3, 4 3: 2, 4 4: 5 5: 1, 29/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs81

Possible options: 9/22/2021Weight (e.g., frequency of communication)Ranking (best friend, second best friend )Type (friend, relative, co-worker)Sign: Friend vs. Foe, Trust vs. DistrustProperties depending on the structure of the restof the graph: Number of common friendsJure Leskovec, Stanford CS224W: Machine Learning with Graphs82

Unweighted (undirected)Weighted(undirected)441123 0 1Aij 1 01011211000 1 0 0 20140.5100Aii 0Aij A jiAii 01 NE å Aij2 i, j 12Ek N1 NE nonzero( Aij )2 i , j 1Examples: Friendship, Hyperlink9/22/20213 0 2Aij 0.5 0 0 4 0 0 Aij A ji2Ek NExamples: Collaboration, Internet, RoadsJure Leskovec, Stanford CS224W: Machine Learning with Graphs83

Self-edges (self-loops)(undirected) Multigraph(undirected)441123 1 1 Aij 1 0101121100Aii 03 0 2 Aij 1 00 1 0 1 Examples: Proteins, Hyperlinks9/22/2021 11000 3 0 0 Aii 0Aij A jiN1 NE Aii Aij 2 i , j 1,i ji 120131 NE nonzero( Aij )2 i , j 1Aij A ji2Ek NExamples: Communication, CollaborationJure Leskovec, Stanford CS224W: Machine Learning with Graphs84

Connected (undirected) graph: Any two vertices can be joined by a path A disconnected graph is made up by two ormore connected componentsBBAALargest Component:Giant ComponentIsolated node (node H)DFCDFHG9/22/2021CHGJure Leskovec, Stanford CS224W: Machine Learning with Graphs85

ConnectedDisconnectedThe adjacency matrix of a network with severalcomponents can be written in a block- diagonalform, so that nonzero elements are confined tosquares, with all other elements being zero:9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs86

Strongly connected directed graph has a path from each node to every other nodeand vice versa (e.g., A-B path and B-A path) Weakly connected directed graph is connected if we disregard the edge directionsEBFAD9/22/2021CGJure Leskovec, Stanford CS224W: Machine Learning with GraphsGraph on the left is connectedbut not strongly connected (e.g.,there is no way to get from F to G byfollowing the edge directions).87

Strongly connected components (SCCs) canbe identified, but not every node is part of anontrivial strongly connected component. SCCBEABFADECFGDCGSCCSCCIn-component: nodes that can reach the SCC,Out-component: nodes that can be reached from the SCC.9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs88

Machine learning with Graphs Applications and use cases Different types of tasks: Node level Edge level Graph level Choice of a graph representation: Directed, undirected, bipartite, weighted,adjacency matrix9/22/2021Jure Leskovec, Stanford CS224W: Machine Learning with Graphs89

Machine Learning Algorithms and graph theory Probability and statistics Programming: You should be able to write non-trivial programs (in Python) Familiarity with PyTorch is a plus 9/22/2021 Jure Leskovec, Stanford