Graph reasoning
Graph reasoning helps you define a graph from part of your semantic model, run graph algorithms, and use their results in downstream logic and analysis. Use this overview to decide when graph reasoning fits your question and to choose the right next guide.
What graph reasoning is
Section titled “What graph reasoning is”Graph reasoning is a workflow for answering structure-focused questions by building a graph from part of your model. A graph represents a set of things called nodes and the connections between them called edges.
In PyRel, you typically:
- Define what counts as a node and what counts as an edge for your question.
- Choose whether the graph is directed or undirected, and weighted or unweighted.
- Run an algorithm to compute a result.
- Join the algorithm result back into your model as a relationship you can query and reuse.
Graph reasoning does not turn your entire semantic model into “the graph”. Instead, you build a graph for a specific question by choosing what counts as a node and what counts as an edge.
When to use graph reasoning
Section titled “When to use graph reasoning”Use graph reasoning when your question is about connectivity, ranking, similarity, or communities. If your question is a straightforward filter, join, or aggregate, it is usually clearer to answer it with rules-based reasoning instead.
| If you need to… | Use a… | To get… |
|---|---|---|
| Answer reachability or distance questions | Connectivity algorithm or distance algorithm | A relationship that pairs nodes with nodes they can reach, and optionally how far apart they are |
| Find important or influential nodes | Centrality algorithm | A relationship that assigns a score to each node, so you can see which ones matter most |
| Find similar nodes or candidate links | Similarity algorithm or link prediction algorithm | A relationship that assigns a similarity score to pairs of nodes, so you can find close matches or likely links |
| Group nodes into clusters | Community detection algorithm | A relationship that assigns a group label to each node, so you can find clusters of related nodes |
Where to go next
Section titled “Where to go next”Follow the links below to learn more about graph reasoning in PyRel.