liveBook · Manning

Edge

As explained in Natural Language Processing in Action, Second Edition

An edge is a graph relationship connecting two nodes or vertices.

An edge is a relationship connecting two graph entities, called nodes or vertices. Edges let graphs represent how people, ideas, entities, or conversation states relate. section 6.4.6 section 11.8.1

Choose the edge type according to whether the relationship has direction:

  • An undirected edge represents a reciprocal relationship, such as a friendship connection. section 6.4.6
  • A directed edge represents a one-way relationship, such as following someone on a social network. section 6.4.6
  • An edge may carry a weight, such as a sentence-similarity score used to decide which concepts connect. section 6.4.6
  • In a knowledge graph, a relation connects an entity to a value, forming one part of an entity–relation–value triple. section 11.8.1

Connecting similar sentences

Create one node for each sentence, represent each sentence with an embedding, and add an undirected edge when the similarity exceeds 0.95. Store the similarity as the edge weight, then visualize the network with a force-directed layout.

Edges in conversation graphs

A chatbot conversation graph uses nodes for chatbot states and edges for possible moves between states. A user response or trigger can select the next state, allowing the design to encode prompts, answers, loops, and alternative paths. section 12.3.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains directed and undirected forms, weighted similarity connections, and graph construction, but defers general graph algorithms.
Examples
Uses friendship, social-network following, sentence similarity, knowledge triples, and chatbot state transitions as concrete edge examples.
What it assumes
Assumes nodes or vertices and relationships as the basic vocabulary for graphs.
What you can do after
Build it from scratch by connecting nodes with NetworkX edges, assigning weights, and plotting the resulting graph.
How it connects
Connects edges to graphs, nodes, vertices, sentence embeddings, knowledge graphs, relations, and chatbot states.

Also explained in

Compare how 18 books explain edge →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.