Skip to content

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.

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.

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 questionsConnectivity algorithm or distance algorithmA relationship that pairs nodes with nodes they can reach, and optionally how far apart they are
Find important or influential nodesCentrality algorithmA relationship that assigns a score to each node, so you can see which ones matter most
Find similar nodes or candidate linksSimilarity algorithm or link prediction algorithmA relationship that assigns a similarity score to pairs of nodes, so you can find close matches or likely links
Group nodes into clustersCommunity detection algorithmA relationship that assigns a group label to each node, so you can find clusters of related nodes

Follow the links below to learn more about graph reasoning in PyRel.