3.0 University logo
  • Home
  • About us
  • All Courses
    • Cybersecurity Programs
      • Certified Ethical Hacker (CEH v13)
      • Certified SOC Analyst
      • Certified Penitration Testing Professional
      • Computer Hacking Forensic Investigator
      • Certified Cybersecurity Technician (CCT)
      • Certified AI Program Manager
      • Certified Offensive AI Security Professional
      • Certified Responsible AI Governance & Ethics Professional
      • Artificial Intelligence Essentials
    • Crypto Market Programs
    • Blockchain & Web3 Programs
      • Digital Assets Trading & Analysis Program
      • Certified Web3 Strategy & Growth Specialist
      • Certified Web3 Governance & Compliance Expert
      • Full Stack Blockchain Developer Program
      • Private Blockchain Developer Program
      • Public Blockchain Developer Program
    • IGM x IIG Programs
      • Jewellery Design Executive Program
      • Gems & Diamond Specialist Program
      • Jewellery Business Specialist Program
  • Schools
    • School of Decentralized Economics
    • School of Cyber Resilience
    • School of Intelligent Systems
    • School of Design Thinking
  • Partners
    • Certification & Knowledge Partner
    • Academic Partner
    • Hiring Partner
    • Delivery Partner
    • Affiliate Partner
    • Hybrid Center Partner
  • Blog
  • Home
  • About us
  • All Courses
    • Cybersecurity Programs
      • Certified Ethical Hacker (CEH v13)
      • Certified SOC Analyst
      • Certified Penitration Testing Professional
      • Computer Hacking Forensic Investigator
      • Certified Cybersecurity Technician (CCT)
      • Certified AI Program Manager
      • Certified Offensive AI Security Professional
      • Certified Responsible AI Governance & Ethics Professional
      • Artificial Intelligence Essentials
    • Crypto Market Programs
    • Blockchain & Web3 Programs
      • Digital Assets Trading & Analysis Program
      • Certified Web3 Strategy & Growth Specialist
      • Certified Web3 Governance & Compliance Expert
      • Full Stack Blockchain Developer Program
      • Private Blockchain Developer Program
      • Public Blockchain Developer Program
    • IGM x IIG Programs
      • Jewellery Design Executive Program
      • Gems & Diamond Specialist Program
      • Jewellery Business Specialist Program
  • Schools
    • School of Decentralized Economics
    • School of Cyber Resilience
    • School of Intelligent Systems
    • School of Design Thinking
  • Partners
    • Certification & Knowledge Partner
    • Academic Partner
    • Hiring Partner
    • Delivery Partner
    • Affiliate Partner
    • Hybrid Center Partner
  • Blog
    Login
    ₹0.00 0 Cart

    Learn Articles

    • Home
    • Learn Articles

    Degree of a Node in a Graph: Definition, Types and Examples

    • Posted by 3.0 University
    • Date August 18, 2026
    • Comments 0 comment

    The degree of a node in a graph is the total number of edges connected to that node. In an undirected graph, each edge adds one to the degree and a self-loop adds two. In a directed graph, degree splits into in-degree (incoming edges) and out-degree (outgoing edges). Written formally as deg(v) or d(v).

    • Key Takeaway 1: Degree counts edges at a vertex. A self-loop counts as two in an undirected graph.
    • Key Takeaway 2: Directed graphs split degree into in-degree and out-degree. Both matter for algorithm design.
    • Key Takeaway 3: The handshaking lemma states the sum of all degrees in any undirected graph always equals twice the number of edges.
    • Key Takeaway 4: You can read a node’s degree directly from its adjacency matrix row sum.
    • Key Takeaway 5: Graph degree reasoning is tested in DSA interview rounds at top Indian tech companies, and graph skills matter in fintech, analytics and blockchain roles.

    What the Degree of a Node Actually Means

    Pick any vertex in a graph and count the edges attached to it. That count is its degree. The concept comes from formal graph theory, first systematised by Leonhard Euler in the 18th century, and it remains a core topic in every discrete mathematics course, including BSc Computer Science programmes across India.

    The notation for the degree of a node is usually deg(v) or d(v), where v is the vertex. If a vertex has degree zero, it is called an isolated vertex, meaning it has no edges at all. If it has degree one, it is a pendant vertex, connected by exactly one edge to the rest of the graph.

    Self-Loops and Why They Count Twice

    A self-loop is an edge that starts and ends at the same vertex. In an undirected graph, convention (and the formal definition in Diestel’s Graph Theory, 5th edition, 2017) counts a self-loop as contributing 2 to the degree of that vertex. The reasoning is that the loop uses both ends of the edge at the same node.

    So if vertex A has two regular edges and one self-loop, its degree of node A is 2 + 2 = 4. Students often lose marks here. Do not make that mistake.

    Degree Sequence

    List every node’s degree in non-increasing order and you get the graph’s degree sequence. For example, a graph with degrees [4, 3, 3, 2, 2] tells you quite a lot about the graph’s structure before you even draw it. Erdos and Gallai proved in 1960 that a sequence of non-negative integers is a valid degree sequence for a simple graph if and only if their sum is even and a specific inequality holds for every prefix of the sequence.

    In-Degree vs Out-Degree in Directed Graphs

    When edges have direction, one count is not enough. A directed graph (digraph) has arrows on its edges. Each arrow points from a source vertex to a target vertex. That changes how you measure the degree of a node in any directed graph.

    In-degree of a vertex is the number of edges pointing into it. Out-degree is the number of edges pointing out of it. The total degree is in-degree plus out-degree, and a self-loop still contributes one to each, so two in total.

    A Concrete Example

    Imagine a small directed graph with vertices A, B, C and edges A to B, A to C, B to C, C to A. Here is what the degrees look like:

    Vertex In-Degree Out-Degree Total Degree
    A 1 (from C) 2 (to B, C) 3
    B 1 (from A) 1 (to C) 2
    C 2 (from A, B) 1 (to A) 3

    In a directed graph, the sum of all in-degrees equals the sum of all out-degrees, and both equal the total number of edges. This is the directed version of the handshaking lemma.

    Why PageRank Cares About In-Degree

    Google’s original PageRank algorithm, described by Page and Brin in their 1998 Stanford technical report, assigns importance to a web page partly based on how many other pages link to it. That is in-degree. A page with many high-quality inbound links ranks higher. The same logic applies in citation networks and social influence graphs. High in-degree often signals authority; high out-degree often signals activity or spam.

    The Handshaking Lemma and Reading Degree from a Matrix

    The handshaking lemma is one of the most elegant results in graph theory. It states: in any undirected graph, the sum of the degrees of all vertices equals twice the number of edges.

    Formally: if G = (V, E), then the sum of deg(v) for all v in V equals 2|E|. The intuition is that every edge contributes exactly one to each of the two vertices it connects, so it contributes exactly two to the total degree count. A direct consequence is that every graph has an even number of vertices with odd degree. This fact is provable in a single paragraph and appears in virtually every discrete maths exam, including those at IITs and NITs.

    Finding Degree of a Node from an Adjacency Matrix

    An adjacency matrix A is a square matrix where A[i][j] = 1 if there is an edge from vertex i to vertex j, and 0 otherwise. Reading the degree of a node from it is straightforward.

    For an undirected graph, the degree of vertex i is the sum of row i (or equivalently column i, since the matrix is symmetric). Self-loops appear as A[i][i] = 1, but they contribute 2 to degree, so you would count them separately or use the convention A[i][i] = 2 in the matrix, which some textbooks adopt.

    For a directed graph, the out-degree of vertex i is the row sum of row i. The in-degree of vertex i is the column sum of column i.

    Adjacency Matrix vs Adjacency List for Degree Calculation

    Both representations give you the degree of a node, but with different costs. The table below compares them on the metrics that matter:

    Property Adjacency Matrix Adjacency List
    Space complexity O(V squared) O(V + E)
    Time to find degree of one node O(V): scan the row O(1): list length
    Best for dense graphs? Yes No
    Best for sparse graphs? No Yes
    Used in NetworkX (Python)? Optional (numpy) Default internal structure

    NetworkX, the standard Python library for graph analysis, stores graphs as adjacency lists internally and exposes degree via G.degree(node). The NumPy and Pandas skills you already know transfer directly when working with adjacency matrices in NumPy arrays.

    Where Graph Degree Matters in Real Systems

    Graph theory is embedded in the infrastructure of real products used every day, and it is a skill set that hiring teams in India actively look for.

    Social Network Analysis

    In social graphs, the degree of a node tells you how connected a user is. A node with very high degree in a friendship graph is an influencer. A node with sudden in-degree spikes in a financial transaction graph might be a money mule. According to the ACFE’s 2024 Report to the Nations, organisations lose an estimated 5% of revenue to fraud annually, and graph-based anomaly detection is one of the fastest-growing tools to combat it. Degree centrality is often the first metric analysts check.

    Recommendation Systems

    Bipartite graphs connect users to products. A product node’s degree (number of users who bought it) is a raw popularity signal. Collaborative filtering algorithms on platforms like Flipkart and Amazon India build on these degree distributions to surface recommendations. According to McKinsey’s 2023 report on personalisation, recommendation engines drive up to 35% of Amazon’s revenue.

    Blockchain and Fintech

    Every Bitcoin transaction creates a directed edge between wallet addresses. Blockchain analytics firms like Chainalysis compute in-degree and out-degree of wallet nodes to identify mixing services, exchange hubs and high-risk addresses. According to NASSCOM’s 2024 India Fintech Report, India’s fintech sector is projected to reach $150 billion in assets under management by 2025, with graph analytics cited as a core risk-detection capability. If you are aiming for a role in fintech risk or blockchain analytics, graph degree reasoning is a concrete, testable skill. Check out entry-level tech jobs growing in 2026 to see how analytics and blockchain roles are trending.

    DSA Interview Rounds

    Graph traversal and degree-based reasoning appear regularly in the DSA rounds at companies like Infosys, TCS Digital, Wipro Elite, and product companies running MAANG-style interviews. Questions often ask you to find nodes with maximum degree, detect isolated vertices, or verify degree sequences. Knowing the handshaking lemma cold can save you from a wrong-answer submission under time pressure.

    If you want to build these skills systematically, explore the structured tracks at 3.0 University’s course library, where graph structures are applied to real data science and blockchain analytics problems.

    Frequently Asked Questions

    What is the degree of a node in a graph?

    The degree of a node (vertex) is the total number of edges connected to it. In an undirected graph, every edge adds one to the degree, and a self-loop adds two. In a directed graph, degree splits into in-degree (incoming edges) and out-degree (outgoing edges). The notation is usually written as deg(v) or d(v).

    What is the difference between in-degree and out-degree?

    In a directed graph, in-degree is the count of edges pointing into a vertex and out-degree is the count of edges pointing out of it. A web page with many inbound links has high in-degree. An API endpoint that calls many services has high out-degree. Both values together give the total degree of that vertex in the directed graph.

    What is the handshaking lemma?

    The handshaking lemma states that the sum of the degrees of all vertices in an undirected graph equals exactly twice the number of edges. Written formally: sum of deg(v) = 2|E|. A useful corollary is that any graph must have an even number of vertices with odd degree. This result is provable from first principles and appears in almost every discrete mathematics exam.

    How do you find a node’s degree from an adjacency matrix?

    For an undirected graph, sum the entries in the row (or column) corresponding to that node. The row sum gives the degree of that node. For a directed graph, the row sum gives out-degree and the column sum gives in-degree. Self-loops on the diagonal may be counted as 2 depending on the textbook convention, so check which definition your course uses.

    How is graph degree used in real-world applications?

    Graph degree powers PageRank (web search), recommendation engines (e-commerce), social network analysis, fraud detection in fintech, and blockchain transaction tracing. In India, companies in payments, logistics and social media all use graph-based models. DSA rounds at major IT companies test graph fundamentals including degree of a node, traversal and shortest paths regularly.

    Last updated: August 2026. Reviewed by the 3University editorial team.

    • Share:
    3.0 University

    Previous post

    Clustering in Data Mining: Types, Algorithms and Real Use Cases
    August 18, 2026

    Next post

    Formulation of Hypothesis: Steps, Types and Practical Examples
    August 18, 2026

    You may also like

    Free AI Certificate Course by Government of India
    FREE AI Course with Certificate Launched by Govt of India
    June 19, 2026
    Highest Paid Professions in India
    Highest Paid Profession in India
    June 12, 2026
    Cyber Security Course Eligibility
    Cyber Security Course Eligibility
    June 11, 2026

    Leave A Reply Cancel reply

    You must be logged in to post a comment.

    3.0 University is a pioneering academic initiative for creating a comprehensive knowledge ecosystem for emerging technologies. We have developed an in-house suite of course offerings for retail, institutional market participants and industry-at-large. 

    Facebook X-twitter Instagram Linkedin
    Quick Links
    • About us
    • Courses
    • Become a Partner
    • Contact Us
    • Blog
    • Learn
    Trending Courses
    • Certified SOC Analyst
    • Certified Ethical Hacker v13 Program
    • Certified Penitration Testing Professional
    • Full Stack Blockchain Developer
    • Certified AI Program Manager
    Policies
    • Privacy Policy
    • Terms and Conditions
    • Disclaimer
    • Refund Policy
    Contact Us
    FT Tower, CTS No. 256 & 257, Suren Road, Chakala, Andheri (E), Mumbai-400093 India.

    +91 8657961141

    support@3university.io

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Register a new account

    Are you a member? Login now

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Register a new account

    Are you a member? Login now

    Sign In

    Welcome back! Or create an account

    OR
    Forgot password?

    Need a new verification email?

    Don't have an account? Register

    Create Account

    Already have an account? Sign in

    OR

    Already have an account? Log in

    Reset Password

    Enter your email and we'll send you a reset link.

    ← Back to login

    Check Your Email

    Almost there!
    We have sent a verification link to your email address. Please check your inbox (and spam folder) and click the link to activate your account.

    Didn't receive the email? Enter your address to resend:

    Already verified? Sign in