Philip Jama

Articles /Network Graph Analysis /Part 1

Foundations

Graph representations, key metrics, and visualization with NetworkX

Graph TheoryPythonNetworkXTutorial

Graphs are everywhere: social networks, transportation routes, biological pathways, the internet itself. A graph is simply a set of nodes connected by edges, yet this minimal structure encodes rich relational information that matrices and tables miss. This article lays the groundwork for a series on network graph analysis: starting with the representations, metrics, and visualizations you need to reason about any network.

The series draws on three portfolio projects that use graph techniques: Calendar Graph project ↗ (organizational network analysis), Graphception project ↗ (concept extraction and associative networks), and Books project ↗ (LLM-generated outlines as tree graphs).

What Is a Graph and Why It Matters

A graph G = (V, E) consists of a vertex set V and an edge set E. Edges can be directed or undirected, weighted or unweighted. This abstraction lets us model friendships, citations, dependencies, and countless other relationships in a single framework.

Representations: Adjacency Matrix, Edge List, Adjacency List

How you store a graph matters. An adjacency matrix is an n×n array where entry (i,j) indicates an edge between nodes i and j: great for dense graphs and linear algebra. An edge list is a simple collection of (u, v) pairs: compact and easy to stream. An adjacency list maps each node to its neighbors: ideal for sparse graphs and traversal algorithms. NetworkX abstracts over these, but understanding the tradeoffs guides performance decisions.

Key Metrics: Degree, Clustering, Path Length, Density

A handful of metrics capture a graph’s structure:

  • Degree: how many connections a node has. The degree distribution often reveals whether a network is random, scale-free, or something else.
  • Clustering coefficient: the fraction of a node’s neighbors that are also connected to each other. High clustering suggests tight-knit communities.
  • Average shortest path length: the typical number of hops between any two nodes. Small-world networks have short paths despite high clustering.
  • Density: the ratio of actual edges to possible edges. Most real-world networks are sparse.
Small-world network with spring layout and annotated metrics
Small-world network with spring layout and annotated metrics
Show Python source

Visualization Approaches

Layout algorithms turn abstract graphs into spatial pictures:

  • Force-directed (spring): treats edges as springs and nodes as repelling charges. Good for revealing clusters.
  • Hierarchical: arranges nodes in layers. Suited for DAGs and tree-like structures.
  • Circular: places nodes on a ring. Useful for comparing connectivity patterns.

No layout is objectively best: each reveals different aspects of the same graph.

Co-authorship network colored by research field with metric annotations
Co-authorship network colored by research field with metric annotations
Show Python source

Series Roadmap

With these foundations in place, the series branches into three directions:

Branch A: Social & Organizational Networks

Branch B: Knowledge Graphs

Branch C: Graph Deep Learning

Each branch builds on the representations and metrics introduced here.

Degree distributions and clustering coefficients describe a graph's texture -- but the most useful structure is often hidden in densely connected subgroups.

View all articles in Network Graph Analysis

Collaborate

If you're exploring related work and need hands-on help, I'm open to consulting and advisory. Get in touch