liveBook · Manning

Edge

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An edge is a graph connection between two vertices, optionally representing a directed or weighted relationship.

An edge is a connection between two vertices in a graph. It can represent a relationship, transition, or physical link, and may carry attributes such as length, capacity, or material. section 3.1

Choose the edge form that matches the relationship being modeled:

  • Use an undirected edge when the connection works in both directions, so the order of its vertices does not matter. section 3.1
  • Use a directed edge when movement or influence has a specified direction, such as a one-way street, dependency, or causal relationship. section 3.1
  • Add a weight when the connection has a measurable cost, such as distance, travel time, fuel consumption, or number of turns. section 3.1 section 4.4
  • Allow parallel edges in a multigraph when the same vertices have several distinct relationships or routes. section 3.1

Creating edges with NetworkX

A small undirected graph can connect vertices 0 through 4 with edges such as (0, 1), (1, 2), (1, 3), (2, 3), and (3, 4). Replacing Graph with DiGraph makes those connections directional. For weighted relationships, weighted edges can connect devices with values such as 45.69, 56.34, and 18.5. section 3.1

In routing, edges model road segments between intersections or points of interest. Search algorithms use their direction and weights to compare routes; Dijkstra’s algorithm and uniform-cost search use cumulative non-negative edge costs. section 3.6 section 4.4

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines edge direction, multiplicity, and weights, then connects them to NetworkX construction and shortest-path search.
Examples
Uses NetworkX graphs, parallel roads, device connections, social relationships, and University of Toronto road segments.
What it assumes
Assumes vertices and basic graph terminology while defining edge variants from the ground up.
What you can do after
Build graph connections with NetworkX and select direction, multiplicity, or weights for routing and search problems.
How it connects
Connects edges to graphs, vertices, directed graphs, multigraphs, weighted graphs, graph traversal, and shortest-path search.

Also explained in

Compare how 18 books explain edge →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.